Actions

Translating LimeSurvey: Difference between revisions

From LimeSurvey Manual

No edit summary
No edit summary
(17 intermediate revisions by 5 users not shown)
Line 6: Line 6:


<!--T:3-->
<!--T:3-->
Wouldn't it be great to have LimeSurvey completely translated to your mother-language? The LimeSurvey team is always on the look-out for new translations and for people who help to update the existing ones. Please read these instructions and don't hesitate to send an email to [mailto:translations@limesurvey.org translations@limesurvey.org] if you are in doubt or have any other questions.
Wouldn't it be great to have LimeSurvey completely translated to your native language? The LimeSurvey team is always on the lookout for new translations and for people who help update the existing ones. Please read these instructions and don't hesitate to send an email to [mailto:translations@limesurvey.org translations@limesurvey.org] if you are in doubt or have any other questions.


=How to translate - step-by-step instructions= <!--T:4-->
=How to translate - step-by-step instructions= <!--T:4-->
Line 12: Line 12:
==Updating an existing translation== <!--T:5-->
==Updating an existing translation== <!--T:5-->
#Sign up on [https://www.limesurvey.org the LimeSurvey website] and then log in to [https://www.limesurvey.org/login your account].
#Sign up on [https://www.limesurvey.org the LimeSurvey website] and then log in to [https://www.limesurvey.org/login your account].
#Go to [https://translate.limesurvey.org https://translate.limesurvey.org] and log in there with the same user name and password.
#Go to [https://translate.limesurvey.org https://translate.limesurvey.org] and log in there with the same username and password.
#Pick the LimeSurvey version you want to translate for and start translating. After your translation was approved, it will automatically be released in the weekly stable release and your user name will be credited in the change log.
#Pick the LimeSurvey version you want to translate and simply get started. After your translation is approved, it will automatically be included in the weekly stable release and your username will be credited in the change log.
#If you are interested to become a prime translator for your language with the ability to approve newly translated strings, please contact us at [mailto:translations@limesurvey.org translations@limsurvey.org]. Such a position requires a maximum of about an hour of work per week - important to us is that you are reliable doing this.
#If you are interested in becoming a prime translator for your language with the ability to approve newly translated strings, please contact us at [mailto:translations@limesurvey.org translations@limsurvey.org]. Such a position requires a maximum of about an hour of work per week - it's important to us that you are reliable in doing this.
 
===Other part to be translated=== <!--T:12-->
 
<!--T:13-->
LimeSurvey use external library, and this library have their own translation system. Current library used are


==Customize an existing translation== <!--T:6-->
==Customize an existing translation== <!--T:6-->


<!--T:7-->
<!--T:7-->
Sometimes you want to modify an existing translation so it accommodates your particular survey situation better. In that case, do the following:
Sometimes you might want to modify an existing translation so it accommodates your particular survey situation better. In that case, do the following:
#Go to [https://translate.limesurvey.org https://translate.limesurvey.org], pick the LimeSurvey version you want to translate for and the particular language you want to modify.
#Go to [https://translate.limesurvey.org https://translate.limesurvey.org], pick the LimeSurvey version you want to translate and the particular language you want to modify.
#On the bottom of the translation page you will find an option to export all strings as *.po file. Do that and save it as *.po file to your local hard-disk:<br />[[File:export_po_file.png]]
#On the bottom of the translation page you will find an option to export all strings as *.po file. Click on the export and save it as *.po file to your local hard-disk:<br />[[File:export_po_file.png]]
#Download and install [http://www.poedit.net/download.php Poedit].
#Download and install [http://www.poedit.net/download.php Poedit].
#Start Poedit and edit the downloaded *.po file - modify the particular translations.
#Start Poedit and edit the downloaded *.po file - modify the particular translations.
#When you save the *.po file, a *.mo file is automatically created. That is the one LimeSurvey will read from.
#When you save the *.po file, a *.mo file is automatically created. The latter will be read by LimeSurvey.
#The last step is to place the particular *.mo file in the right language folder in /locale by replacing the existing one.
#The last step is to place the particular *.mo file in the right language folder in /locale by replacing the existing one.
{{Note|For example, the location for French would be <LimeSurvey_root_directory>/locale/fr/LC_MESSAGES/fr.po.}}
{{Note|For example, the location for French would be <LimeSurvey_root_directory>/locale/fr/LC_MESSAGES/fr.po.}}


