- All config mode packages must be fully translatable, with complete English and German texts.
- All new expert mode packages be fully translatable. English texts are required, German texts recommended.
- Existing expert mode packages should be made translatable as soon as possible.
- The “message IDs” (which are the arguments to the
translatefunction) should be the English texts.
i18n support in LuCI¶
Internationalization support can be found in the
Strings are translated using the
translate for static strings,
translatef for printf-like formatted string).
Example from the
local i18n = require "luci.i18n" o = s:option(cbi.Flag, "_location", i18n.translate("Show node on the map"))
Adding translation templates to Gluon packages¶
The i18n support is based on the standard gettext system. For each translatable package,
a translation template with extension
.pot can be created using the
script from the LuCI repository:
cd package/gluon-config-mode-geo-location mkdir i18n cd i18n ../../../packages/luci/build/i18n-scan.pl ../files > gluon-config-mode-geo-location.pot
The entries in the template can be reordered after the generation if desirable. Lots of standard
translations like “Cancel” are already available in the LuCI base translation file (see
packages/luci/po/templates/base.pot) and can be removed from the template.
In addition, some additions to the Makefile must be made. Instead of OpenWrt’s default package.mk,
the Gluon version
$(GLUONDIR)/include/package.mk must be used. The i18n files must be installed
and PKG_CONFIG_DEPENDS must be added:
... include $(GLUONDIR)/include/package.mk PKG_CONFIG_DEPENDS += $(GLUON_I18N_CONFIG) ... define Build/Compile $(call GluonBuildI18N,gluon-config-mode-geo-location,i18n) endef define Package/gluon-config-mode-geo-location/install ... $(call GluonInstallI18N,gluon-config-mode-geo-location,$(1)) endef ...
A new translation file for a template can be added using the
cd package/gluon-config-mode-geo-location/i18n msginit -l de
This will create the file
de.po in which the translations can be added.
The translation file can be updated to a new template version using the
msgmerge -U de.po gluon-config-mode-geo-location.pot
After the merge, the translation file should be checked for “fuzzy matched” entries where
the original English texts have changed. All entries from the the translation file should be
translated in the
.po file (or removed from it, so the original English texts are displayed
Adding support for new languages¶
A list of all languages supported by LuCI can be found in the
packages/luci/luci.mk file after
Gluon’s dependencies have been downloaded using
make update. Adding translations for these
languages is straightforward using the
For other languages, support must be added tu LuCI first, which constitutes completely translating
base.pot. Please contact the upstream LuCI maintainers if you’d like to do this.