DockYard / ember-i18n-to-intl-migrator

Migrate ember-i18n to ember-intl
MIT License
21 stars 9 forks source link

add support for dot notation #22

Open jelhan opened 4 years ago

jelhan commented 4 years ago
snewcomer commented 4 years ago

@jelhan Phenomenal! I'm guessing you have tested this out on your own app(s) and it worked?

jelhan commented 4 years ago

I tested mostly with the data in dummy/ directory. If run these steps to ensure that actual data and expected data are the same:

cd dummy
node ../bin/ember-i18n-intl-migrator.js --type=yaml
git status

Maybe we should setup TravisCI to run yarn test and something similar to instructions above? Could provide in another pull request if you like.

I've also tested with https://github.com/jelhan/croodle, which I need this for. But wasn't yet able to fully test cause some addition transformations need to be done manually (e.g. missing support for value invocation with 3-curlies to skip HTML escaping). Feel free to wait with merging this one until I could confirm that it helped me with the real-world scenario.

snewcomer commented 4 years ago

Ok I'll wait for you to test on your real world scenario!

jelhan commented 4 years ago

Was able to migrate my translations. Faced an edge case that I needed to fix manually:

export default {
  'foo': 'parent',
  'foo.bar': 'child',
}

This can not be transformed to YAML or nested JSON objects as the value of foo should be a string ("parent") and an object ({ bar: 'child' }) at the same time. The codemod does not warn in such a case. To be honest I was to lazy to add such a warning. I don't expect many people to use this codemod as hopefully most apps already migrated.

Ready to be merged from my side.