lvgl / lv_i18n

Internationalization (i18n) for LVGL
MIT License
58 stars 17 forks source link

Utilities #4

Closed puzrin closed 5 years ago

puzrin commented 5 years ago

Minimal set of tools to maintain translations

lv-textract

Scan directories/files end extract phrases to config.

Initial extractor can be regexp-based. That's dirty, but may be enougth. In not enougth - search for PEG-based grammar parcers.

lv-tmerge

lv-tcompile

Generate catalog file for #include from config.

lv-tlint

TBD

Consistency checker. Good got CI.

Did not decided, if this should be a separate tool, or part of extractor.

font builder

TBD

By default, it may build glyphs set automatically, from used phrases + some options for defaults

Unresolved

kisvegabor commented 5 years ago

Can you draw a simple chart about the order of scripts and their input/output files?

puzrin commented 5 years ago
  1. Main: code -> lv-textract -> .yaml -> lv-tcompile -> .c
  2. Fixing: .yaml -> lv-tmerge -> .yaml
  3. Testing: .yaml -> `lv-tlint -> reports
puzrin commented 5 years ago

Alternative - one script (except font) + subcommands:

lv-t [command] options

Example:

lv-t extract ./src/*.c ./i18n/*.yml
lv-t merge ./i18n/*.yml -s'Nuts' -d'Bolts'
kisvegabor commented 5 years ago

I like the idea of one script.

merge is really required? As I imagine people will always just extract and if the output yml already exists then the data should be merged.

puzrin commented 5 years ago

merge is really required? As I imagine people will always just extract and if the output yml already exists then the data should be merged.

That's not to merge files, but to merge broken keys inside.

You may have each lang in separate yaml. Then changed text in firmware, and have floating translations in each after extract. How to fix? Of cause, you can do this manually, but IMO that's not convenient.

kisvegabor commented 5 years ago

I see, in this case merge is a little bit misleading. As you "just" delete or insert some msgids and not merging two files.
edit or update might be a better name.

puzrin commented 5 years ago

I don't know about alternatives, but you are right, merge is not perfect.

Let's all continue post alternate names, we can summarize after 1-2 weeks. This is not blocker for development.

puzrin commented 5 years ago

@kisvegabor https://github.com/littlevgl/lv_i18n/tree/vit - take a look.

I've added CLI stub. It does nothing, but allows to play with help and report invalid arguments. Try to execute and play with it.

How to install:

git clone git@github.com:littlevgl/lv_i18n.git
cd lv_i18n
git checkout vit
npm install

Then run lv_i18n.js with different options.

kisvegabor commented 5 years ago

In general looks good to me. I've just added some straightforward fixes to the README. See: https://github.com/littlevgl/lv_i18n/commit/ed8f5cc9ab9dd3644e4f9efc4731b6c53d548ed9

puzrin commented 5 years ago

Thanks. I moved it to separate branch :). My one is actively rewritten and last commit is incomplete (stores day progress, just to show everything goes forward).

puzrin commented 5 years ago

Close. Info is outdated. Actual implementation + docs merged into active branches.