parent
5a5284b94e
commit
8fc558b8e6
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 {
|
||||
|
|
20
util/README
20
util/README
|
@ -25,19 +25,19 @@ because they don't require extraction.
|
|||
strings.php - a recent run of the strings program. This provides output that
|
||||
is suitable for direct inclusion in the program.
|
||||
|
||||
There are also translatable strings in the various files in the view/en
|
||||
There are also translatable strings in the various files in the view/lang/en
|
||||
directory. By setting $lang = 'something' in .htconfig.php, the application
|
||||
will search for view/something/filename prior to the English version in
|
||||
view/en/filename when loading templates and view files.
|
||||
will search for view/lang/something/filename prior to the English version in
|
||||
view/lang/en/filename when loading templates and view files.
|
||||
|
||||
The translated string table should be placed in view/$lang/strings.php for
|
||||
The translated string table should be placed in view/lang/$lang/strings.php for
|
||||
automatic inclusion.
|
||||
|
||||
You are not restricted to using known languages. You may also use this to
|
||||
translate the software into "pirate", "surfer" or merely to replace certain
|
||||
text which you don't care for.
|
||||
|
||||
Note: The view/en directory contains many HTML template files, some of which
|
||||
Note: The view/lang/en directory contains many HTML template files, some of which
|
||||
only have a few words of English text amongst the HTML. Over time we will move
|
||||
the translation to the replace_macros() function which calls these files and
|
||||
then relocate the files to the view directory. The files in the top-level view
|
||||
|
@ -84,10 +84,10 @@ Xgettext and .po workflow
|
|||
|
||||
$ cd util; ./run_xgettext.sh
|
||||
|
||||
2. copy util/messages.po to view/<langauage>/messages.po
|
||||
2. copy util/messages.po to view/lang/<language>/messages.po
|
||||
Replace <language> with the language you are working on - e.g. 'es', 'fr', 'de', etc.
|
||||
|
||||
3. open view/<langauage>/messages.po with a text editor and fill in infos in
|
||||
3. open view/lang/<language>/messages.po with a text editor and fill in infos in
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language: \n"
|
||||
|
@ -107,17 +107,17 @@ Xgettext and .po workflow
|
|||
of the many .po editors out there, like QtLinguist
|
||||
|
||||
5. run
|
||||
$ php util/po2php.php view/<language>/messages.po
|
||||
$ php util/po2php.php view/lang/<language>/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/<language>/messages.po
|
||||
$ cd util; ./run_xgettext.sh ../view/lang/<language>/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/<language>/strings.php
|
||||
$ php util/php2po.php view/lang/<language>/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.
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue