gettext for plugin example + tools

git-svn-id: https://forge.glpi-project.org/svn/example/trunk@179 349b9182-4a13-0410-896f-e5e9767dd1b3
This commit is contained in:
moyooo
2011-12-20 10:03:35 +00:00
parent 4b086c9c08
commit e53695069b
16 changed files with 684 additions and 87 deletions

18
tools/extract_template.sh Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash
soft='GLPI - Example plugin'
version='0.84'
email=glpi-translation@gna.org
copyright='INDEPNET Development Team'
#xgettext *.php */*.php -copyright-holder='$copyright' --package-name=$soft --package-version=$version --msgid-bugs-address=$email -o locales/en_GB.po -L PHP --from-code=UTF-8 --force-po -i --keyword=_n:1,2 --keyword=__ --keyword=_e
xgettext *.php */*.php --exclude-file=../../locales/glpi.pot -o locales/glpi.pot -L PHP --add-comments=TRANS --from-code=UTF-8 --force-po --keyword=_n:1,2 --keyword=__s --keyword=__ --keyword=_e
### for using tx :
##tx set --execute --auto-local -r GLPI.glpipot 'locales/<lang>.po' --source-lang en --source-file locales/glpi.pot
## tx push -s
## tx pull -a

29
tools/update_mo.pl Executable file
View File

@ -0,0 +1,29 @@
#!/usr/bin/perl
#!/usr/bin/perl -w
if (@ARGV!=0){
print "USAGE update_mo.pl\n\n";
exit();
}
opendir(DIRHANDLE,'locales')||die "ERROR: can not read current directory\n";
foreach (readdir(DIRHANDLE)){
if ($_ ne '..' && $_ ne '.'){
if(!(-l "$dir/$_")){
if (index($_,".po",0)==length($_)-3) {
$lang=$_;
$lang=~s/\.po//;
`msgfmt locales/$_ -o locales/$lang.mo`;
}
}
}
}
closedir DIRHANDLE;
#
#

30
tools/update_po.pl Executable file
View File

@ -0,0 +1,30 @@
#!/usr/bin/perl
#!/usr/bin/perl -w
if (@ARGV!=2){
print "USAGE update_po.pl transifex_login transifex_password\n\n";
exit();
}
$user = $ARGV[0];
$password = $ARGV[1];
opendir(DIRHANDLE,'locales')||die "ERROR: can not read current directory\n";
foreach (readdir(DIRHANDLE)){
if ($_ ne '..' && $_ ne '.'){
if(!(-l "$dir/$_")){
if (index($_,".po",0)==length($_)-3) {
$lang=$_;
$lang=~s/\.po//;
`wget --user=$user --password=$password --output-document=locales/$_ http://www.transifex.net/api/2/project/GLPI_example/resource/glpipot/translation/$lang/?file=$_`;
}
}
}
}
closedir DIRHANDLE;
#
#