]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Fix update_po_templates.php to support the plural and context variants of _m() in...
authorBrion Vibber <brion@pobox.com>
Thu, 25 Feb 2010 00:34:45 +0000 (16:34 -0800)
committerBrion Vibber <brion@pobox.com>
Thu, 25 Feb 2010 00:34:45 +0000 (16:34 -0800)
plugins/Sample/hello.php
plugins/Sample/locale/Sample.po [new file with mode: 0644]
scripts/update_po_templates.php

index 0cfd8a1c3e9d9eb7e3f33a7e1830cc7ef437db13..dfbd0ad4f256ffa578a2a7cdde65a0e2cd4580de 100644 (file)
@@ -119,13 +119,15 @@ class HelloAction extends Action
     }
 
     /**
-     * show content in the content area
+     * Show content in the content area
      *
      * The default StatusNet page has a lot of decorations: menus,
      * logos, tabs, all that jazz. This method is used to show
      * content in the content area of the page; it's the main
      * thing you want to overload.
      *
+     * This method also demonstrates use of a plural localized string.
+     *
      * @return void
      */
 
@@ -138,7 +140,9 @@ class HelloAction extends Action
             $this->element('p', array('class' => 'greeting'),
                            sprintf(_m('Hello, %s'), $this->user->nickname));
             $this->element('p', array('class' => 'greeting_count'),
-                           sprintf(_m('I have greeted you %d time(s).'),
+                           sprintf(_m('I have greeted you %d time.',
+                                      'I have greeted you %d times.',
+                                      $this->gc->greeting_count),
                                    $this->gc->greeting_count));
         }
     }
diff --git a/plugins/Sample/locale/Sample.po b/plugins/Sample/locale/Sample.po
new file mode 100644 (file)
index 0000000..e0d2aa8
--- /dev/null
@@ -0,0 +1,56 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2010-02-24 16:33-0800\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
+
+#: hello.php:115 SamplePlugin.php:266
+msgid "Hello"
+msgstr ""
+
+#: hello.php:117 hello.php:141
+#, php-format
+msgid "Hello, %s"
+msgstr ""
+
+#: hello.php:138
+msgid "Hello, stranger!"
+msgstr ""
+
+#: hello.php:143
+#, php-format
+msgid "I have greeted you %d time."
+msgid_plural "I have greeted you %d times."
+msgstr[0] ""
+msgstr[1] ""
+
+#: SamplePlugin.php:266
+msgid "A warm greeting"
+msgstr ""
+
+#: SamplePlugin.php:277
+msgid "A sample plugin to show basics of development for new hackers."
+msgstr ""
+
+#: User_greeting_count.php:163
+#, php-format
+msgid "Could not save new greeting count for %d"
+msgstr ""
+
+#: User_greeting_count.php:176
+#, php-format
+msgid "Could not increment greeting count for %d"
+msgstr ""
index f882f673a4d9d00025dcfe0154c7068ce60142c8..61a6ac78331d543f66af381255961b103ee9f15a 100755 (executable)
@@ -63,7 +63,10 @@ xgettext \
     --output=locale/$domain.po \
     --language=PHP \
     --keyword='' \
-    --keyword="_m:1" \
+    --keyword="_m:1,1t" \
+    --keyword="_m:1c,2,2t" \
+    --keyword="_m:1,2,3t" \
+    --keyword="_m:1c,2,3,4t" \
 
 END;
     foreach ($files as $file) {
@@ -186,6 +189,9 @@ foreach ($args as $arg) {
         $allplugins = true;
     } elseif (substr($arg, 0, 9) == "--plugin=") {
         $plugins[] = substr($arg, 9);
+    } elseif ($arg == '--help') {
+        echo "options: --all --core --plugins --plugin=Foo\n\n";
+        exit(0);
     }
 }