Age | Commit message (Collapse) | Author |
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
- 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>
|
|
Using xgettext has a few benefits compared to the previous perl extraction
approach. The xgettext utility is able to properly distinguish commented
from uncommented code and it is able handle concatenated constant
expressions such as `_("Some " + "string")`.
A further benefit is the ability to extract translations with disambiguation
contexts and plural translation calls.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
The scanning routine has caused unnecessary changes to the .po files
if a string has been found in multiple files and those files have been
found in different order than the previous time.
Sort the location annotations to avoid unnecessary changes to the .po files.
(sort is alphabetic, so the line numbers are also sorted alphabetically)
Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
[apply a Schwartzian transform to sort locations by path, then line number]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Fixes: #2738
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Extend i18n-scan.pl to scan JavaScript files for translation strings as
well and annotate produced *.po template files with source code location
markers.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: David Yang <mmyangfl@gmail.com>
|
|
|
|
|
|
|
|
Issuing './build/i18n-scan.pl libs/core/' leads to this
endless loop with some perl implementations:
<...>
Use of uninitialized value in concatenation (.) or string at../build/i18n-scan.pl line 69.
substr outside of string at ./build/i18n-scan.pl line 69.
Use of uninitialized value in concatenation (.) or string at ./build/i18n-scan.pl line 69.
substr outside of string at ./build/i18n-scan.pl line 69.
Use of uninitialized value in concatenation (.) or string at ./build/i18n-scan.pl line 69.
substr outside of string at ./build/i18n-scan.pl line 69.
Use of uninitialized value in concatenation (.) or string at ./build/i18n-scan.pl line 69.
substr outside of string at ./build/i18n-scan.pl line 69.
Use of uninitialized value in concatenation (.) or string at ./build/i18n-scan.pl line 69.
substr outside of string at ./build/i18n-scan.pl line 69.
Use of uninitialized value in concatenation (.) or string at ./build/i18n-scan.pl line 69.
substr outside of string at ./build/i18n-scan.pl line 69.
Use of uninitialized value in concatenation (.) or string at ./build/i18n-scan.pl line 69.
substr outside of string at ./build/i18n-scan.pl line 69.
Use of uninitialized value in concatenation (.) or string at ./build/i18n-scan.pl line 69.
substr outside of string at ./build/i18n-scan.pl line 69.
Use of uninitialized value in concatenation (.) or string at ./build/i18n-scan.pl line 69.
substr outside of string at ./build/i18n-scan.pl line 69.
<...>
Experienced with this perl version:
"This is perl, v5.8.8 built for i386-linux"
Fix it by undefining the 'sub' variable if it is an
empty string.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
|
|
spotted in luci-pbx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|