Page tree

This page describes how to create a VoipNow translation.

Overview

When VoipNow is freshly installed, creating a language pack becomes necessary because at that moment you do not have any of the product's previous language files versions. Translating the English language files into a language of your choice will consume most of your resources and time. The following sections describe in detail the steps that need to be followed when both creating and upgrading a language pack.

How to create a language pack

Several scripts are required when creating a new language pack. Here are the steps that need to be followed:

STEP 1: Log in to your server as root using either SSH from Linux or Putty from Windows.

STEP 2: Check if the files below are located in the /usr/local/voipnow/bin/langutils folder.

  • lpfunctions.php
  • lpmerge.php
  • lpvalidatepack.php
  • lpverkeydiff.php
  • lpreplicate.php

STEP 3: Outside the VoipNow structure, create a special directory for your work and execute the translations steps. For example:

cd /usr/local/voipnow/bin/langutils

mkdir translation

cd translation

STEP 4: To replicate the language folder used by VoipNow and its APIs, execute the following command from your working directory.
php /usr/local/voipnow/bin/langutils/lpreplicate.php <the_language_code_you_want_to_translate>
The script will ask you to provide the language you would like to replicate from the default en. For example, if you wish to replicate German using the 1996 orthography, then you have to provide the de-DE-1996 language code. The output resulted after running the lpreplicate.php script can be found in the current directory. For the above example, you will see the language_packs/de-DE-1996 folder.

cd /usr/local/voipnow/bin/langutils/translation

php /usr/local/voipnow/bin/langutils/lpreplicate.php de-DE-1996

The following message will be displayed in the console:
You can get the language files from here: /usr/local/voipnow/bin/langutils/translation/language_packs/de-DE-1996
STEP 5: Translate the files created during the previous steps. The path is this:
/usr/local/voipnow/bin/langutils/translation/language_packs/<LANGUAGE_CODE>/language/<LANGUAGE_CODE>/

Do not forgot the translation rules described in this section! All the keys from all the files must be translated. See the folder structure here.
Do not move the keys from one file to another! Translate each file keeping the directory structure generated in the /usr/local/voipnow/bin/langutils/translation/language_packs/<LANGUAGE_CODE>/language/<LANGUAGE_CODE>/ folder.

The files you should translate can be found, in our example, in the following folder:

/usr/local/voipnow/bin/langutils/translation/language_packs/de-DE-1996/language/de-DE-1996
STEP 6: Validate your translation. To do so, use the /local/voipnow/bin/langutils/lpvalidatepack.php script:
php /usr/local/voipnow/bin/langutils/lpvalidatepack.php -r <path_to_lp_version_in_English> -t <path_to_translated_structure>
An interactive menu will ask you for some supplementary information:
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).
Copy the translated files in your working directory. In our example, we assume your translation is in:
cp -r /usr/local/voipnow/bin/langutils/translation/language_packs/de-DE-1996/language /usr/local/voipnow/bin/langutils/translation/de-DE-1996
Copy the en language pack to the /path/to/working/dir/ folder using the following command:
cp -r /usr/local/voipnow/admin/htdocs/language/en /usr/local/voipnow/bin/langutils/translation/en
Validate your translation using the lpvalidatepack.php script. Type:
php /usr/local/voipnow/bin/langutils/lpvalidatepack.php -r /usr/local/voipnow/bin/langutils/translation/en/ -t /usr/local/voipnow/bin/langutils/translation/de-DE-1996/
The following message will be displayed in the console:

Please enter the ISO language code you want to create the language pack for (e.g. en): de-DE-1996

Please enter the language name for de-DE-1996 (e.g. English): German

For which 4PSA VoipNow version is this language pack (e.g. 3.0.0): 3.0.0

STEP 7: Fix the errors, if necessary. When executing the previous step, some errors might occur. For more information, please see the Possible Errors section below.

Possible Errors

This section deals with the errors that might occur when validating the translation and offers a resolution for each one of them.

#1 Error: Some keys might be left untranslated.

In this case, the answer is:

Please check the file language/de-DE-1996/api/soap/common.php in order to see what language pack keys have not been translated. The validation process has failed.
Here are the steps that you need to follow:

