Tutorial: how to localize program
Posted: Wed Mar 25, 2015 2:19 pm
To prevent parallel localization to same language, you should anounce your work in this forum as new topic - easy visible to all users.
After your work is finished, please send final LNG file to freedavar@centrum.cz to make your work available for rest of Davar4 users. It will be also included in next release.
When you localize Davar4 to some language, you need to add or edit lng file in folder \language\. Probably best method is to create copy of file english.lng, named according the language you want to localize. For example you will create copy and rename it to magyar.lng.
If you find you language file already presented in \language\ folder, it means that this file is already prepared for localization - strings are mostly in English.
LNG file is normal text file, encoded in UTF-8 without Byte Order Mark (BOM). You need some notepad-like editor, for example Notepad++ (http://notepad-plus-plus.org/) or PsPad (http://www.pspad.com/) - both are free.
Here is begin of English LNG file:
First line:
;EN - English
Program will create label for language abbreviation (EN) and name of language (English) - you must create your language according this example
Second line - use zero:
;0
NOTES:
if line starts with semicolon (;) all text is ignored and YOU SHOULD NOT TRANSLATE TEXT.
One Exception: you should localize name of language, your name and contact email. So, this lines should be updated:
;####################################
;# English localization #
;####################################
;Author: Josef Planeta
;Email: freedavar@centrum.cz
STRINGS TO TRANSLATE:
each string is on one line, has numeric id followed by comma (,) and immediatelly by text. This text should be translated. For example:
1100,&Program
For program menu (as in this example), you will see in some strings ampersand (&) character. This define letter (after ampersand) which is used for menu key abbreviation, in this case character P. You can define your own system of key letters. Remember, if you define two same characters as hotkey for one menu, only one menu command will be working.
In some string, backslash character (\) followed one character (t, n, r, ...) is used, for example:
1104,&Table of characters \tCtrl+T
Here \t combination is converted in Davar to TAB character. When localize, please keep this backslash combinations without change!
After your work is finished, please send final LNG file to freedavar@centrum.cz to make your work available for rest of Davar4 users. It will be also included in next release.
When you localize Davar4 to some language, you need to add or edit lng file in folder \language\. Probably best method is to create copy of file english.lng, named according the language you want to localize. For example you will create copy and rename it to magyar.lng.
If you find you language file already presented in \language\ folder, it means that this file is already prepared for localization - strings are mostly in English.
LNG file is normal text file, encoded in UTF-8 without Byte Order Mark (BOM). You need some notepad-like editor, for example Notepad++ (http://notepad-plus-plus.org/) or PsPad (http://www.pspad.com/) - both are free.
Here is begin of English LNG file:
- Code: Select all
;EN - English
;0
;
;NOTE: First line have format: ';' + 2 letters abbreviation of language +
;space + '-' + space + Name of language
;NOTE: Second line have format: ';' + decadic value of character page
;*****************************************************************************;
; ;
; Davar4 language localization file ;
; ;
; FILE MUST BE UTF-8, Little Endian, without Byte Order Mark ;
; If line starts by ';' or enter (CR+LF) => all line is ignored ;
; ;
; 1) edit ONLY (!) strings after number and comma ',' ;
; 2) Be sure that not enter extra spaces or TAB into text ;
; 3) Be sure that display ΒΆ when edit - to see all spaces in text! ;
; 4) Do not create too long texts, otherwise it will be cropped ;
; 5) The '&' character before a letter represents a hot key ;
; 6) If you cannot translate something, leave it in English. ;
; 7) Thanks folks! Please send translated file to freedavar@centrum.cz ;
;*****************************************************************************;
;####################################
;# English localization #
;####################################
;Author: Josef Planeta
;Email: freedavar@centrum.cz
;************************************;
; MAIN MENU LOCALIZATION ;
;************************************;
1100,&Program
1102,&Show library tree
1103,Top&most window of program
1104,&Table of characters \tCtrl+T
1106,&Information window \tCtrl+I
1108,Library &Manager... \tCtrl+M
1110,&Verse list... \tCtrl+L
1111,&Watch clipboard
1112,&Export...
1113,&Context tooltips \tCtrl+N
First line:
;EN - English
Program will create label for language abbreviation (EN) and name of language (English) - you must create your language according this example
Second line - use zero:
;0
NOTES:
if line starts with semicolon (;) all text is ignored and YOU SHOULD NOT TRANSLATE TEXT.
One Exception: you should localize name of language, your name and contact email. So, this lines should be updated:
;####################################
;# English localization #
;####################################
;Author: Josef Planeta
;Email: freedavar@centrum.cz
STRINGS TO TRANSLATE:
each string is on one line, has numeric id followed by comma (,) and immediatelly by text. This text should be translated. For example:
1100,&Program
For program menu (as in this example), you will see in some strings ampersand (&) character. This define letter (after ampersand) which is used for menu key abbreviation, in this case character P. You can define your own system of key letters. Remember, if you define two same characters as hotkey for one menu, only one menu command will be working.
In some string, backslash character (\) followed one character (t, n, r, ...) is used, for example:
1104,&Table of characters \tCtrl+T
Here \t combination is converted in Davar to TAB character. When localize, please keep this backslash combinations without change!