Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFS Gluon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
firmware
FFS Gluon
Commits
b4068fa7
Commit
b4068fa7
authored
9 years ago
by
Matthias Schiffer
Browse files
Options
Downloads
Patches
Plain Diff
docs: add i18n howto
parent
5d8aee05
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
docs/conf.py
+1
-1
1 addition, 1 deletion
docs/conf.py
docs/dev/i18n.rst
+80
-0
80 additions, 0 deletions
docs/dev/i18n.rst
docs/index.rst
+1
-0
1 addition, 0 deletions
docs/index.rst
with
82 additions
and
1 deletion
docs/conf.py
+
1
−
1
View file @
b4068fa7
...
...
@@ -47,7 +47,7 @@ master_doc = 'index'
# General information about the project.
project
=
'
Gluon
'
copyright
=
'
201
4
, Project Gluon
'
copyright
=
'
201
5
, Project Gluon
'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
...
...
This diff is collapsed.
Click to expand it.
docs/dev/i18n.rst
0 → 100644
+
80
−
0
View file @
b4068fa7
Internationalization support
============================
General guidelines
------------------
* 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 ``translate`` function) should be the
English texts.
i18n support in LuCI
--------------------
Internationalization support can be found in the ``luci.i18n`` package.
Strings are translated using the ``i18n.translate`` and ``i18n.translatef`` functions
(``translate`` for static strings, ``translatef`` for printf-like formatted string).
Example from the ``gluon-config-mode-geo-location`` package::
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 ``i18n-scan.pl``
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, the i18n files must be installed in the package's Makefile::
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
Adding translations
-------------------
A new translation file for a template can be added using the ``msginit`` command::
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`` command::
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
instead).
Adding support for new languages
--------------------------------
A list of all languages supported by LuCI can be found in the ``include/package.mk`` file of
the Gluon repository. Adding translations for these languages is straightforward using the ``msginit``
command.
For other languages, support must be added tu LuCI first, which constitutes completely translating
the ``base.pot``. Please contact the upstream LuCI maintainers if you'd like to do this.
This diff is collapsed.
Click to expand it.
docs/index.rst
+
1
−
0
View file @
b4068fa7
...
...
@@ -40,6 +40,7 @@ Developer Documentation
dev/upgrade
dev/configmode
dev/wan
dev/i18n
Supported Devices
-----------------
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment