lua-users home
lua-l archive

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


On Mon, May 11, 2015 at 10:19 PM, Brigham Toskin
<brighamtoskin@gmail.com> wrote:
> Just submitted a pull request :)
>
> https://github.com/starius/mo.lua/pull/2

Thank you! Merged. Now mo.lua returns error string as second result
value in case of error. Trivial function remains as first result
value.

Version 1.1 was released and uploaded to luarocks.

>
> On Sun, May 10, 2015 at 6:12 PM, Nagaev Boris <bnagaev@gmail.com> wrote:
>>
>> Hello,
>>
>> I am pleased to announce that I have packaged the parser of MO files
>> and uploaded it to luarocks as package "mo".
>>
>> Homepage: https://github.com/starius/mo.lua
>> Installation: luarocks install mo
>> License: MIT
>>
>> MO file is binary translations format of GNU gettext. It is created
>> from PO file using tool msgfmt. It can be used to translate an
>> application or a site from English to other language.
>>
>> J.Jørgen von Bargen have uploaded the code of parser to this mailing
>> list on Apr, 01, 2010 [1]. I have changed behavior of the function:
>> now it returns translating function in case of success and
>> (function(x) return x end) in case of errors. Unit tests were added.
>> Package was uploaded to luarocks as "mo".
>>
>> I use this package in code of my site kodomoquiz.tk [2], based on
>> Lapis [3]. "mo" is used in many files of that project, e.g. in file
>> "app.lua" (as variable "_").
>>
>> Let us translate some Lua project into Russian.
>>
>> $ xgettext -p ru -s -j --language=Lua *.lua --from-code utf-8
>>
>> This command creates (or adds to) file ru/messages.po. It finds texts
>> like _("text") in source files and adds them to .po file.
>>
>> There are a lot of programs to translate .po file. One of them is poedit.
>>
>> To compile .po to .mo, run the following command:
>>
>> $ msgfmt ru/messages.po -o ru/messages.mo
>>
>> This module is used to parse .mo file from Lua.
>>
>>
>> [1] http://lua-users.org/lists/lua-l/2010-04/msg00005.html
>> [2] https://github.com/starius/kodomoquiz
>> [3] http://leafo.net/lapis/
>>
>> --
>>
>>
>> Best regards,
>> Boris Nagaev
>>
>
>
>
> --
> Brigham Toskin



-- 


Best regards,
Boris Nagaev