lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



On May 25, 2008, at 6:40 AM, Pete Kay wrote:

I am trying to develop a web application in Lua. Could someone help me to
understand how to enable i18n support in Lua?

One option is to systematically use a consistent Unicode encoding such as UTF-8. For a web application, this is usually all what one needs.

As an example, here is a web application implemented in Lua with Unicode support throughout:

http://svr225.stepx.com:3388/chinese-language

Here is another Lua example implementing Sean M. Burke's Unidecode [1]:

http://dev.alt.textdrive.com/browser/HTTP/Unidecode.lua
http://dev.alt.textdrive.com/browser/HTTP/Unidecode/00.txt

Note how the table keys are regular UTF-8 encoded Lua strings.

If I want to have a String map in a file, one for each locale, can Lua read
and display the unicode character?

Sure, a Lua string can store any byte sequence.

Now... depending of your usage pattern, you might need additional functionalities:

http://lua-users.org/wiki/LuaUnicode

Things like Klaus Ripke's slnunicode and Alexandre Erwin Ittner's lua- iconv might be handy for more sophisticated usage scenario:

http://luaforge.net/projects/sln/
http://luaforge.net/projects/lua-iconv

--
PA.
http://alt.textdrive.com/nanoki/

[1] http://interglacial.com/~sburke/tpj/as_html/tpj22.html