loctool for PO devs

An ilib loctool plugin to parse and localize GNU gettext po files. This plugin can parse and localize po or pot files written by tools such as easy gettext.

Input file typeOutput file typeSample
popohere

1) Extract localizable Strings

A .PO file is a portable object file, which is text-based. These types of files are used in commonly in software development. The .PO file may be referenced by Java programs, GNU gettext, or other software programs as a properties file. These files are saved in a human-readable format so that they can be viewed in a text editor by engineers and translators.
The format is specified on the gnu website

i.e)

#: lib/error.c:116
msgid "Hello"
msgid "Good bye"
// a plural string
msgid "There is {n} object."
msgstr_plural "There are {n} objects."

2) Prepre XLIFF files

Prepare multi-language XLIFF files with translation.
With loctool parameter or through a config file, It can set xliff files location.

// a) loctool option
-x or --xliffs
Specify the dir where the xliffs files live. Default: "."
// b) set in project.json config file
...
"settings": {
"xliffsDir": "./xliffs",
...

3) Write config file for loctool

Make sure plugin and po property are written correctly in config file.
Here's detail information of configuration. here i.e) project.json

"plugins": [
"ilib-loctool-po"
],
"settings": {
...
"po": {
"mappings": {
"**/*.po": {
"template": "resource/[locale].po"
}
}
}
}

4) Run the loctool - Generate localization data

loctool creates a new folder under resource with name of [locale].po

i.e) Korean strings resource-es/ko-KR.po:

#: a/b/c.js:32
msgid "Hello"
msgstr "안녕하세요"

Appendix