User Tools

Site Tools


translate_mail2voice

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
translate_mail2voice [2015/04/23 12:18] – [Widgets] mhatztranslate_mail2voice [2023/04/25 16:52] (current) – external edit 127.0.0.1
Line 3: Line 3:
 ===== Generalities ===== ===== Generalities =====
  
-In Mail2Voice, the translation is made with XML files (named with the .lng extension). All locales files are in the locales folder.+Mail2Voice native language is englishthus if no locale file exists, it will display in english. 
 + 
 +The translation is made with locale files (using XML code). All locales files are in the locales folder and are named with the .lng extension. The reference file is english.lng so each locale file must translate every words/sentences that are in this reference file. 
 + 
 +You must not modify the reference file (english.lng) directly (but it's OK for the others). If you want to modify the english translations, you will have to modify the source code of Mail2Voice and then follow the instructions from the next sections to generate the new english.lng file.
  
 In a .lng file, there are two types of translations: the widgets labels and the vocal messages. The widgets labels are grouped by panel whereas all vocal messages are grouped in the "voiceSentences" section. In a .lng file, there are two types of translations: the widgets labels and the vocal messages. The widgets labels are grouped by panel whereas all vocal messages are grouped in the "voiceSentences" section.
 +
 +The translatable strings are the ones in the "value" tags and you must not change any other tags.
  
 //Note: the translations are sorted alphabetically in each section.// //Note: the translations are sorted alphabetically in each section.//
  
-===== Link the code to the translation =====+===== Write translatable strings in  the code ===== 
 + 
 +The reference locale file (english.lng) must be generated when the source code of Mail2Voice is modified. This file is generated from the translatable strings found in the source code. We are taking into account two types of translatable strings: the widgets texts and the voice sentences.
  
 ==== Widgets ==== ==== Widgets ====
  
-For Widgets, Mail2Voice is capable of translating the Text and TextHeader properties of any widget. So, when translating, it looks in the .lng file and translate these properties for each "setting" entry (except for the "vocalSentences" section of course).+For Widgets, Mail2Voice is capable of translating the Text and TextHeader properties of any widget. So, when translating, it looks in the .lng file and translates these properties for each "setting" entry (except for the "vocalSentences" section of course).
  
 There are two rules:  There are two rules: 
Line 20: Line 28:
  
     this.mailtoContactButton.Name = "mailtoContactButton";     this.mailtoContactButton.Name = "mailtoContactButton";
 +    
 +Then you can add a Text or a TextHeader property to your widget:
 +
 +    this.mailtoContactButton.Text = "Write";
 +
 +    
 +When the reference locale file is generated, you will see a line like this in the english.lng file:
 +    
 +    <setting name="mailtoContactButton" value="Write" />
 +
          
 ==== Vocal messages ==== ==== Vocal messages ====
  
-Vocal messages work differently. In your code, you must register vocal messages like this: +Vocal messages work differently. First, unlike widgets, these messages must be created in *.cs files. 
 + 
 +Then, in your code, you must register vocal messages like this: 
     SpeechObject.Singleton.AddVoiceString("emailAddError", "You must specify an email to add this contact.");     SpeechObject.Singleton.AddVoiceString("emailAddError", "You must specify an email to add this contact.");
          
 The first parameter is the identifier of the string which will be used in the .lng file. The first parameter is the identifier of the string which will be used in the .lng file.
  
-Unlike widgetsthese messages must be created in *.cs files.+When the reference locale file is generatedyou will see a line like this in the voiceSentences section of the english.lng file: 
 +    <setting name="emailAddError" value="You must specify an email to add this contact." />
  
-===== Update translations =====+===== Generate the reference locale file =====
  
-To update locales files, you must : +To generate/update the reference locale file, you must : 
-  - generate the default file (default.lng), +  - in Mail2Voice root folder, open Git Bash : right click > Git Bash, 
-    - in Mail2Voice root folder, open Git Bash : right click > Git Bash, +  - type: utils/generate_locale_file.sh 
-    - type: utils/generate_locale_file.sh +  - check for the default.lng file in the locales folder.
-    - check for the default.lng file in the locales folder.+
   - replace the english.lng file with the default.lng file,   - replace the english.lng file with the default.lng file,
 +
 +===== Update translations =====
 +  - make sure you have generated the latest reference locale file.
   - merge changes between the new english.lng and the other locales files and translate the new strings.   - merge changes between the new english.lng and the other locales files and translate the new strings.
  
translate_mail2voice.1429791494.txt.gz · Last modified: 2023/04/25 16:52 (external edit)