+ * @param string $translation
+ * @return array
+ */
+ function make_headers($translation) {
+ $headers = array();
+ // sometimes \ns are used instead of real new lines
+ $translation = str_replace('\n', "\n", $translation);
+ $lines = explode("\n", $translation);
+ foreach($lines as $line) {
+ $parts = explode(':', $line, 2);
+ if (!isset($parts[1])) continue;
+ $headers[trim($parts[0])] = trim($parts[1]);
+ }
+ return $headers;
+ }
+
+ /**
+ * @param string $header
+ * @param string $value
+ */
+ function set_header($header, $value) {
+ parent::set_header($header, $value);
+ if ('Plural-Forms' == $header) {
+ list( $nplurals, $expression ) = $this->nplurals_and_expression_from_header($this->get_header('Plural-Forms'));
+ $this->_nplurals = $nplurals;
+ $this->_gettext_select_plural_form = $this->make_plural_form_function($nplurals, $expression);
+ }
+ }
+}
+endif;
+
+if ( ! class_exists( 'NOOP_Translations', false ) ):
+/**
+ * Provides the same interface as Translations, but doesn't do anything
+ */
+class NOOP_Translations {
+ var $entries = array();
+ var $headers = array();
+
+ function add_entry($entry) {
+ return true;
+ }
+
+ /**