Utilities
puzrin opened this issue · 11 comments
Minimal set of tools to maintain translations
- use
node.js
- quick development
- cross palform, easy to install
- no convertors for web services yet, but keep this in mind
lv-textract
Scan directories/files end extract phrases to config.
- Multiple sources/targets support needed
- nice to keep each language in separate file
- may be convenient for "submodules" (not sure)
- If target exists - merge content
- Report if phrase exists in config, but missed in source (after rename, for example)
Initial extractor can be regexp-based. That's dirty, but may be enougth. In not enougth - search for PEG-based grammar parcers.
lv-tmerge
- report lost translations (no params), may happen after untranslated text (msg_id) update
- in theory, we can add advanced recommendations later, based on levenshtein distance check
- merge phrases by
msg_id
.
lv-tcompile
Generate catalog file for #include
from config.
- (?) can be extendable for other formats/languages (Rust, for example)
lv-tlint
TBD
Consistency checker. Good got CI.
- May check floating phrases (with missed msg_id)
- Wrong number of plurals for specific language
- Validate locale names (optional)
- Anything else?
Did not decided, if this should be a separate tool, or part of extractor.
font builder
- Wich font formats should be supported, except ttf?
- I would prefer ONLY web fonts (ttf/woff/woff2), but can we support low resolution pixel fonts this way?
- Should allow define any combination of ranges ans single glyphs
- Should allow load options from file - can be massive.
TBD
By default, it may build glyphs set automatically, from used phrases + some options for defaults
- is autodetect useable at all?
- may be not for languages with short alphabets, and yes for "hieroglyph-ic" languages (Chinese and others).
- who is responsible to generate list of char codes? That's not fontbuilder task
- probably, option of extractor
- do we need to merge multiple src fonts (text + icons, for example)?
- do we need to remap glyph codes? (may be for icons, + avoid merge conflicts)
Unresolved
- Clarify scripts names
- Where to place font builder?
- That's formal, but what is licence for pixel fonts, generated from other ones?
- Probably, worth keep those (TTF) separate, to not affect MIT sources.
Can you draw a simple chart about the order of scripts and their input/output files?
- Main: code ->
lv-textract
-> .yaml ->lv-tcompile
-> .c - Fixing: .yaml ->
lv-tmerge
-> .yaml - Testing: .yaml -> `lv-tlint -> reports
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'
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.
merge
is really required? As I imagine people will always justextract
and if the outputyml
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.
I see, in this case merge
is a little bit misleading. As you "just" delete or insert some msgid
s and not merging two files.
edit
or update
might be a better name.
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.
@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.
- is it clear?
- missed something?
- any changes?
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.
In general looks good to me. I've just added some straightforward fixes to the README. See: ed8f5cc
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).
Close. Info is outdated. Actual implementation + docs merged into active branches.