translate_mail2voice
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
translate_mail2voice [2015/04/23 12:18] – [Widgets] mhatz | translate_mail2voice [2023/04/25 16:52] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 3: | Line 3: | ||
===== Generalities ===== | ===== Generalities ===== | ||
- | In Mail2Voice, | + | Mail2Voice |
+ | |||
+ | The translation is made with locale | ||
+ | |||
+ | 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, | ||
In a .lng file, there are two types of translations: | In a .lng file, there are two types of translations: | ||
+ | |||
+ | The translatable strings are the ones in the " | ||
//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 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, | + | For Widgets, Mail2Voice is capable of translating the Text and TextHeader properties of any widget. So, when translating, |
There are two rules: | There are two rules: | ||
- Every translatable widget must be created in *.Designer.cs files. | - Every translatable widget must be created in *.Designer.cs files. | ||
- in your code, you must use the widget name as the widget variable identifier, like this: | - in your code, you must use the widget name as the widget variable identifier, like this: | ||
+ | |||
this.mailtoContactButton.Name = " | this.mailtoContactButton.Name = " | ||
+ | | ||
+ | Then you can add a Text or a TextHeader property to your widget: | ||
+ | |||
+ | this.mailtoContactButton.Text = " | ||
+ | |||
+ | | ||
+ | When the reference locale file is generated, you will see a line like this in the english.lng file: | ||
+ | | ||
+ | <setting name=" | ||
+ | |||
| | ||
==== Vocal messages ==== | ==== Vocal messages ==== | ||
- | Vocal messages work differently. | + | Vocal messages work differently. |
+ | |||
+ | Then, in your code, you must register vocal messages like this: | ||
SpeechObject.Singleton.AddVoiceString(" | SpeechObject.Singleton.AddVoiceString(" | ||
| | ||
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 widgets, these messages must be created | + | When the reference locale file is generated, you will see a line like this in the voiceSentences section of the english.lng file: |
+ | <setting name=" | ||
- | ===== Update translations | + | ===== Generate the reference locale file ===== |
- | To update | + | To generate/update |
- | | + | - in Mail2Voice root folder, open Git Bash : right click > Git Bash, |
- | | + | - type: utils/ |
- | - type: utils/ | + | - 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.1429791482.txt.gz · Last modified: 2023/04/25 16:52 (external edit)