[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Internationalization of Lua Programs
- From: Paul K <paulclinger@...>
- Date: Thu, 25 Jul 2013 07:51:15 -0700
> But then, why not define a function such as L so that L"Hello World" will do the appropriate lookup? First pass will return "Hello Word" but also create an entry in localization table(s).
> Lua programs that I know of with internalization support are Sputnik and ZeroBrane studio, so perhaps Yury Y and Paul K can speak about that...
I have implemented internationalization support in ZeroBrane Studio
and did exactly what Steve describes: I have TR("string") function
that plays a dual role of translating a string and also serving as a
marker that allows me to extract all strings that require translation
from the source code.
I described the details of the implementation in an earlier thread:
The Lua script I have does both of those things you are asking about:
it extracts all strings wrapped into TR calls, but it also "merges"
them with an existing translation file and will even mark those
translation that might have been modified, so it can be used to
quickly check what strings have been added/updated and need to be
This mechanism has been working well for the project and I haven't
seen any issues related to it; it has been so far translated to six
On Thu, Jul 25, 2013 at 1:51 AM, steve donovan
> On Thu, Jul 25, 2013 at 10:19 AM, Marc Balmer <firstname.lastname@example.org> wrote:
>> Any hints welcome!
> Extracting strings from Lua sources is not difficult, especially with lpeg
> (or a simple Lua tokenizer such as in Penlight).
> One just has to choose a convention, e.g double-quoted strings will be seen
> by users, single-quoted strings are internal.
> But then, why not define a function such as L so that L"Hello World" will do
> the appropriate lookup? First pass will return "Hello Word" but also create
> an entry in localization table(s).
> Lua programs that I know of with internalization support are Sputnik and
> ZeroBrane studio, so perhaps Yury Y and Paul K can speak about that...