Download/i18nline

Command Line Utility pretty useless in later project stages

trsh opened this issue · 5 comments

trsh commented

For first run it's OK and useful. Later if I keep adding translatables, I have to do a lot of managing- finding the added translation in default file, copy over to other local files, etc.

A simple addition, that would write to multiple files (all/some locales), and do not overwrite edited stuff would make the day.

Sorry for the late response. Yes it would really help. I'll think about this feature.

@trsh

Hi! Just wanted to let you know that I took your criticism to heart and actually ended up creating a new major version of both i18nline and preact-i18nline.

The major changes are:

  • Renamed outputFile to out and made it point to folder src/i18n by default
  • Introduced a new command i18nline index that generates an index file that you can import into your project that automatically implements code splitting and hot reload for you
  • Introduced a new command i18nline synch that I think will be especially helpful for you. What it does is:
    • Generate default.json with default translations using 18nline export in the background
    • Finding any files named '[locale].json' (e.g. 'de.json', 'fr.json' etc) to build a list of supported locales
    • Diffing all the translation files for all supported locales with the defaults, and:
      • Add any missing keys
      • Remove any orphaned keys
    • Generate index.js using i18nline index in the background
  • Improved the docs. It now starts with describing how to set up the project to help you get started.

The idea is that you write/change some code (in a new branch as you should), then run i18nline synch and it updates all translation files for you. It even pre-fills new keys with the default translations. You can then easily use some diff tool to compare the new versions of the files with the old versions and it will clearly show you which keys were removed and which were added and you even have the default text right there so the translator can translate it right away. If the translator can run the project, he can even see the app update with the new translations right away when he saves and reloads the page.

I hope you are willing to take version 2 for a spin and give me some feedback. I know I took a while to respond but I'm hoping this new major version can make up for the wait.

trsh commented

@Download great update! This brings this definitely to new level and from the description includes all needed components. But as I waited for this so long, I switched my project to i18next and testing i18nline is some-have out of the scope now. However, when I start a new project, will give this definitely a try. Closing this anyway.

But as I waited for this so long, I switched my project

Yeah I know how that goes...
How is i18next working for you?

trsh commented

pretty OK.