diff options
author | Aris Feryanto <aris_feryanto@yahoo.com> | 2011-08-12 11:56:26 +0400 |
---|---|---|
committer | Aris Feryanto <aris_feryanto@yahoo.com> | 2011-08-12 11:56:26 +0400 |
commit | 3f10465d71beb3b942da7a48fbc61fa65331dc8d (patch) | |
tree | 4d818c3ac0402c9c95a5ac17b67bebfc0f0c363a /scripts | |
parent | a24eeef70c807e0980588120981a9559eb6acda5 (diff) | |
parent | 45aac8dbf4e87b12ba3c2809c49ce250161afabf (diff) |
Fix merge conflict with origin/master
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/advisor2php | 33 | ||||
-rwxr-xr-x | scripts/update-po | 9 |
2 files changed, 41 insertions, 1 deletions
diff --git a/scripts/advisor2php b/scripts/advisor2php new file mode 100644 index 0000000000..28a58176fe --- /dev/null +++ b/scripts/advisor2php @@ -0,0 +1,33 @@ +<?php +/* vim: set expandtab sw=4 ts=4 sts=4 ft=php: */ +/** + * Script to parse advisor rules and output them as PHP code which can be used + * by gettext for generating po(t) files. + */ + +if (!file_exists('./libraries/advisor.class.php')) { + chdir('..'); +} +include './libraries/advisor.class.php'; + +$rules = Advisor::parseRulesFile(); + +echo "<?php\n"; +echo "/* DO NOT EDIT! */\n"; +echo "/* This is automatically generated file from libraries/advisory_rules.txt */\n"; + +foreach($rules['rules'] as $rule) { + echo "\n"; + echo "echo __('" . addslashes($rule['name']) . "');\n"; + echo "echo __('" . addslashes($rule['issue']) . "');\n"; + echo "echo __('" . addslashes($rule['recommendation']) . "');\n"; + $jst = Advisor::splitJustification($rule); + if (count($jst) > 1) { + /* printf is used here just to ensure proper type of string */ + echo "printf(__('" . addslashes($jst[0]) . "'), 0);\n"; + } else { + echo "echo __('" . addslashes($jst[0]) . "');\n"; + } +} + +?> diff --git a/scripts/update-po b/scripts/update-po index a12e59890b..9131980be1 100755 --- a/scripts/update-po +++ b/scripts/update-po @@ -1,6 +1,11 @@ #!/bin/sh # vim: expandtab sw=4 ts=4 sts=4: export LC_ALL=C + +# Generate PHP code for advisor rules +php ./scripts/advisor2php > po/advisory_rules.php + +# Update pot (template), ensure that advisor is at the end LOCS=`ls po/*.po | sed 's@.*/\(.*\)\.po@\1@'` xgettext \ -d phpmyadmin \ @@ -12,7 +17,8 @@ xgettext \ --debug \ --keyword=__ --keyword=_pgettext:1c,2 --keyword=_ngettext:1,2 \ --copyright-holder="phpMyAdmin devel team" \ - `find . -name '*.php' -not -path './test/*' | sort` + `find . -name '*.php' -not -path './test/*' -not -path './po/*' | sort` \ + po/advisory_rules.php ver=`sed -n "/PMA_VERSION', '/ s/.*PMA_VERSION', '\(.*\)'.*/\1/p" libraries/Config.class.php` @@ -23,6 +29,7 @@ sed -i ' s/VERSION/'$ver'/; ' po/phpmyadmin.pot +# Update po files (translations) for loc in $LOCS ; do sed -i ' s/SOME DESCRIPTIVE TITLE/phpMyAdmin translation/; |