lua-users home
lua-l archive

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

-----Original Message-----
From: [] On
Behalf Of
Sent: None
Subject: lua-l Digest, Vol 67, Issue 39

Send lua-l mailing list submissions to

To subscribe or unsubscribe via the World Wide Web, visit

or, via email, send a message with subject or body 'help' to

You can reach the person managing the list at

When replying, please edit your Subject line so it is more specific than
"Re: Contents of lua-l digest..."

Today's Topics:

   1. Re: My program doesn't speak Portugese! (Philipp Janda)
   2. Re: Handling Translated Texts (i18n) (Xavier Wang)


Message: 1
Date: Tue, 23 Feb 2016 23:57:32 +0100
From: Philipp Janda <>
Subject: Re: My program doesn't speak Portugese!
Message-ID: <naio4s$rr2$>
Content-Type: text/plain; charset=UTF-8; format=flowed

Am 23.02.2016 um 23:00 schrC6bte Sean Conner:
>    It's not documented (at least, I didn't see it mentioned in the 
> description for for Lua 5.1, 5.2 or 5.3), but Lua does 
> return a third parameter for

For Lua 5.1:
For Lua 5.2:
For Lua 5.3:

> Unless otherwise stated, all I/O functions return nil on failure (plus 
> an error message as a second result and a system-dependent error code 
> as a third result) and some value different from nil on success. On 
> non-POSIX systems, the computation of the error message and error code 
> in case of errors may be not thread safe, because they rely on the 
> global C variable errno.

The weird thing is that the entry for `` *does* state otherwise:

> This function opens a file, in the mode specified in the string mode.
> It returns a new file handle, or, in case of errors, nil plus an error 
> message.



Message: 2
Date: Wed, 24 Feb 2016 19:46:10 +0800
From: Xavier Wang <>
Subject: Re: Handling Translated Texts (i18n)
To: Lua mailing list <>
Content-Type: text/plain; charset=UTF-8

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 _"d= e%=o< d8g "(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
( 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 <>:
> 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
>  * Pull in via require, or some hand rolled loader?
>  * Use raw tables, meta-table object, or a function call to access the
>  * 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

Xavier Wang.


lua-l mailing list

End of lua-l Digest, Vol 67, Issue 39