Wiki > Main > LangFiles (compare)
Difference: LangFiles (r57 vs. r56)
Copy the english.lang to [your language].lang and change all strings within the <dest> and <voice> tags.
First of all, you need to speak the language you're translating to fluently. This cannot be stressed enough. You should either be a native speaker, or having spoken the language daily for years. High-school classes are not enough. Machine translations are completely unacceptable.
To avoid manual (and error-prone) diffing, copy and pasting and so on, use the script called genlang with its -u option.
Note: If you don't have or want a build environment, it should be possible to download the script to your pc and do it all without the build environment. Get a perl interpreter if you don't already have one, for example ActivePerl.
So be sure you can start the genlang script either way, or opt for the hard way by doing it all yourself.
The translation is always done "from" English, so english.lang is the master file. Monitor this file if you want to be sure to keep "your" language up to date.
The only one step of preparation you have to do every time you want to update "your" language is to run that script:
Bring yourself to the
../../tools/genlang -u -e=english.lang yourlang.lang > yournewlang.lang
This assumes you are working "from" English, as usual, your outdated language file is called yourlang.lang and you want to get the merge to newyourlang.lang.
Now that genlang has merged the new changes from English to newyourlang.lang, you can go ahead with the actual work of translation, by opening the file in your favorite text editor. The new file has added comments starting with ### marking where you (might) need to edit the file.
I'm afraid we have to look into the format of lang files now. Every string needed in RockBox has a voice clip, this is why we can call such a pair a "phrase". Every phrase has absolutely unique identifier (called
When updating a language, you are asked to solely change the
Comments start with the hash-sign ('#', also called hash (UK) or pound (US) key in English; 'Raute', 'Viereckchen', 'Lattenkreuz' in German; or 'Kanalgitterchen' in Austrian. No joke, but funny )
Lang files must be saved with UTF-8 encoding.
As of April 4 2006, we've converted to a new language file format and system. We now allow different strings for different targets, and you can now make sure that the string is correctly saying things for each model. All phrases have a default string like:
The target names used for this are picked from the configure script and are set in the MODELNAME variable in the root Makefile. Currently, they are:
Mainly said, any resource that needs attention has a '###'-comment. I will now list the 'scenarios' I know and how I think they have to be handled.
If a string is not needed anymore, it's not allowed to delete it in the master file. Therefore, they are marked by writing
A deprecated string is not needed anymore.
A deprecated string should be written as the following in the lang file. This example snippet deprecates the destination string for all targets:
<phrase> id: LANG_FOO desc: DEPRECATED <source> *: "" </source> <dest> *: deprecated </dest> <voice> *: "" </voice> </phrase>
If a new string has been found in english.lang,
### ### This phrase below was not present in the translated file <phrase> id: LANG_STEREO_WIDTH desc: in sound_settings <source> *: "Stereo width" </source> <dest> *: "Stereo width" </dest> <voice> *: "Stereo width" </voice> </phrase>
The lang format allows you to completely remove a string for a particular target's language file by using the
<dest> *: "fancy LCD bitmap rotation enabled" player: none </dest>
Note however that this completely removes the string from the output and thus it may very well break backwards compatibility when you do this. Carefully consider deprecating the string instead.
The translation should feel as correct as possible to speakers/readers of your native language you're translating this to. This means that you should follow the rules of the language you're translating to, and not try to imitate the English version. For example with capitals, you should not capitalize anything other than what would be done if you were writing the text from scratch. Also try as much as possible to avoid using English words, as tempting as it may be, unless it's very commonly known and in daily use in your language (and not just among tech-interested people).
Your main work is done if you can't find any '###'-comment anymore :-)
Note: strings are always "within double quotes", even the empty ones
Just for safety, I do a few checks. I use a file differ (BeyondCompare, will be available for linux too in a while) for this.
r57 - 30 May 2012 - 21:05:32 - DominikRiebelingRevision r57 - 30 May 2012 - 21:05 - DominikRiebeling
Revision r56 - 20 May 2012 - 09:33 - DominikRiebeling
Copyright © by the contributing authors.