<!--T:8-->
<!--T:8-->
<div class="simplebox"> Note: If you are using [https://www.limesurvey.org/editions-and-prices/limesurvey-pro/editions-and-prices-professional LimeSurvey Pro], the team will be happy to place the file for you. Just create a [mailto:support@limesurvey.org support ticket] and attach the *.po file (<u>'''not''' the .*mo</u>).</div>
<div class="simplebox"> Note: If you are using [https://www.limesurvey.org/editions-and-prices/limesurvey-pro/editions-and-prices-professional LimeSurvey Pro](only for Cooperate and Enterprise users), the team will be happy to place the file for you. Just create a [mailto:support@limesurvey.org support ticket] and attach the *.po file (<u>'''not''' the .*mo</u>).</div>


==Creating a new translation== <!--T:9-->
==Creating a new translation== <!--T:9-->
#First of all, get access to the development version of LimeSurvey. For detailed instructions, access the following page: [[Accessing the source code]].
#First of all, get access to the development version of LimeSurvey. For detailed instructions, access the [[Accessing the source code|source code]].
#Download and install [https://www.poedit.net/download.php Poedit] .
#Download and install [https://www.poedit.net/download.php Poedit] .
#Now you have to find out the language-code for your language - you can search for your language-code in the [https://r12a.github.io/app-subtags/ IANA Language Subtag Registry].
#Now you have to find out the language-code for your language - you can search for your language-code in the [https://r12a.github.io/app-subtags/ IANA Language Subtag Registry].
#Go to the /locale directory (located in the LimeSurvey root directory) and create a directory named after your language code.
#Go into the /locale directory (located in the LimeSurvey root directory) and create a directory named after your language code.
#Download your language template by clicking on the following link [https://www.limesurvey.org/limesurvey.pot https://www.limesurvey.org/limesurvey.pot]. Once you receive the language template file, rename it to <your_language_code>.po.  
#Download your language template by going to on the following link [https://translate.limesurvey.org/projects/]. Select the project, then any language (e.g. go for the English entry), and scroll to the bottom. There you have the possibility to export the language file as <your_language_code>.po file.
#Copy the <your_language_code>.po file to the newly created folder located in the /locale directory.
#Copy the <your_language_code>.po file to the newly created folder located in the /locale directory.
#Open the file with Poedit and translate everything you need to translate.
#Open the file with Poedit and translate everything you need to translate.
#To make LimeSurvey know about your language, you must add it to the file application/helpers/surveytranslator_helper.php (located in the LimeSurvey root directory). Open that file with a text editor and add your language in the same way the other languages in that file are defined.
#To make LimeSurvey know about your language, you must add it in application/helpers/surveytranslator_helper.php (located in the LimeSurvey root directory). Open that file with a text editor and add your language in the same way the other languages are defined in that file.
#Save - in order to allow LimeSurvey to see the newly added language, save the modified *.po file. This will automatically generate in the same folder the *.mo file, which will be read by LimeSurvey.  
#Save - in order to allow LimeSurvey to see the newly added language, save the modified *.po file. This will automatically generate the *.mo file in the same folder, which will be read by LimeSurvey.  
#Send the new *.po file and the updated surveytranslator_helper.php file to [mailto:translations@limesurvey.org translations@limesurvey.org].  
#Send the new *.po file and the updated surveytranslator_helper.php file to [mailto:translations@limesurvey.org translations@limesurvey.org].  


{{Note|If you want your name to be linked from/shown on the team page, please write so in the e-mail!}}
<!--T:11-->
{{Note|If your language use a lot of special character : please check what font must be used for pdf generation (check with dejavusans for example). Then we can add this font file in [[Optional_settings#Statistics_and_response_browsing|alternatepdffontfile]] default configuration.}}
 
<!--T:10-->
{{Note|If you want your name to be linked from/shown on the team page, please write so in the email!}}
 
=== Sample code for add a new language === <!--T:15-->
 
<!--T:16-->
<syntaxhighlight lang="php">
    $supportedLanguages['code']['description'] = gT('Language');
    $supportedLanguages['code']['nativedescription'] = 'Language in native';
    $supportedLanguages['code']['rtl'] = (true|false); // RTL
    $supportedLanguages['code']['dateformat'] = integer; // See getDateFormatData function
    $supportedLanguages['code']['radixpoint'] = (0|1); // 0 : ., 1 : , for radix point
    $supportedLanguages['code']['cldr'] = 'code';
    $supportedLanguages['code']['momentjs'] = 'code'; // Used by moment.js
</syntaxhighlight>
 
 
=== Other part to be translated === <!--T:17-->
 
<!--T:18-->
* LimeSurvey use [https://momentjs.com/ moment.js]. When you send the message to [mailto:translations@limesurvey.org translations@limesurvey.org] check what language code must be used.
 
<!--T:14-->
* '''[https://momentjs.com/ moment.js]''' : method to contribute to moment.js translation are explained at [https://momentjs.com/docs/#/i18n moment.js documentation].


</translate>
</translate>

Revision as of 15:43, 1 July 2020

Translating LimeSurvey

Wouldn't it be great to have LimeSurvey completely translated to your native language? The LimeSurvey team is always on the lookout for new translations and for people who help update the existing ones. Please read these instructions and don't hesitate to send an email to translations@limesurvey.org if you are in doubt or have any other questions.

How to translate - step-by-step instructions

Updating an existing translation

  1. Sign up on the LimeSurvey website and then log in to your account.
  2. Go to https://translate.limesurvey.org and log in there with the same username and password.
  3. Pick the LimeSurvey version you want to translate and simply get started. After your translation is approved, it will automatically be included in the weekly stable release and your username will be credited in the change log.
  4. If you are interested in becoming a prime translator for your language with the ability to approve newly translated strings, please contact us at translations@limsurvey.org. Such a position requires a maximum of about an hour of work per week - it's important to us that you are reliable in doing this.

Other part to be translated

LimeSurvey use external library, and this library have their own translation system. Current library used are

Customize an existing translation

Sometimes you might want to modify an existing translation so it accommodates your particular survey situation better. In that case, do the following:

  1. Go to https://translate.limesurvey.org, pick the LimeSurvey version you want to translate and the particular language you want to modify.
  2. On the bottom of the translation page you will find an option to export all strings as *.po file. Click on the export and save it as *.po file to your local hard-disk:
  3. Download and install Poedit.
  4. Start Poedit and edit the downloaded *.po file - modify the particular translations.
  5. When you save the *.po file, a *.mo file is automatically created. The latter will be read by LimeSurvey.
  6. The last step is to place the particular *.mo file in the right language folder in /locale by replacing the existing one.
For example, the location for French would be <LimeSurvey_root_directory>/locale/fr/LC_MESSAGES/fr.po.
Note: If you are using LimeSurvey Pro(only for Cooperate and Enterprise users), the team will be happy to place the file for you. Just create a support ticket and attach the *.po file (not the .*mo).

Creating a new translation

  1. First of all, get access to the development version of LimeSurvey. For detailed instructions, access the source code.
  2. Download and install Poedit .
  3. Now you have to find out the language-code for your language - you can search for your language-code in the IANA Language Subtag Registry.
  4. Go into the /locale directory (located in the LimeSurvey root directory) and create a directory named after your language code.
  5. Download your language template by going to on the following link [1]. Select the project, then any language (e.g. go for the English entry), and scroll to the bottom. There you have the possibility to export the language file as <your_language_code>.po file.
  6. Copy the <your_language_code>.po file to the newly created folder located in the /locale directory.
  7. Open the file with Poedit and translate everything you need to translate.
  8. To make LimeSurvey know about your language, you must add it in application/helpers/surveytranslator_helper.php (located in the LimeSurvey root directory). Open that file with a text editor and add your language in the same way the other languages are defined in that file.
  9. Save - in order to allow LimeSurvey to see the newly added language, save the modified *.po file. This will automatically generate the *.mo file in the same folder, which will be read by LimeSurvey.
  10. Send the new *.po file and the updated surveytranslator_helper.php file to translations@limesurvey.org.
If your language use a lot of special character : please check what font must be used for pdf generation (check with dejavusans for example). Then we can add this font file in alternatepdffontfile default configuration.
If you want your name to be linked from/shown on the team page, please write so in the email!

Sample code for add a new language

    $supportedLanguages['code']['description'] = gT('Language');
    $supportedLanguages['code']['nativedescription'] = 'Language in native';
    $supportedLanguages['code']['rtl'] = (true|false); // RTL 
    $supportedLanguages['code']['dateformat'] = integer; // See getDateFormatData function
    $supportedLanguages['code']['radixpoint'] = (0|1); // 0 : ., 1 : , for radix point
    $supportedLanguages['code']['cldr'] = 'code';
    $supportedLanguages['code']['momentjs'] = 'code'; // Used by moment.js


Other part to be translated