]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - scripts/update_po_templates.php
Don't accept non-objects before testing with "instanceof".
[quix0rs-gnu-social.git] / scripts / update_po_templates.php
index 83bff6d8067add76e3eecb82d0cd69a7cee8a797..a5730e6d2f7f43955e08db8173ec5049c671ae36 100755 (executable)
@@ -34,11 +34,16 @@ function update_core($dir, $domain)
 xgettext \
     --from-code=UTF-8 \
     --default-domain=$domain \
-    --output=locale/$domain.po \
+    --output=locale/$domain.pot \
     --language=PHP \
-    --keyword="_m:1" \
+    --add-comments=TRANS \
+    --keyword="_m:1,1t" \
+    --keyword="_m:1c,2,2t" \
+    --keyword="_m:1,2,3t" \
+    --keyword="_m:1c,2,3,4t" \
     --keyword="pgettext:1c,2" \
     --keyword="npgettext:1c,2,3" \
+    index.php \
     actions/*.php \
     classes/*.php \
     lib/*.php \
@@ -60,10 +65,14 @@ function do_update_plugin($dir, $domain)
 xgettext \
     --from-code=UTF-8 \
     --default-domain=$domain \
-    --output=locale/$domain.po \
+    --output=locale/$domain.pot \
     --language=PHP \
+    --add-comments=TRANS \
     --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) {
@@ -73,44 +82,6 @@ END;
     chdir($old);
 }
 
-function do_translatewiki_plugin($basedir, $plugin)
-{
-    $yamldir = "$basedir/locale/TranslateWiki";
-    if (!file_exists($yamldir)) {
-        mkdir($yamldir);
-    }
-    $outfile = "$yamldir/StatusNet-{$plugin}.yml";
-    $data = <<<END
----
-BASIC:
-  id: out-statusnet-{$plugin}
-  label: StatusNet - {$plugin}
-  description: "{{int:bw-desc-statusnet-plugin-{$plugin}}}"
-  namespace: NS_STATUSNET
-  display: out/statusnet/{$plugin}
-  class: GettextMessageGroup
-
-FILES:
-  class: GettextFFS
-  sourcePattern: %GROUPROOT%/plugins/{$plugin}/locale/%CODE%/LC_MESSAGES/{$plugin}.po
-  targetPattern: {$plugin}.po
-  codeMap:
-    en-gb: en_GB
-    no: nb
-    pt-br: pt_BR
-    zh-hans: zh_CN
-    zh-hant: zh_TW
-
-MANGLER
-  class: StringMatcher
-  prefix: {$plugin}-
-  patterns:
-    - "*"
-
-END;
-    file_put_contents($outfile, $data);
-}
-
 function get_plugins($dir)
 {
     $plugins = array();
@@ -159,7 +130,6 @@ function update_plugin($basedir, $name)
     $dir = "$basedir/plugins/$name";
     if (plugin_using_gettext($dir)) {
         do_update_plugin($dir, $name);
-        do_translatewiki_plugin($basedir, $name);
         return true;
     } else {
         return false;
@@ -185,11 +155,12 @@ 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);
     }
 }
 
-
-
 if ($all || $core) {
     echo "core...";
     update_core(INSTALLDIR, 'statusnet');
@@ -208,4 +179,3 @@ if ($plugins) {
         }
     }
 }
-