summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/src/template_lmo.c
AgeCommit message (Collapse)Author
2020-01-25luci-base: add support for plural translations and contexts in Lua apiJo-Philipp Wich
- Introduce a new luci.template.parser.ntranslate() function which takes a count, a singular and a plural translation string as well as an optional context argument and returns the appropriate, language specific plural translation. - Introduce an optional translation context argument in the existing luci.template.parser.translate() function - Support translation contexts in LuCI template directives. Translation messages are split on the first unescaped pipe character and the reamining string after the pipe is treated as context. Examples: - `string.format(p.ntranslate(n, "1 apple", "%d apples"), n)` will return an appropriate plural translation for the given amount. - `translate("Load", "The system load")` will return an appropiate translation for `Load`, using `The system load` as disambiguation context (a `msgctxt` directive in *.po files). - Likewise `<%:Load|The system load%>` will translate the word `Load` while using the remainder of the string as context. - To use pipes in translations strings literally, they must be escaped: `<%:Use the "\|" character%>` will translate the literal string `Use the "|" character`. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-19luci-base: further hash calculation signedness bugfixesJo-Philipp Wich
- cbi.js: make sure to treat single bytes as signed char when handling end cases - template_lmo.c: make sure to treat single bytes as signed char when handling end cases, avoids hash miscalculations on ARM Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-05luci-base: template: add translation iterator functionJo-Philipp Wich
Introduce a new luci.template.parser.get_translations() function which will iterate all loaded translation entries and pass the to the given callback function. This is useful to expose the loaded translations in other formats, e.g. for wrapping them into JSON feeds. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2015-01-16Update my email addresses in the license headersJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-08Rework LuCI build systemJo-Philipp Wich
* Rename subdirectories to their repective OpenWrt package names * Make each LuCI module its own standalone package * Deploy a shared luci.mk which is used by each module Makefile Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>