Overview
After you translated all the language keys generated during the previous step, you should merge the old translation with the new one.
How to Do It
Please follow the steps below:
STEP 1: Copy the translated structure to your working directory.
cd /usr/local/voipnow/bin/langutils/translation
cp -r /usr/local/voipnow/bin/langutils/translation/language_diff_folder/language/en /usr/local/voipnow/bin/langutils/translation/diff_oldVersion_newVersion_languageCode
lpmerge.php
script using the following command:php /usr/local/voipnow/bin/langutils/lpmerge.php -o <old_translation> -n <new_translation> -r <reference_lp> -f
-o <old_translation> - The file or directory structure containing the old language pack translated in the desired language.
-n <new_translation> - The file or directory structure containing the differences between the old and the new language packs, translated in the desired language.
-r <reference_lp> - The file or the directory structure containing the language pack for the reference version, usually the latest version available for English.
-f - This flag is optional and should be used to skip checking for untranslated keys.
The ISO language code of the language chosen for translation.
The name of the translated language.
The VoipNow version the translation was made for (e.g. 3.0.0).
/usr/local/voipnow/bin/langutils/translation
and it is named diff_253_300_es
, the following commands must be run:cd /usr/local/voipnow/bin/langutils/translation
/usr/local/httpsa/php53/php/php /usr/local/voipnow/bin/langutils/lpmerge.php -o /usr/local/voipnow/bin/langutils/translation/253es -n /usr/local/voipnow/bin/langutils/translation/diff_253_300_es -r /usr/local/voipnow/bin/langutils/translation/en
Please enter the ISO language code you want to create the language pack for (eg: en): es-ES
Please enter the language name for es-ES (e.g. English): Spanish
For which 4PSA VoipNow version is this language pack (e.g. 3.0.0): 3.0.0
The validation process has ended successfully.
You can take the tar archive from /usr/local/voipnow/bin/langutils/translation/voipnow300_Spanish.tar.gz. Congratulations!
Possible Errors
This section deals with the errors that might occur when validating the translation and offers a resolution for each one of them.
Error: Some keys might be left untranslated
In this case, the answer is:
Please check the file language/es-ES/api/soap/common.php in order to see what language pack keys have not been translated.
The validation process has failed.
STEP 1: Edit the file where the problem was reported and search for the //NOT-TRANSLATED text. In our example, the file detected with keys not translated is located at language/es-ES/api/soap/common.php
.
There are 3 possible cases that are marked with //NOT-TRANSLATED flag:
There are keys that must NOT be translated as they represent tags that will be replaced in code:
$msg_arr['soap2_err_302'] = '{invalid_password}';//NOT-TRANSLATED $msg_arr['soap2_err_505'] = '{parent_limitations}';//NOT-TRANSLATED
There are keys do not require translation into your language:
$msg_arr['btn_ok'] = 'Ok';//NOT-TRANSLATED $msg_arr['it_app_rxfax'] = 'Fax';//NOT-TRANSLATED
There are keys that need to be translated, but you forgot to translate them:
$msg_arr['btn_enable_client_off'] = 'This client cannot be enabled because the reseller owning the account is disabled';//NOT-TRANSLATED
Pay attention to the reported file!
/usr/local/voipnow/bin/langutils/translation/diff_253_300_es
or in /usr/local/voipnow/bin/langutils/translation/253es
. The files containing translation errors are located in: /usr/local/voipnow/bin/langutils/translation/language/es-ES
/
STEP 2: Translate all the keys that you missed. You can translate the lines marked with //NOT-TRANSLATED in the folder where the errors were reported (in our example /usr/local/voipnow/bin/langutils/translation/language/
). After having all these lines translated, you must replace the existing language folder with the folder containing the files with all the keys in order. To do so, please type:
/es-ES
lpmerge.php
script as described in How to Do It again to verify your translation. For the lines that must not be translated or for those words that have the same spelling as in English, lpmerge.php
will exit with error. If you are confident that all the keys that can be translated are in order, use the lpmerge.php
script with -f
(force) in order to generate the language archive. Example:Error: Some keys might be missing from the translation files
You will receive this error when the lpvalidatepack.php
returns:
FAILURE. Please check the file language/es-ES/interface.php in order to see which keys have not been found in your translated language pack. The validation process has failed.
Below are the steps that you need to follow:
STEP 1: Edit the file where the problem was reported and search for the //NEW-KEY text. In our example, the file is located at language/es-ES/interface.php
. These are neither in the old language pack (204br
in our example), nor in the difference files ( diff_253_300_es
in our example). All keys marked with //NEW-KEY should be translated and included in the difference language pack.
STEP 2: Translate all the marked keys that you missed from all the reported files. You can translate the lines marked with //NEW-KEY in the folder where the errors were reported (in our example /usr/local/voipnow/bin/langutils/translation/language/es-ES/).
After having all the missing lines translated, you must replace the folder containing the differences with the repaired one. To do so, please type:
lpvalidatepack.php
script as described in How to Do ItError: There are PHP errors in your translation files
You will receive this error when the lpvalidatepack.php
returns:
/usr/local/voipnow/bin/langutils/translation/diff_253_300_es/common.php
. In the given example, a \ is missing. The incorrect line is:$msg_arr['java_options_max_sip_invalid'] = 'The 'Maximum number of phone extensions\' value must be a number.(e.g. 40)';
and it should be:
$msg_arr['java_options_max_sip_invalid'] = 'The \'Maximum number of phone extensions\' value must be a number.(e.g. 40)';
STEP 2: After fixing the error, run the lpmerge.php
script as described in How to Do It:
php /usr/local/voipnow/bin/langutils/lpmerge.php \
-o /usr/local/voipnow/bin/langutils/translation/253es \
-n /usr/local/voipnow/bin/langutils/translation/diff_253_300_es \
-r /usr/local/voipnow/bin/langutils/translation/en
Except where otherwise noted, content in this space is licensed under a Creative Commons Attribution 4.0 International.