release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide
translations



Search | Go
Wiki > Main > DocsIndex > LangFiles

Lang Files Explained

Creating new languages

Copy english.lang to [your language].lang and use your favorite text editor to change all strings within the <dest> and <voice> tags.

There are over 1000 unique strings, so this will take some time!

Note the file must be saved in UTF-8 formated plain text file.

Prerequisites to be able to translate

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.

If you are merely updating an existing translation, we strongly recommend using the translation website, but if you still wish to do this by hand, you will need the updatelang script out of the rockbox source code. This requires a functional perl environment.

Preparation every time you update

The translation is always done "from" English (UK), so https://git.rockbox.org/cgit/rockbox.git/plain/apps/lang/english.lang is the master file. If you want to be sure to keep "your" language up to date, you will need to monitor changes to this file. This can also be accomplished using the translation website mentioned above. If you wish to be automatically notified every time a translation needs to be updated, contact the admins.

The only one step of preparation you have to do every time you want to update "your" language is to run the updatelang script:

Bring yourself to the /apps/lang/ directory (or to the directory where english.lang and yourlang.lang reside if you work without build environment). Don't forget to update to the latest verison of both files!). Run updatelang like the following line:

 ../../tools/updatelang english.lang yourlang.lang yournewlang.lang

This assumes you are working "from" English, as usual, your outdated language file is called yourlang.lang and the output will be saved as newyourlang.lang.

Now that updatelang 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 will need to edit the file.

The lang file format

Every string needed in RockBox has an associated voice clip, this is why we can call such a pair a "phrase". Every phrase has absolutely unique identifier (called id), it has a description that tells you the context so you can select the wording (called desc), it has the original English string (called source), it has a string specially for the voice clips (called voice) and it finally has the string in your language (called dest).

All source/dest/voice strings must be written within double quotes ("). There are a few keywords that can be used that don't use quotes, but they are special and are detected by the absence of quotes.

When updating a language, you are must only change the dest and voice strings. Changing id, source or desc will either break-up everything or turn the subsequent update job into real pain.

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 smile )

Lang files must be saved with UTF-8 encoding.

Notes on the file format

We allow different strings for different targets/features, and you can now make sure that the string is correctly saying things for each model. All phrases have a default string like: *: "default" that will be used if no other string matches for the particular model you build the language for. If you want a particular string for the iriver iriverh300 series you'd write it like: iriverh300: "iriverh300-specific string" (and of couse use the default string too on the line below).

The translation

Any phrase that needs attention has a '###'-comment. This is a list of some of the special cases:

Deprecation

A deprecated string is not needed anymore.

If a string is not needed anymore, it's not allowed to delete it in the master file. Therefore, they are marked by writing "DEPRECATED" to the description. The 'updatelang' script will propogate the necessary changes to the translated file.

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>

Added Strings

If a new string has been found in english.lang, updatelang will prepare a resource for you, so you only have to remove the comments and translate the string. Example:
###
### 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>

String Removal

The lang format allows you to completely remove a string for a particular target's language file by using the none keyword:

  <dest>
     *: "fancy LCD bitmap rotation enabled"
     player: none
  </dest>

Translation style

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 :-)
Now, go ahead and see if you made a mistake before posting your work in the patch tracker.
If you are able to create a patch with your changes against current git we prefer that but the whole .lang file is just fine. Be sure to drop a line on the mailing list or IRC after that so your updated file will get committed as soon as possible. It would be a bummer if the changes never get merged, or someone else repeats your work some time later.

Safety checks

Note: strings are always "within double quotes", even the empty ones

  1. check: Compare the newyourlang.lang to yourlang.lang. This allows you to see WHAT you changed, just in case you made a big mistake.
  2. check: Compare the newyourlang.lang to english.lang. These files should only differ in new-strings and comments.
  3. check: Compiling rockbox (updatelang+genlang) flow complains when making a binary .lng file. This can easily be done by placing yourlang.lang inside the apps/lang directory inside your source tree and performing a 'make'. (Note that if you created a new translation, you will also need to edit apps/lang/SOURCES and include your new file)
  4. check: Upload your new/updated lang file to https://translate.rockbox.org/ (click on the [!] icon next to the language name to see the form) and it will tell you what's wrong.
  5. check: Experiment on oneself: Compile rockbox with your updated .lang file, install it on your device, switch to the new language and try it out.

As mentioned above, you can run your work-in-progress translation file through 'updatelang' at any time, and it will tell you how you're doing. This is actually the same mechanism that the https://translate.rockbox.org web site uses for its sanity checks.

Current status

Translations status overview on translate.rockbox.org

I Attachment Action Size Date Who Comment
langstatusEXT langstatus manage 1.6 K 23 Aug 2006 - 03:09 JonasHaeggqvist Language status script, generates the table on this page
r61 - 16 Jul 2024 - 13:04:40 - SolomonPeachy


Parents: DocsIndex
Copyright © by the contributing authors.