diff --git a/README.translate.md b/README.translate.md index 728a56ab30..861e98440a 100644 --- a/README.translate.md +++ b/README.translate.md @@ -24,12 +24,12 @@ If you want to get your work into the source tree yourself, feel free to do so a The process is simple and friendica ships with all the tools necessary. The location of the translated files in the source tree is - /view/LNG-CODE/ + /view/lang/LNG-CODE/ where LNG-CODE is the language code used, e.g. de for German or fr for French. The translated strings come as a "message.po" file from transifex which needs to be translated into the PHP file friendica uses. To do so, place the file in the directory mentioned above and use the "po2php" utility from the util directory of your friendica installation. -Assuming you want to convert the German localization which is placed in view/de/message.po you would do the following. +Assuming you want to convert the German localization which is placed in view/lang/de/message.po you would do the following. 1. Navigate at the command prompt to the base directory of your friendica installation @@ -37,9 +37,9 @@ Assuming you want to convert the German localization which is placed in view/de/ 2. Execute the po2php script, which will place the translation in the strings.php file that is used by friendica. - $> php util/po2php.php view/de/messages.po + $> php util/po2php.php view/lang/de/messages.po - The output of the script will be placed at view/de/strings.php where + The output of the script will be placed at view/lang/de/strings.php where friendica is expecting it, so you can test your translation immediately. 3. Visit your friendica page to check if it still works in the language you @@ -50,7 +50,7 @@ Assuming you want to convert the German localization which is placed in view/de/ not give any output if the file is ok but might give a hint for searching the bug in the file. - $> php view/de/strings.php + $> php view/lang/de/strings.php 4. commit the two files with a meaningful commit message to your git repository, push it to your fork of the friendica repository at github and diff --git a/doc/translations.md b/doc/translations.md index 728a56ab30..861e98440a 100644 --- a/doc/translations.md +++ b/doc/translations.md @@ -24,12 +24,12 @@ If you want to get your work into the source tree yourself, feel free to do so a The process is simple and friendica ships with all the tools necessary. The location of the translated files in the source tree is - /view/LNG-CODE/ + /view/lang/LNG-CODE/ where LNG-CODE is the language code used, e.g. de for German or fr for French. The translated strings come as a "message.po" file from transifex which needs to be translated into the PHP file friendica uses. To do so, place the file in the directory mentioned above and use the "po2php" utility from the util directory of your friendica installation. -Assuming you want to convert the German localization which is placed in view/de/message.po you would do the following. +Assuming you want to convert the German localization which is placed in view/lang/de/message.po you would do the following. 1. Navigate at the command prompt to the base directory of your friendica installation @@ -37,9 +37,9 @@ Assuming you want to convert the German localization which is placed in view/de/ 2. Execute the po2php script, which will place the translation in the strings.php file that is used by friendica. - $> php util/po2php.php view/de/messages.po + $> php util/po2php.php view/lang/de/messages.po - The output of the script will be placed at view/de/strings.php where + The output of the script will be placed at view/lang/de/strings.php where friendica is expecting it, so you can test your translation immediately. 3. Visit your friendica page to check if it still works in the language you @@ -50,7 +50,7 @@ Assuming you want to convert the German localization which is placed in view/de/ not give any output if the file is ok but might give a hint for searching the bug in the file. - $> php view/de/strings.php + $> php view/lang/de/strings.php 4. commit the two files with a meaningful commit message to your git repository, push it to your fork of the friendica repository at github and diff --git a/include/pgettext.php b/include/pgettext.php index f72cbb08a7..3c389ce2e5 100644 --- a/include/pgettext.php +++ b/include/pgettext.php @@ -41,7 +41,7 @@ function get_browser_language() { if(isset($langs) && count($langs)) { foreach ($langs as $lang => $v) { - if(file_exists("view/$lang") && is_dir("view/$lang")) { + if(file_exists("view/lang/$lang") && is_dir("view/lang/$lang")) { $preferred = $lang; break; } @@ -112,8 +112,8 @@ function load_translation_table($lang) { } } - if(file_exists("view/$lang/strings.php")) { - include("view/$lang/strings.php"); + if(file_exists("view/lang/$lang/strings.php")) { + include("view/lang/$lang/strings.php"); } }} @@ -171,11 +171,11 @@ function string_plural_select_default($n) { */ function get_avaiable_languages() { $lang_choices = array(); - $langs = glob('view/*/strings.php'); /**/ + $langs = glob('view/lang/*/strings.php'); /**/ if(is_array($langs) && count($langs)) { - if(! in_array('view/en/strings.php',$langs)) - $langs[] = 'view/en/'; + if(! in_array('view/lang/en/strings.php',$langs)) + $langs[] = 'view/lang/en/'; asort($langs); foreach($langs as $l) { $t = explode("/",$l); diff --git a/include/text.php b/include/text.php index 2276f6688d..72fce41861 100644 --- a/include/text.php +++ b/include/text.php @@ -581,14 +581,14 @@ function get_intltext_template($s) { if(! isset($lang)) $lang = 'en'; - if(file_exists("view/$lang$engine/$s")) { + if(file_exists("view/lang/$lang$engine/$s")) { $stamp1 = microtime(true); - $content = file_get_contents("view/$lang$engine/$s"); + $content = file_get_contents("view/lang/$lang$engine/$s"); $a->save_timestamp($stamp1, "file"); return $content; - } elseif(file_exists("view/en$engine/$s")) { + } elseif(file_exists("view/lang/en$engine/$s")) { $stamp1 = microtime(true); - $content = file_get_contents("view/en$engine/$s"); + $content = file_get_contents("view/lang/en$engine/$s"); $a->save_timestamp($stamp1, "file"); return $content; } else { @@ -928,11 +928,11 @@ function contact_block() { * string 'thumb' => The contact picture * string 'click' => js code which is performed when clicking on the contact * @param boolean $redirect If true try to use the redir url if it's possible - * @param string $class CSS class for the + * @param string $class CSS class for the * @param boolean $textmode If true display the contacts as text links * if false display the contacts as picture links - - * @return string Formatted html + + * @return string Formatted html */ function micropro($contact, $redirect = false, $class = '', $textmode = false) { @@ -2087,7 +2087,7 @@ function formatBytes($bytes, $precision = 2) { /** * @brief translate and format the networkname of a contact - * + * * @param string $network * Networkname of the contact (e.g. dfrn, rss and so on) * @param sting $url @@ -2132,7 +2132,7 @@ function text_highlight($s,$lang) { $s = trim(html_entity_decode($s,ENT_COMPAT)); $s = str_replace(" ","\t",$s); - // The highlighter library insists on an opening php tag for php code blocks. If + // The highlighter library insists on an opening php tag for php code blocks. If // it isn't present, nothing is highlighted. So we're going to see if it's present. // If not, we'll add it, and then quietly remove it after we get the processed output back. @@ -2141,7 +2141,7 @@ function text_highlight($s,$lang) { $s = 'string["%d message sent"] = Array( @@ -82,12 +82,12 @@ Xgettext and .po workflow This script runs xgettext on source tree, extracting strings from t() and tt() functions, and creates a util/messages.po file. - $ cd util; ./run_xgettext.sh + $ cd util; ./run_xgettext.sh -2. copy util/messages.po to view//messages.po - Replace with the language you are working on - e.g. 'es', 'fr', 'de', etc. +2. copy util/messages.po to view/lang//messages.po + Replace with the language you are working on - e.g. 'es', 'fr', 'de', etc. -3. open view//messages.po with a text editor and fill in infos in +3. open view/lang//messages.po with a text editor and fill in infos in "Last-Translator: FULL NAME " "Language-Team: LANGUAGE \n" "Language: \n" @@ -97,30 +97,30 @@ Xgettext and .po workflow "Language-Team: Pirate Friendika \n" "Language: pi\n" ) - + For the line "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" - read GNU gettext manual at + read GNU gettext manual at http://www.gnu.org/software/hello/manual/gettext/Plural-forms.html - + 4. You could then translate the strings in text editor, but I suggest to use one of the many .po editors out there, like QtLinguist - -5. run - $ php util/po2php.php view//messages.po + +5. run + $ php util/po2php.php view/lang//messages.po to create the strings.php file - + When strings are added or modified in source, you could run - $ cd util; ./run_xgettext.sh ../view//messages.po + $ cd util; ./run_xgettext.sh ../view/lang//messages.po to extract strings from source files and join them with the existing .po file: new strings are added, the existing are not overwritten. - + If you already translated Friendica using strings.php, you could import your old translation to messages.po. Run: -$ php util/php2po.php view//strings.php +$ php util/php2po.php view/lang//strings.php + + +You may also use the util/string_translator.php web interface to translate the string file, but it is disabled for website security reasons. The web server will need write permission to your language directories and the "Deny ..." line in util/.htaccess will need to be modified or commented to use the utility. -You may also use the util/string_translator.php web interface to translate the string file, but it is disabled for website security reasons. The web server will need write permission to your language directories and the "Deny ..." line in util/.htaccess will need to be modified or commented to use the utility. - - diff --git a/util/make_credits.py b/util/make_credits.py index abd6d53001..9575f10ffb 100755 --- a/util/make_credits.py +++ b/util/make_credits.py @@ -67,7 +67,7 @@ os.chdir(path) # get the translators print('> getting translators') intrans = False -for f in glob.glob(path+'/view/*/messages.po'): +for f in glob.glob(path+'/view/lang/*/messages.po'): i = open(f, 'r') l = i.readlines() i.close() diff --git a/util/typo.php b/util/typo.php index 0e2177c706..d68ac2ac9b 100644 --- a/util/typo.php +++ b/util/typo.php @@ -1,6 +1,6 @@ config,'php_path')) @@ -29,7 +29,7 @@ foreach($files as $file) { passthru("$phpath -l $file", $ret); $ret===0 or die(); } - + echo "Directory: object\n"; $files = glob('object/*.php'); foreach($files as $file) { @@ -53,7 +53,7 @@ echo 'util/strings.php' . "\n"; passthru("$phpath -l util/strings.php", $ret); $ret===0 or die(); - $files = glob('view/*/strings.php'); + $files = glob('view/lang/*/strings.php'); foreach($files as $file) { passthru("$phpath -l $file", $ret); $ret===0 or die(); } diff --git a/view/bg/messages.po b/view/lang/bg/messages.po similarity index 100% rename from view/bg/messages.po rename to view/lang/bg/messages.po diff --git a/view/bg/strings.php b/view/lang/bg/strings.php similarity index 100% rename from view/bg/strings.php rename to view/lang/bg/strings.php diff --git a/view/ca/messages.po b/view/lang/ca/messages.po similarity index 100% rename from view/ca/messages.po rename to view/lang/ca/messages.po diff --git a/view/ca/strings.php b/view/lang/ca/strings.php similarity index 100% rename from view/ca/strings.php rename to view/lang/ca/strings.php diff --git a/view/cs/messages.po b/view/lang/cs/messages.po similarity index 100% rename from view/cs/messages.po rename to view/lang/cs/messages.po diff --git a/view/cs/strings.php b/view/lang/cs/strings.php similarity index 100% rename from view/cs/strings.php rename to view/lang/cs/strings.php diff --git a/view/de/messages.po b/view/lang/de/messages.po similarity index 100% rename from view/de/messages.po rename to view/lang/de/messages.po diff --git a/view/de/strings.php b/view/lang/de/strings.php similarity index 100% rename from view/de/strings.php rename to view/lang/de/strings.php diff --git a/view/eo/messages.po b/view/lang/eo/messages.po similarity index 100% rename from view/eo/messages.po rename to view/lang/eo/messages.po diff --git a/view/eo/strings.php b/view/lang/eo/strings.php similarity index 100% rename from view/eo/strings.php rename to view/lang/eo/strings.php diff --git a/view/es/messages.po b/view/lang/es/messages.po similarity index 100% rename from view/es/messages.po rename to view/lang/es/messages.po diff --git a/view/es/strings.php b/view/lang/es/strings.php similarity index 100% rename from view/es/strings.php rename to view/lang/es/strings.php diff --git a/view/fr/messages.po b/view/lang/fr/messages.po similarity index 100% rename from view/fr/messages.po rename to view/lang/fr/messages.po diff --git a/view/fr/strings.php b/view/lang/fr/strings.php similarity index 100% rename from view/fr/strings.php rename to view/lang/fr/strings.php diff --git a/view/is/messages.po b/view/lang/is/messages.po similarity index 100% rename from view/is/messages.po rename to view/lang/is/messages.po diff --git a/view/is/strings.php b/view/lang/is/strings.php similarity index 100% rename from view/is/strings.php rename to view/lang/is/strings.php diff --git a/view/it/messages.po b/view/lang/it/messages.po similarity index 100% rename from view/it/messages.po rename to view/lang/it/messages.po diff --git a/view/it/strings.php b/view/lang/it/strings.php similarity index 100% rename from view/it/strings.php rename to view/lang/it/strings.php diff --git a/view/nb-no/messages.po b/view/lang/nb-no/messages.po similarity index 100% rename from view/nb-no/messages.po rename to view/lang/nb-no/messages.po diff --git a/view/nb-no/strings.php b/view/lang/nb-no/strings.php similarity index 100% rename from view/nb-no/strings.php rename to view/lang/nb-no/strings.php diff --git a/view/nl/messages.po b/view/lang/nl/messages.po similarity index 100% rename from view/nl/messages.po rename to view/lang/nl/messages.po diff --git a/view/nl/strings.php b/view/lang/nl/strings.php similarity index 100% rename from view/nl/strings.php rename to view/lang/nl/strings.php diff --git a/view/pl/messages.po b/view/lang/pl/messages.po similarity index 100% rename from view/pl/messages.po rename to view/lang/pl/messages.po diff --git a/view/pl/strings.php b/view/lang/pl/strings.php similarity index 100% rename from view/pl/strings.php rename to view/lang/pl/strings.php diff --git a/view/pt-br/messages.po b/view/lang/pt-br/messages.po similarity index 100% rename from view/pt-br/messages.po rename to view/lang/pt-br/messages.po diff --git a/view/pt-br/strings.php b/view/lang/pt-br/strings.php similarity index 100% rename from view/pt-br/strings.php rename to view/lang/pt-br/strings.php diff --git a/view/ro/messages.po b/view/lang/ro/messages.po similarity index 100% rename from view/ro/messages.po rename to view/lang/ro/messages.po diff --git a/view/ro/strings.php b/view/lang/ro/strings.php similarity index 100% rename from view/ro/strings.php rename to view/lang/ro/strings.php diff --git a/view/ru/messages.po b/view/lang/ru/messages.po similarity index 100% rename from view/ru/messages.po rename to view/lang/ru/messages.po diff --git a/view/ru/strings.php b/view/lang/ru/strings.php similarity index 100% rename from view/ru/strings.php rename to view/lang/ru/strings.php diff --git a/view/sv/messages.po b/view/lang/sv/messages.po similarity index 100% rename from view/sv/messages.po rename to view/lang/sv/messages.po diff --git a/view/sv/strings.php b/view/lang/sv/strings.php similarity index 100% rename from view/sv/strings.php rename to view/lang/sv/strings.php diff --git a/view/zh-cn/messages.po b/view/lang/zh-cn/messages.po similarity index 100% rename from view/zh-cn/messages.po rename to view/lang/zh-cn/messages.po diff --git a/view/zh-cn/strings.php b/view/lang/zh-cn/strings.php similarity index 100% rename from view/zh-cn/strings.php rename to view/lang/zh-cn/strings.php