Add New Page: You are not allowed to add pages Select section/namespace. New page title.
 

Internationalization and Localization

Contributing to Translations

Downloading Translation Packages

Building Translation Packages

When building a Commotion image a translation package can be added to your existing image or built as a package. You can add a translation package in the menuconfig under (LuCI —> Translations). Commotion relies on existing LuCI menu translations for all advanced menu's. As such, when you select a commotion translation package for install it will auto-select the corresponding LuCI translation package found in (Commotion —> Translation) for install.

The Commotion translation menu provides an optional flag “Bundle translations” that will bundle the selected translations with their corresponding LuCI translation's. This will allow you to distribute a single package that contains all menu translations instead of having to keep both a LuCI and Commotion translation package.

Creating/Adding New Translation's To Commotion

To add a new translation to Commotion you will need to update the [https://github.com/opentechinstitute/commotion-feed.git|Commotion-Feed]] and LuCI-i18n-Commotion repositories.

Updating Commotion-Feed

https://github.com/opentechinstitute/commotion-feed.git

The commotion-feed repository is where commotion defines how a Commotion package is compiled and installed. Each package in commotion-router contains a “Makefile” here. We need to update the “Makefile” of the luci-i18n-package to include the new language being added.

The commotion-feed/packages/luci-i18n-commotion directory contains the Makefile that we will need to add this language to. In short, this Makefile uses a script to auto-create a translation package for every language that is defined within it. Near the end of the file you will add a line containing the Captilized and lower-case name of the language along with the proper international abbreviation.

$(eval $(call prep-package,Language,language,la))

For instance. If you were adding Spanish, and the only language in the file was French (shown), you would create a new after the French declaration and add the Spanish line below.

...
$(eval $(call prep-package,French,french,fr))
$(eval $(call prep-package,Spanish,spanish,es))

Make sure you use the proper two letter abbreviation for the language chosen. This abbreviation is used to pull the LuCI translation files, and if it is incorrect it will throw an error. The lower-case spelling is also used to determine the dependencies, and as such, is required to be correct as well.

Updating LuCI-i18n-Commotion

https://github.com/opentechinstitute/luci-i18n-commotion.git|

The luci-i18n-commotion repository holds all the commotion translation files and installation scripts. A .po “tanslation” file, described in the “contributing to translations” section above, and a installation script need to be added to the luci-i18n-commotion package for every new language added to commotion.

*Adding the translation file*

  1. Name the .po file you created in the following way: commotion-luci-[two letter abbreviation].po As an example, commotion-luci-es.po is the Spanish language .po file used.
  2. Place the .po file into the directory luci-i18n-commotion/translations/.

*Adding the installation script* The installation script is used to tell the LuCI system that the installed language is supported.

  1. Create a file titled luci-i18n-[language name] in the luci-i18n-commotion/scripts/uci-defaults/ directory. The Spanish version of this is luci-i18n-spanish. Make sure you use lower-case letters for the languages name.
  2. Use the following template to create an install script. Replace the text [LANGUAGE_NAME] with the name of the language in its native character set UTF-8. For example Spanish would show Español instead of LANGUAGE_NAME.
#!/bin/sh
uci batch <<-EOF
        set luci.languages.es=LANGUAGE_NAME
        commit luci
EOF

The above script simply directs a uci set, and commit through a uci “batch” command. This sets the language that shows in the translations dropdown box in the advanced menu.

Once you have followed the above steps you can test your package.

You will first need to edit feeds.conf file before running setup.sh in the build process to point to your new commotion-feed repo by changing the address listed for our git repo to point to yours. If you have modified a specific branch of your repo with the changes you have made you will want to follow the link address with a semi-colon and the branch name.

src-svn packages svn://svn.openwrt.org/openwrt/branches/packages_12.09
src-svn luci http://svn.luci.subsignal.org/luci/tags/0.11.1/contrib/package
src-git commotion git://github.com/YOUR_REPO/commotion-feed.git;YOUR_TEST_BRANCH

Once you run setup you will need to change the directory that the Makefile pulls its resources from so it will download your .po file and install script. The makefile can be found in the directory commotion-router/openwrt/feeds/commotion/packages/luci-18n-commotion/. Open the makefile and change the source url for the luci-u18n-package to represent your repository. If you also made a branch you will need to change the branch name (package version) as well.

...
PKG_VERSION:=YOUR_TEST_BRANCH
...
PKG_SOURCE_URL:=git://github.com/YOUR_REPO/luci-i18n-commotion.git
...

Save this file and go back to the commotion-router/openwrt directory. From there, run make menuconfig, select your language in (Commotion –> Translations), save, exit, and run make. You will have to build the package with and without the bundle option checked to ensure that your install scripts (which only come in the bundled version) work.