Commit graph

9 commits

Author SHA1 Message Date
Jo-Philipp Wich
9939fc5a26 luci-base: add support for plural translations and contexts in Lua api
- 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-25 23:21:35 +01:00
Jo-Philipp Wich
937a51859d docs: add missing jsapi resources, update .gitignore
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-05 10:50:35 +01:00
Jo-Philipp Wich
17690f2d73 build: add build option to minify *.js files
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-22 12:49:14 +01:00
Jo-Philipp Wich
29004d9552 Update .gitignore
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-04-20 10:08:23 +02:00
Jo-Philipp Wich
00da2bbbd2 build: add po2lmo to .gitignore (#292) 2015-01-15 09:49:19 +01:00
Steven Barth
8c3ee6f9b7 Added "apidocs" target to Makefile
contrib/luadoc: Added luadoc executable
libs: Fixed typos in inline documentation
2008-07-29 21:16:12 +00:00
Steven Barth
f154da7e8c ignore vim swap files 2008-06-02 15:35:37 +00:00
Steven Barth
ed0ef1f9f0 move the .o and .so .gitignore lines to the top level .gitignore 2008-06-02 15:35:30 +00:00
Steven Barth
4365fbe2a3 Squashed commit of the following:
commit d45d1757d24d8214f730af1a3401dd2bef4a434f
Author: Steven <steven@cyrus.homeunix.org>
Date:   Wed May 28 17:23:27 2008 +0200

    * libs/core: Removed dummymode checks in sys
    * libs/sgi-webuci: Fixes

commit b870e8d345bc8912fd8ab61d463b9d68b924a6f4
Author: Felix Fietkau <nbd@openwrt.org>
Date:   Wed May 28 15:40:10 2008 +0200

    fix path to theme

commit e3732926bd98db4cc38de6eb8018cd4e55176699
Author: Felix Fietkau <nbd@openwrt.org>
Date:   Wed May 28 14:56:03 2008 +0200

    set the proper path to the config in dummy mode

commit a75aecf46f037c98bd6e49b9e48adb735d76d150
Author: Felix Fietkau <nbd@openwrt.org>
Date:   Wed May 28 14:50:42 2008 +0200

    add some dummy mode support

commit 12bb39ef606bca6b403cc982213a6597b76dc1b3
Author: Felix Fietkau <nbd@openwrt.org>
Date:   Wed May 28 14:41:56 2008 +0200

    normalize paths

commit 7aaad1103fd2bdc75aca158baa6ef191f9a961c6
Author: Felix Fietkau <nbd@openwrt.org>
Date:   Wed May 28 14:27:26 2008 +0200

    add missing require statement

commit 5766274bd2511b00c42b474aeeeb3efaca6ded9b
Author: Felix Fietkau <nbd@openwrt.org>
Date:   Wed May 28 14:19:54 2008 +0200

    add optional luaposix package (patched for darwin support)

commit 9e257a76d03722fc0ce8312aa9952641b21424bd
Author: Felix Fietkau <nbd@openwrt.org>
Date:   Tue May 27 20:21:59 2008 +0200

    add missing files, more integration for the boa plugin, fix path to lua modules

commit dacc1a98ec946975fcb19f87076dfa7db865fca6
Author: Felix Fietkau <nbd@openwrt.org>
Date:   Tue May 27 19:42:37 2008 +0200

    use "compile" instead of "source" and rename the old version of compile to "compile-all"

commit eb14777c4fee1eb5740aba1e5603e481320da7b1
Author: Felix Fietkau <nbd@openwrt.org>
Date:   Tue May 27 19:41:59 2008 +0200

    more boa integration

commit df0afb965bf0a987b653e9d0acadf3151179a596
Author: Felix Fietkau <nbd@openwrt.org>
Date:   Tue May 27 18:33:42 2008 +0200

    build boa and the webuci.so plugin along with sgi-webuci

commit 878161dabf32066631103d199e2cbaf3f5a7fb07
Author: Felix Fietkau <nbd@openwrt.org>
Date:   Tue May 27 18:03:16 2008 +0200

    add .gitignore
2008-05-28 15:28:13 +00:00