diff options
Diffstat (limited to 'docs/i18n.md')
-rw-r--r-- | docs/i18n.md | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/docs/i18n.md b/docs/i18n.md index c91f29e63d..a9ba01314b 100644 --- a/docs/i18n.md +++ b/docs/i18n.md @@ -6,7 +6,7 @@ See [online wiki](https://github.com/openwrt/luci/wiki/i18n) for latest version. ### Translations in JavaScript -Wrap translatable strings with `_()` e.g. `_('string to translate')` and the `i18n-scan.pl` and friends will correctly identify these strings as they do with all the existing translations. +Wrap translatable strings with `_()` e.g. `_('string to translate')` and the `i18n-scan.pl` and friends will correctly identify these strings for translation. If you have multi line strings you can split them with concatenation: ```js @@ -23,25 +23,19 @@ var mystr = _('this string will translate \ a multi line string'); ``` -Usually if you have multiple sentences you may need to use a line break then use the `<br />` HTML tag: -```js -var mystr = _('Port number.<br />' + - 'E.g. 80 for HTTP'); -``` - -To simplify a job for translators it may be better to split into separate keys without the `<br />`: +Usually if you have multiple sentences you may need to use a line break. Use the `<br />` HTML tag like so: ```js var mystr = _('Port number.') + '<br />' + _('E.g. 80 for HTTP'); ``` -Please use `<br />` and **not** `<br>` or `<br/>`. +Use `<br />` and **not** `<br>` or `<br/>`. -If you have a link inside a translation then try to move its attributes out of a translation key like: +If you have a link inside a translation, move its attributes out of a translation key: ```js var mystr = _('For further information <a %s>check the wiki</a>') .format('href="https://openwrt.org/docs/" target="_blank" rel="noreferrer"') ``` -This will generate a full link with HTML `For further information <a href="https://openwrt.org/docs/" target="_blank" rel="noreferrer">check the wiki</a>`. The `noreferrer` is important when making a link that is opened in a new tab (`target="_blank"`). +This will generate a full link with HTML `For further information <a href="https://openwrt.org/docs/" target="_blank" rel="noreferrer">check the wiki</a>`. The `noreferrer` is important so that it is opened in a new tab (`target="_blank"`). ### Translations in LuCI lua+html templates Use the `<%: text to translate %>` as documented on [Templates](./Templates.md) @@ -54,7 +48,7 @@ In most controller contexts, this is already available for you, but if necessary ## Translation files Translations are saved in the folder `po/` within each individual LuCI component directory, e.g. `applications/luci-app-acl/po/`. The template is in `po/templates/<package>.pot`. -The actual translation files can be found at `po/[lang]/[package].po`. +The individual language translation files can be found at `po/[lang]/[package].po`. In order to use the commands below you need to have the `gettext` utilities (`msgcat`, `msgfmt`, `msgmerge`) installed on your system. On Debian/Ubuntu, install them with `sudo apt install gettext`. |