-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi.

> In Luci 0.10 it just shows the anchor "chillifire_white". How has the
> code to be changed so the fall back translation in the code file is
> shown again?

Probably not, read on.

> Please provide some documentation for this new i18n system. Thanks

The reasoning to change it was that the separate management of
translation keys and message strings was cumbersome, one has to
carefully look them up, check that no redundancy got introduced and the
english default translation was always needed in order to have texts at
all. For this reason we made the message strings itself the key so

  translate("foo", "Bar")

is now just

  translate("Bar")

I attached a patch which should restore the old call conventions for
i18n() and translate(), maybe you want to give it a try.

For further information see
https://forum.openwrt.org/viewtopic.php?id=24887

I'll wrap that info in a doc this evening and get back to you.


Regards,
Jow
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk01cwAACgkQdputYINPTPN4dQCgkeHJ2AS6R4MzoFntEdbC8x1v
rBwAn22WeqklGxs7f/eg4de+xEksb0+h
=a7V7
-----END PGP SIGNATURE-----
Index: libs/web/luasrc/i18n.lua
===================================================================
--- libs/web/luasrc/i18n.lua	(revision 6744)
+++ libs/web/luasrc/i18n.lua	(working copy)
@@ -95,11 +95,11 @@
 --- Return the translated value for a specific translation key.
 -- @param key	Default translation text
 -- @return		Translated string
-function translate(key)
-	return (table[context.lang] and table[context.lang][key])
-		or (table[context.parent] and table[context.parent][key])
-		or (table[default] and table[default][key])
-		or key
+function translate(key, alt)
+	return (table[context.lang] and table[context.lang][alt or key])
+		or (table[context.parent] and table[context.parent][alt or key])
+		or (table[default] and table[default][alt or key])
+		or alt or key
 end
 
 --- Return the translated value for a specific translation key and use it as sprintf pattern.
_______________________________________________
openwrt-users mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-users

Reply via email to