summaryrefslogtreecommitdiffhomepage
path: root/build/i18n-scan.pl
AgeCommit message (Collapse)Author
2020-04-17build: i18n-scan.pl: make ACL descriptions translatableJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-02-06luci-app-statistics: convert plugin definitions to JSONJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
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>
2020-01-22build: i18n-scan.pl: use xgettext to extract message stringsJo-Philipp Wich
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>
2020-01-08build: sort location annotation table in i18n sync processHannu Nyman
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>
2019-12-16build: i18n-scan.pl: support extracting translations from menu jsonJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-05-31build: i18n-scan.pl: properly handle bracket-quoted stringsJo-Philipp Wich
Fixes: #2738 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-05build: i18n-scan.pl: *.js support, location annotationsJo-Philipp Wich
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>
2018-10-10treewide: Fix typos in commentsyangfl
Signed-off-by: David Yang <mmyangfl@gmail.com>
2012-04-22build: escape backslashes in i18n stringsJo-Philipp Wich
2012-04-03build: rework checks in i18n-scan.plJo-Philipp Wich
2012-04-02build: rework i18n-scan.pl defined checksJo-Philipp Wich
2012-04-02build/i18n-scan.pl: avoid a possible endless loopJo-Philipp Wich
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>
2011-11-05build: i18n-scan.pl: cope with strings that contain escaped newlines, ↵Jo-Philipp Wich
spotted in luci-pbx
2011-01-14build: fix some errors in i18n-scan.pl, support bracketed Lua string notationJo-Philipp Wich
2011-01-14build: properly handle i18n tags with whitespace strip tokens in i18n-scan.plJo-Philipp Wich
2010-12-11build/: Replace -or with -o #133Manuel Munz
2009-11-01build: fix corner case when extracting i18n tokens from templatesJo-Philipp Wich
2009-11-01build: allow multiple search directories in i18n-scan.plJo-Philipp Wich
2009-11-01build: update i18n-scan.pl, now reliably finds template and Lua i18n tokensJo-Philipp Wich
2009-05-17build: remove debugging code from i18n-scan.plJo-Philipp Wich
2009-05-17build: add script to extract i18n tags from sources and generate *.po snippetsJo-Philipp Wich