Relang
- sync message sets in all language files based on default file (en)
- community/devel/relang.php[link1]
- add/delete to english, run # relang wacko.en.php wacko.??.php and all set & done
-
/* * ./relang.php wacko.en.php wacko.bg.php wacko.da.php wacko.de.php wacko.el.php wacko.es.php wacko.et.php wacko.fr.php wacko.hu.php \ * wacko.it.php wacko.nl.php wacko.pl.php wacko.pt.php wacko.ru.php * * all changes in en.php (first file) will be moved to other files. * all deletions will be made. * all additions will be made. * all reordering will be made (but values remain localized if already was) * incl. comments! :) * * no need to sync ALL languages manually - just edit english and push changes to other langs * (new messages will be english, though, and if translation is available but you change %1 or other * formatting - be aware: it is better to remove it, resync to other langs, than add new, resync again. * translation would be lost, though) * * you can massively rename resource names, without losing available localizations: * use meta-comment in parent (first in cmd line) file: // RENAME OldTag NewTag 'NewTag' => ... * e.g. resource himself must be manually renamed in parent * after running 'relang wacko.en.php wacko.??.php' then - RENAME comment will be stripped from .en. too * * enjoy! /sts * *//// NB /*...*/ comments in language files not supported!
In *nix systems, use the WHICH command to show the location of the php binary executable. This is the path to use as the first line in your php shell script file.
# which php /usr/local/bin/php
cd /yourpathto/repo/community/devel
php ./relang.php /yourpathto/repo/wacko.en.php wacko.bg.php wacko.da.php wacko.de.php wacko.el.php wacko.es.php wacko.et.php wacko.fr.php wacko.hu.php wacko.it.php wacko.nl.php wacko.pl.php wacko.pt.php wacko.ru.php
Issues
no var
no var in /home/user/workspace/dev/src/lang/wacko.en.php
FIXED diff --git a/community/devel/relang.php b/community/devel/relang.php
--- a/community/devel/relang.php +++ b/community/devel/relang.php @@ -57,7 +57,7 @@ $contents = trim($contents); $parent = 0; - if (!preg_match('/\$([\w_]+)\s*=\s*array\s*\(/', $contents, $match)) + if (!preg_match('/\$([\w_]+)\s*=\s*\[/', $contents, $match)) { if (!$defvar) die("no var in $fname\n"); $var = $defvar;
dupe messages
php ./relang.php /home/user/workspace/dev/src/admin/lang/ap.en.php /home/user/workspace/dev/src/admin/lang/ap.bg.php
dupe messages in /home/user/workspace/dev/src/admin/lang/ap.en.php
Complains about a dupe set but in another sub array
TODO:
- enable relang to handle/skip nested arrays
- add unicode support (?)
- set the
/u
flag for allpreg_*
regex handling Unicode
- set the
- [link1] https://bitbucket.org/wackowiki/wackowiki/src/master/community/devel/relang.php