luci-base: introduce luci.i18n.dump()
[oweals/luci.git] / modules / luci-base / luasrc / i18n.luadoc
1 ---[[
2 LuCI translation library.
3 ]]
4 module "luci.i18n"
5
6 ---[[
7 Clear the translation table.
8
9 @class function
10 @name clear
11 ]]
12
13 ---[[
14 Load a translation and copy its data into the translation table.
15
16 @class function
17 @name load
18 @param file     Language file
19 @param lang     Two-letter language code
20 @param force    Force reload even if already loaded (optional)
21 @return         Success status
22 ]]
23
24 ---[[
25 Load a translation file using the default translation language.
26
27 Alternatively load the translation of the fallback language.
28
29 @class function
30 @name loadc
31 @param file     Language file
32 @param force    Force reload even if already loaded (optional)
33 ]]
34
35 ---[[
36 Set the context default translation language.
37
38 @class function
39 @name setlanguage
40 @param lang     An IETF/BCP 47 language tag or ISO3166 country code, e.g. "en-US" or "de"
41 @return         The effective loaded language, e.g. "en" for "en-US" - or nil on failure
42 ]]
43
44 ---[[
45 Return the translated value for a specific translation key.
46
47 @class function
48 @name translate
49 @param key      Default translation text
50 @return         Translated string
51 ]]
52
53 ---[[
54 Return the translated value for a specific translation key and use it as sprintf pattern.
55
56 @class function
57 @name translatef
58 @param key              Default translation text
59 @param ...              Format parameters
60 @return                 Translated and formatted string
61 ]]
62
63 ---[[
64 Return the translated value for a specific translation key
65 and ensure that the returned value is a Lua string value.
66
67 This is the same as calling <code>tostring(translate(...))</code>
68
69 @class function
70 @name string
71 @param key              Default translation text
72 @return                 Translated string
73 ]]
74
75 ---[[
76 Return the translated value for a specific translation key and use it as sprintf pattern.
77
78 Ensure that the returned value is a Lua string value.
79
80 This is the same as calling <code>tostring(translatef(...))</code>
81
82 @class function
83 @name stringf
84 @param key              Default translation text
85 @param ...              Format parameters
86 @return                 Translated and formatted string
87 ]]
88
89 ---[[
90 Return all currently loaded translation strings as a key-value table. The key is the
91 hexadecimal representation of the translation key while the value is the translated
92 text content.
93
94 @class function
95 @name dump
96 @return                 Key-value translation string table.
97 ]]