Merge pull request #631 from fabrixxm/addonlangs

Per addon translation
This commit is contained in:
friendica 2013-02-27 16:53:08 -08:00
commit 079c638403
18 changed files with 109 additions and 9988 deletions

View file

@ -90,12 +90,21 @@ function pop_lang() {
if(! function_exists('load_translation_table')) { if(! function_exists('load_translation_table')) {
function load_translation_table($lang) { function load_translation_table($lang) {
global $a; global $a;
$a->strings = array();
if(file_exists("view/$lang/strings.php")) { if(file_exists("view/$lang/strings.php")) {
include("view/$lang/strings.php"); include("view/$lang/strings.php");
} }
else // load enabled plugins strings
$a->strings = array(); $plugins = q("SELECT name FROM addon WHERE installed=1;");
if ($plugins!==false) {
foreach($plugins as $p) {
$name = $p['name'];
if(file_exists("addon/$name/lang/$lang/strings.php")) {
include("addon/$name/lang/$lang/strings.php");
}
}
}
}} }}
// translate string if translation exists // translate string if translation exists

View file

@ -32,9 +32,7 @@ $install = ((file_exists('.htconfig.php') && filesize('.htconfig.php')) ? false
$lang = get_browser_language();
load_translation_table($lang);
/** /**
* *
@ -62,6 +60,9 @@ if(!$install) {
$maintenance = get_config('system', 'maintenance'); $maintenance = get_config('system', 'maintenance');
} }
$lang = get_browser_language();
load_translation_table($lang);
/** /**
* *

File diff suppressed because it is too large Load diff

View file

@ -46,9 +46,12 @@ function po2php_run(&$argv, &$argc) {
$match=Array(); $match=Array();
preg_match("|nplurals=([0-9]*); *plural=(.*)[;\\\\]|", $l, $match); preg_match("|nplurals=([0-9]*); *plural=(.*)[;\\\\]|", $l, $match);
$cond = str_replace('n','$n',$match[2]); $cond = str_replace('n','$n',$match[2]);
$out .= 'function string_plural_select_' . $lang . '($n){'."\n"; // define plural select function if not already defined
$fnname = 'string_plural_select_' . $lang;
$out .= 'if(! function_exists("'.$fnname.'")) {'."\n";
$out .= 'function '. $fnname . '($n){'."\n";
$out .= ' return '.$cond.';'."\n"; $out .= ' return '.$cond.';'."\n";
$out .= '}'."\n"; $out .= '}}'."\n";
} }

View file

@ -1,37 +1,76 @@
#!/bin/bash #!/bin/bash
FULLPATH=$(dirname $(readlink -f "$0")) FULLPATH=$(dirname $(readlink -f "$0"))
cd "$FULLPATH/../view/en/"
ADDONMODE=
ADDONNAME=
if [ "$1" == "--addon" -o "$1" == "-a" ]
then
ADDONMODE=1
if [ -z $2 ]; then echo -e "ERROR: missing addon name\n\nrun_xgettext.sh -a <addonname>"; exit 1; fi
ADDONNAME=$2
if [ ! -d "$FULLPATH/../addon/$ADDONNAME" ]; then echo "ERROR: addon '$ADDONNAME' not found"; exit 2; fi
fi
if [ $ADDONMODE ]
then
cd "$FULLPATH/../addon/$ADDONNAME"
mkdir -p "$FULLPATH/../addon/$ADDONNAME/lang/C"
OUTFILE="$FULLPATH/../addon/$ADDONNAME/lang/C/messages.po"
FINDSTARTDIR="."
FINDOPTS=
else
cd "$FULLPATH/../view/en/"
OUTFILE="$FULLPATH/messages.po"
FINDSTARTDIR="../../"
# skip addon folder
FINDOPTS="-wholename */addon -prune -o"
fi
F9KVERSION=$(sed -n "s/.*'FRIENDICA_VERSION'.*'\([0-9.]*\)'.*/\1/p" ../../boot.php); F9KVERSION=$(sed -n "s/.*'FRIENDICA_VERSION'.*'\([0-9.]*\)'.*/\1/p" ../../boot.php);
echo "Friendica version $F9KVERSION" echo "Friendica version $F9KVERSION"
OPTS= OPTS=
OUTFILE="$FULLPATH/messages.po"
if [ "" != "$1" ] #if [ "" != "$1" ]
then #then
OUTFILE="$(readlink -f ${FULLPATH}/$1)" # OUTFILE="$(readlink -f ${FULLPATH}/$1)"
if [ -e "$OUTFILE" ] # if [ -e "$OUTFILE" ]
then # then
echo "join extracted strings" # echo "join extracted strings"
OPTS="-j" # OPTS="-j"
fi # fi
fi #fi
KEYWORDS="-k -kt -ktt:1,2" KEYWORDS="-k -kt -ktt:1,2"
echo "extract strings to $OUTFILE.." echo "extract strings to $OUTFILE.."
find ../../ -name "*.php" | xargs xgettext $KEYWORDS $OPTS -o "$OUTFILE" --from-code=UTF-8 for f in $(find "$FINDSTARTDIR" $FINDOPTS -name "*.php" -type f)
do
if [ ! -d "$f" ]
then
xgettext $KEYWORDS $OPTS -o "$OUTFILE" --from-code=UTF-8 "$f"
fi
done
echo "setup base info.." echo "setup base info.."
sed -i "s/SOME DESCRIPTIVE TITLE./FRIENDICA Distributed Social Network/g" "$OUTFILE" if [ $ADDONMODE ]
sed -i "s/YEAR THE PACKAGE'S COPYRIGHT HOLDER/2010, 2011 the Friendica Project/g" "$OUTFILE" then
sed -i "s/FIRST AUTHOR <EMAIL@ADDRESS>, YEAR./Mike Macgirvin, 2010/g" "$OUTFILE" sed -i "s/SOME DESCRIPTIVE TITLE./ADDON $ADDONNAME/g" "$OUTFILE"
sed -i "s/PACKAGE VERSION/$F9KVERSION/g" "$OUTFILE" sed -i "s/YEAR THE PACKAGE'S COPYRIGHT HOLDER//g" "$OUTFILE"
sed -i "s/PACKAGE/Friendica/g" "$OUTFILE" sed -i "s/FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.//g" "$OUTFILE"
sed -i "s/CHARSET/UTF-8/g" "$OUTFILE" sed -i "s/PACKAGE VERSION//g" "$OUTFILE"
sed -i "s/^\"Plural-Forms/#\"Plural-Forms/g" "$OUTFILE" sed -i "s/PACKAGE/Friendica $ADDONNAME addon/g" "$OUTFILE"
sed -i "s/CHARSET/UTF-8/g" "$OUTFILE"
sed -i "s/^\"Plural-Forms/#\"Plural-Forms/g" "$OUTFILE"
else
sed -i "s/SOME DESCRIPTIVE TITLE./FRIENDICA Distributed Social Network/g" "$OUTFILE"
sed -i "s/YEAR THE PACKAGE'S COPYRIGHT HOLDER/2010, 2011, 2012, 2013 the Friendica Project/g" "$OUTFILE"
sed -i "s/FIRST AUTHOR <EMAIL@ADDRESS>, YEAR./Mike Macgirvin, 2010/g" "$OUTFILE"
sed -i "s/PACKAGE VERSION/$F9KVERSION/g" "$OUTFILE"
sed -i "s/PACKAGE/Friendica/g" "$OUTFILE"
sed -i "s/CHARSET/UTF-8/g" "$OUTFILE"
sed -i "s/^\"Plural-Forms/#\"Plural-Forms/g" "$OUTFILE"
fi
echo "done." echo "done."

View file

@ -1,8 +1,9 @@
<?php <?php
if(! function_exists("string_plural_select_ca")) {
function string_plural_select_ca($n){ function string_plural_select_ca($n){
return ($n != 1);; return ($n != 1);;
} }}
; ;
$a->strings["Post successful."] = "Publicat amb éxit."; $a->strings["Post successful."] = "Publicat amb éxit.";
$a->strings["[Embedded content - reload page to view]"] = "[Contingut embegut - recarrega la pàgina per a veure-ho]"; $a->strings["[Embedded content - reload page to view]"] = "[Contingut embegut - recarrega la pàgina per a veure-ho]";

View file

@ -1,8 +1,9 @@
<?php <?php
if(! function_exists("string_plural_select_cs")) {
function string_plural_select_cs($n){ function string_plural_select_cs($n){
return ($n==1) ? 0 : ($n>=2 && $n<=4) ? 1 : 2;; return ($n==1) ? 0 : ($n>=2 && $n<=4) ? 1 : 2;;
} }}
; ;
$a->strings["Post successful."] = "Příspěvek úspěšně odeslán"; $a->strings["Post successful."] = "Příspěvek úspěšně odeslán";
$a->strings["[Embedded content - reload page to view]"] = "[Vložený obsah - obnovení stránky pro zobrazení]"; $a->strings["[Embedded content - reload page to view]"] = "[Vložený obsah - obnovení stránky pro zobrazení]";

View file

@ -1,8 +1,9 @@
<?php <?php
if(! function_exists("string_plural_select_de")) {
function string_plural_select_de($n){ function string_plural_select_de($n){
return ($n != 1);; return ($n != 1);;
} }}
; ;
$a->strings["Altpager settings updated."] = "Altpager Einstellungen sind aktualisiert."; $a->strings["Altpager settings updated."] = "Altpager Einstellungen sind aktualisiert.";
$a->strings["Alternate Pagination Setting"] = "Alternative Seitenumbruch Einstellung"; $a->strings["Alternate Pagination Setting"] = "Alternative Seitenumbruch Einstellung";

View file

@ -1,8 +1,9 @@
<?php <?php
if(! function_exists("string_plural_select_eo")) {
function string_plural_select_eo($n){ function string_plural_select_eo($n){
return ($n != 1);; return ($n != 1);;
} }}
; ;
$a->strings["Post successful."] = "Sukcese afiŝita."; $a->strings["Post successful."] = "Sukcese afiŝita.";
$a->strings["[Embedded content - reload page to view]"] = "[Enigita enhavo - reŝargu paĝon por spekti ĝin]"; $a->strings["[Embedded content - reload page to view]"] = "[Enigita enhavo - reŝargu paĝon por spekti ĝin]";

View file

@ -1,8 +1,9 @@
<?php <?php
if(! function_exists("string_plural_select_es")) {
function string_plural_select_es($n){ function string_plural_select_es($n){
return ($n != 1);; return ($n != 1);;
} }}
; ;
$a->strings["Post successful."] = "¡Publicado!"; $a->strings["Post successful."] = "¡Publicado!";
$a->strings["[Embedded content - reload page to view]"] = "[Contenido incrustado - recarga la página para verlo]"; $a->strings["[Embedded content - reload page to view]"] = "[Contenido incrustado - recarga la página para verlo]";

View file

@ -1,8 +1,9 @@
<?php <?php
if(! function_exists("string_plural_select_fr")) {
function string_plural_select_fr($n){ function string_plural_select_fr($n){
return ($n > 1);; return ($n > 1);;
} }}
; ;
$a->strings["Post successful."] = "Publication réussie."; $a->strings["Post successful."] = "Publication réussie.";
$a->strings["[Embedded content - reload page to view]"] = "[contenu incorporé - rechargez la page pour le voir]"; $a->strings["[Embedded content - reload page to view]"] = "[contenu incorporé - rechargez la page pour le voir]";

View file

@ -1,8 +1,9 @@
<?php <?php
if(! function_exists("string_plural_select_is")) {
function string_plural_select_is($n){ function string_plural_select_is($n){
return ($n != 1);; return ($n != 1);;
} }}
; ;
$a->strings["Post successful."] = "Melding tókst."; $a->strings["Post successful."] = "Melding tókst.";
$a->strings["[Embedded content - reload page to view]"] = "[Innfelt efni - endurhlaða síðu til að sjá]"; $a->strings["[Embedded content - reload page to view]"] = "[Innfelt efni - endurhlaða síðu til að sjá]";

View file

@ -1,8 +1,9 @@
<?php <?php
if(! function_exists("string_plural_select_it")) {
function string_plural_select_it($n){ function string_plural_select_it($n){
return ($n != 1);; return ($n != 1);;
} }}
; ;
$a->strings["Altpager settings updated."] = "Impostazioni Altpager aggiornate."; $a->strings["Altpager settings updated."] = "Impostazioni Altpager aggiornate.";
$a->strings["Alternate Pagination Setting"] = "Impostazioni Paginatore Alternativo"; $a->strings["Alternate Pagination Setting"] = "Impostazioni Paginatore Alternativo";

View file

@ -1,8 +1,9 @@
<?php <?php
if(! function_exists("string_plural_select_nb_no")) {
function string_plural_select_nb_no($n){ function string_plural_select_nb_no($n){
return ($n != 1);; return ($n != 1);;
} }}
; ;
$a->strings["Post successful."] = "Innlegg vellykket."; $a->strings["Post successful."] = "Innlegg vellykket.";
$a->strings["[Embedded content - reload page to view]"] = "[Innebygget innhold - hent siden på nytt for å se det]"; $a->strings["[Embedded content - reload page to view]"] = "[Innebygget innhold - hent siden på nytt for å se det]";

View file

@ -1,8 +1,9 @@
<?php <?php
if(! function_exists("string_plural_select_pl")) {
function string_plural_select_pl($n){ function string_plural_select_pl($n){
return ($n==1 ? 0 : $n%10>=2 && $n%10<=4 && ($n%100<10 || $n%100>=20) ? 1 : 2);; return ($n==1 ? 0 : $n%10>=2 && $n%10<=4 && ($n%100<10 || $n%100>=20) ? 1 : 2);;
} }}
; ;
$a->strings["Post successful."] = "Post dodany pomyślnie"; $a->strings["Post successful."] = "Post dodany pomyślnie";
$a->strings["[Embedded content - reload page to view]"] = ""; $a->strings["[Embedded content - reload page to view]"] = "";

View file

@ -1,8 +1,9 @@
<?php <?php
if(! function_exists("string_plural_select_pt_br")) {
function string_plural_select_pt_br($n){ function string_plural_select_pt_br($n){
return ($n > 1);; return ($n > 1);;
} }}
; ;
$a->strings["Post successful."] = "Publicado com sucesso."; $a->strings["Post successful."] = "Publicado com sucesso.";
$a->strings["[Embedded content - reload page to view]"] = "[Conteúdo incorporado - recarregue a página para ver]"; $a->strings["[Embedded content - reload page to view]"] = "[Conteúdo incorporado - recarregue a página para ver]";

View file

@ -1,8 +1,9 @@
<?php <?php
if(! function_exists("string_plural_select_ru")) {
function string_plural_select_ru($n){ function string_plural_select_ru($n){
return ($n%10==1 && $n%100!=11 ? 0 : $n%10>=2 && $n%10<=4 && ($n%100<10 || $n%100>=20) ? 1 : 2);; return ($n%10==1 && $n%100!=11 ? 0 : $n%10>=2 && $n%10<=4 && ($n%100<10 || $n%100>=20) ? 1 : 2);;
} }}
; ;
$a->strings["Post successful."] = "Успешно добавлено."; $a->strings["Post successful."] = "Успешно добавлено.";
$a->strings["[Embedded content - reload page to view]"] = "[Встроенное содержание - перезагрузите страницу для просмотра]"; $a->strings["[Embedded content - reload page to view]"] = "[Встроенное содержание - перезагрузите страницу для просмотра]";

View file

@ -1,8 +1,9 @@
<?php <?php
if(! function_exists("string_plural_select_zh_cn")) {
function string_plural_select_zh_cn($n){ function string_plural_select_zh_cn($n){
return 0;; return 0;;
} }}
; ;
$a->strings["Post successful."] = "评论发表了。"; $a->strings["Post successful."] = "评论发表了。";
$a->strings["[Embedded content - reload page to view]"] = "[嵌入内容-重新加载页为看]"; $a->strings["[Embedded content - reload page to view]"] = "[嵌入内容-重新加载页为看]";
@ -1505,7 +1506,7 @@ $a->strings["Alternate Pagination Setting"] = "供替换的分页设置";
$a->strings["Use links to \"newer\" and \"older\" pages in place of page numbers?"] = "用到「更新」和「更旧」页代替页数?"; $a->strings["Use links to \"newer\" and \"older\" pages in place of page numbers?"] = "用到「更新」和「更旧」页代替页数?";
$a->strings["Force global use of the alternate pager"] = "让大家用供替换的分页"; $a->strings["Force global use of the alternate pager"] = "让大家用供替换的分页";
$a->strings["Each user chooses whether to use the alternate pager"] = "每用户选择是否用供替换的分页"; $a->strings["Each user chooses whether to use the alternate pager"] = "每用户选择是否用供替换的分页";
$a->strings["The MathJax addon renders mathematical formulae written using the LaTeX syntax surrounded by the usual $$ or an eqnarray block in the postings of your wall,network tab and private mail."] = "MathJax插件表示用LaTeX句法的数学公式围绕\$\$或者eqnarray快在您墙网络分页和私人收件箱的文章。"; $a->strings["The MathJax addon renders mathematical formulae written using the LaTeX syntax surrounded by the usual $$ or an eqnarray block in the postings of your wall,network tab and private mail."] = "MathJax插件表示用LaTeX句法的数学公式围绕$$或者eqnarray快在您墙网络分页和私人收件箱的文章。";
$a->strings["Use the MathJax renderer"] = "用MathJax表示器"; $a->strings["Use the MathJax renderer"] = "用MathJax表示器";
$a->strings["MathJax Base URL"] = "MathJax基础URL"; $a->strings["MathJax Base URL"] = "MathJax基础URL";
$a->strings["The URL for the javascript file that should be included to use MathJax. Can be either the MathJax CDN or another installation of MathJax."] = "URL JavaScript文件应该包括为用MathJax。可以MathJax CDN或者别的MathJax安装。"; $a->strings["The URL for the javascript file that should be included to use MathJax. Can be either the MathJax CDN or another installation of MathJax."] = "URL JavaScript文件应该包括为用MathJax。可以MathJax CDN或者别的MathJax安装。";