react-gettext icon indicating copy to clipboard operation
react-gettext copied to clipboard

generation mo file

Open zenikd opened this issue 6 years ago • 1 comments

Hi, i have problem with generation mo file. When i add new localization (By poedit) and save it, mo file contain something like this

PO-Revision-Date: 2019-01-17 20:19+0300
Language-Team: 
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Generator: Poedit 2.0.6
X-Poedit-Basepath: ../../src
Plural-Forms: nplurals=2; plural=(n != 1);
X-Poedit-KeywordsList: gettext;ngettext:1,2;xgettext:1,2c;nxgettext:1,2,4c
X-Poedit-SourceCharset: UTF-8
Last-Translator: 
Language: en
X-Poedit-SearchPath-0: components
 username 

But in your project mo.json files contain payload in json format. How can i change save format in poedit (or another editor)?

zenikd avatar Jan 17 '19 17:01 zenikd

Hi @zenikd

you need to install gettextjs package by running pip3 install gettextjs in your terminal. Then you will be able to convert mo files into json files.

See the sample project here. It contains two npm commands: gettext:compile and gettext:convert. The first one converts po files into mo files, the second one converts mo files into json files.

eugene-manuilov avatar Feb 01 '19 12:02 eugene-manuilov