lua-users home
lua-l archive

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


I had some experience about this. We transform our game from Chinese
to Thai languages. We use GNU's gettext package.

first, all text are around with _"你好,世界"(Chinese), but sometimes we
use _ in Lua as a annoy variable, so we changed it to L, and use
xgettext to extra these marker (L"Hello") to a po file, and use GNU
GUI tools to translate the po file.

after that, we compile .po file to .mo file, and use lbuffer
(https://github.com/starwing/lbuffer) transform mo file to Lua table,
and implement the L global function to find text in table.

lbuffer has a table based pack/unpack routines, in days we don't have
string.pack/unpack, nowadays you can use these directly to translate
mo to Lua table.

2016-02-24 0:15 GMT+08:00 Scott Morgan <blumf@blueyonder.co.uk>:
> I'm in the middle of a project where my scripts might have to return
> localised texts. Nothing too fancy just plain strings (i.e. no
> formatting of results, time/date formats, etc.)
>
> I think Lua's tables will be good enough to handle holding the data but
> was wondering if anybody had any experience or insights into organising
> the data.
>
> Stuff like:
>  * One big file with all translation, or separate files per language/region?
>  * Pull in via require, or some hand rolled loader?
>  * Use raw tables, meta-table object, or a function call to access the text?
>  * ID the texts via a native language value, or some unique ID number?
>  * Finding all locations of translated texts in code base to send off
> for translation
>
> Scott
>



-- 
regards,
Xavier Wang.