eugene-manuilov / react-gettext

Tiny React library for implementing gettext localization in your application.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Get text extract

shirazz opened this issue · comments

@eugene-manuilov It would be nice if you can document details about extracting strings and creating the .pot file. If you can just provide an overview, i can contribute the rest.

Hey @shirazz,

thanks for your help! There is a small block in the documentation which provides an example of pot file. You can open that file in Poedit app to update catalog and create po files based on it.

As an alternative you can also run following command:

find /path/to/project -name "*.js" | xargs xgettext --from-code=UTF-8 --language=JavaScript --keyword=gettext --keyword=ngettext:1,2 --keyword=xgettext:1,2c --keyword=nxgettext:1,2,4c --output=/path/to/project/projectname.pot --sort-by-file --package-name="My Project" --package-version="1.0.0"

It will create a new pot file for you or update existing one. Does it work on your end? Let me know.

@eugene-manuilov yea. it works. I think this should be added to the Readme file. What you think? Please let me know if you need me to create a PR.

@shirazz yep, it makes sense. Please, submit your PR.

closes #16