dev builds
themes manual
device status forums
mailing lists
IRC bugs
dev guide

Search | Go
Wiki > Main > SummerOfCode > SummerOfCode2008 > PluginLocalization

Rockbox Plugin Localization Project


Rockbox is currently aimed at a wide variety of digital audio players and users. Many of its users are native speakers of a language other than English and many others are blind. Currently, Rockbox provides translations for nearly 40 languages but these translations are limited to the core. All of the plugins are English only but this project aims to change that.


Implement a method for executing localized plugins using a static buffer to hold the strings and ids. This buffer will then be moved into the plugin buffer using plugin_get_buffer(). These versions will load from a single language file per language. In the future it will be nice to only load the necessary strings for each plugin instead of all plugin strings. This same idea can be extended to the core and would allow a universal language file instead of target-specific language files. This constitutes a fairly massive change to the language system and will be the last part of the plugin localization effort.


Currently it is possible to view three different plugins, Blackjack, Chopper, and Chessbox, translated into Spanish. It's been a while since I've taken any Spanish so the translation is sure to be rough. Access to these strings is restricted by the user keyword. If a plugin attempts to access a string that has a differing user id than requested in the call to plugin_use_lang() an empty string will be returned instead. The final version will use a different method than this restricted access.

Plugins can also use the talking functions. As an example, some of Blackjack has parts that are voiced. For now, Blackjack will voice whether you won or lost a hand and ask if the user wants to play again. Plugins can access voice clips from the core clips and plugin clips.

The latest work on this project can be found at .


During building, /apps/plugins/lang/*.lang are run through genlang. The results will be in .rockbox/plangs/*.lng. After a plugin is loaded, a call must be made to plugin_use_lang() in plugin_start() if the plugin wants to use localized strings. This function will initialize the plugin strings and store them in the plugin buffer. If another language was chosen, plugin_use_lang() checks global_settings and loads that language file. These strings are accessed using the p_str() macro. Similarly, if a plugin wishes to use strings from the core lang, the str() macro can be used. These strings are available to all plugins, not just the ones that call plugin_use_lang().

When these plugin lang files are run through genlang an array is created that stores a string's user information. When a language is initialized, each strings user is checked. If the user does not match the current string user (as passed by plugin_use_lang() ) plugin_language_strings will point to an empty string instead of the builtin string.

To create a voice file that works with plugins, run tools/configure select a target an start a voice build. Genlang will create voicefontids like normal but now the plugin voice clips are appended to the end. Plugin language ids start at 0x16000 and increase. To hear a voice clip from the core, a plugin should call talk_id() as normal. In order to hear a voice clip from the plugin strings, a plugin should call plugin_talk_id() the same way as they would call talk_id(). Internally, plugin language clips are stored in the first voice table and start right after the core strings (with ids LANG_ not VOICE_). If you look at plugin_talk_id(), you'll be able to see that it calls talk_id() with PLUGIN_LANG_ID + LANG_LAST_INDEX_IN_ARRAY - 1.

Who's working on this


r4 - 02 Apr 2021 - 20:46:07 - UnknownUser

Copyright © by the contributing authors.