Age | Commit message (Collapse) | Author |
|
- 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>
|
|
Signed-off-by: David Yang <mmyangfl@gmail.com>
|
|
This reverts commit ad7dc4a4928e77ae142d0fe040f9e9e64b530e82.
Since we're using liblucihttp now, that library is the appropriate place to
add such decoding helper functions.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
The C implementations of urlencode and urldecode are considerably faster
than their current Lua counterparts.
On an AMD Geode system, the C variant is up to ten times faster when
decoding strings and up to four times faster when encoding them.
The functions are also designed to only allocate new strings when any
actual changes are required, otherwise they reuse the existing input
strings, reducing the overal memory usage somewhat.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
Previously the template engine did not interpolate translation macros if no
translation catalogue could be loaded due to a missing i18n directory.
Change the offending code to return the original string in any error case.
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
* 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>
|