STEP 1: Edit the file where the problem was reported and search for the //NOT-TRANSLATED text. In our example, the file is located at /usr/local/voipnow/bin/langutils/translation/language/de-DE-1996/interface.php. These are the keys that you forgot to translate.

Not all keys marked with //NOT-TRANSLATED can or should be translated!

For example, the following keys must NOT be translated:

$msg_arr['soap2_err_302'|'soap2_err_302'] = '{invalid_password}';//NOT-TRANSLATED
$msg_arr['soap2_err_505'|'soap2_err_505'] = '{parent_limitations}';//NOT-TRANSLATED

Some keys cannot be translated into your language:

$msg_arr['btn_ok'|'btn_ok'] = 'Ok';//NOT-TRANSLATED
$msg_arr['it_app_rxfax'|'it_app_rxfax'] = 'Fax';//NOT-TRANSLATED

Or maybe you simply forgot to translate some keys:

$msg_arr['btn_enable_client_off'|'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!

Your translation files are in our example located in: /usr/local/voipnow/bin/langutils/translation/de-DE-1996/
The files containing translation errors are located in: /usr/local/voipnow/bin/langutils/translation/language/de-DE-1996/

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/de-DE-1996/). Once all these lines have been 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:

cd /usr/local/voipnow/bin/langutils/translation

cp -r language/de-DE-1996/ de-DE-1996/

STEP 3: Run the lpvalidatepack.php script 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, lpvalidatepack.php will return the same message //NOT-TRANSLATED every time.
After making sure that all the keys that can be translated are in order, use the lpvalidatepack.php script with -f, as in the example below:
php /usr/local/voipnow/bin/langutils/lpvalidatepack.php -r /usr/local/voipnow/bin/langutils/translation/en/ -t /usr/local/voipnow/bin/langutils/translation/language/de-DE-1996/ -f

#2 Error: Some keys might be missing from the translation files.

In this case, the answer is:

FAILURE. Please check the file language/de-DE-1996/interface.php in order to see which keys have not been found in your translated language pack. The validation process has failed.
Here 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/de-DE-1996/interface.php. These are the supplementary keys that you must translate and include in your language pack.

Pay attention to the reported file! Your translation files are in our example located in:

/usr/local/voipnow/bin/langutils/translation/de-DE-1996/

The files containing translation errors are located in:

/usr/local/voipnow/bin/langutils/translation/language/de-DE-1996/

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/de-DE-1996/).
As soon as all the missing lines have been translated, you must replace the folder containing differences with the repaired one. To do so, please type:

cd /usr/local/voipnow/bin/langutils/translation

cp -r language/de-DE-1996/ de-DE-1996/

STEP 3: Run the lpvalidatepack.php script to verify your translation.
php /usr/local/voipnow/bin/langutils/lpvalidatepack.php -r /usr/local/voipnow/bin/langutils/translation/en/ -t /usr/local/voipnow/bin/langutils/translation/de-DE-1996/

Pay attention to the errors received!

#3 Error: There are PHP errors in your translation files.

In this case, the answer is:

Fatal error: You have a missing ' in file /usr/local/voipnow/bin/langutils/translation/language/de-DE-1996/common.php that has content $msg_arr['java_options_max_sip_invalid'] = 'The 'Maximum number of phone extensions ' value must be a number. (e.g. 40)';
Here are the steps that you need to follow:

STEP 1: Edit the file where the problem was reported and search for the reported key, $msg_arr['java_options_max_sip_invalid']. In our example, the file is located at

/usr/local/voipnow/bin/langutils/translation/de-DE-1996/common.php
In the given example, a \ is missing. The message that triggered the error 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 lpvalidatepack.php script again to verify your translation. When there are no PHP errors left and no untranslated keys, a confirmation message will be displayed.

The validation process has ended successfully. You can take the tar archive from /usr/local/voipnow/bin/langutils/translation/voipnow300_German.tar.gz. Congratulations!

#trackbackRdf ($trackbackUtils.getContentIdentifier($page) $page.title $trackbackUtils.getPingUrl($page))

Except where otherwise noted, content in this space is licensed under a Creative Commons Attribution 4.0 International.