dannyconnell / quasalang

Generate Quasar i18n language files from a CSV file
38 stars 14 forks source link

Roadmap ideas and Attribution issue #2

Open tohagan opened 3 years ago

tohagan commented 3 years ago

Hi Danny ... I watched your video and this is a great addition to the Quasar community. Well done!

I've tackled this problem in a slightly different way so I though I'd share what I did and learned in case its of interest to your future roadmap.

Ideas

I've created an app that auto translates JSON files using a cloud translation service. My JSON object translation engine can specify which key values are translated. String values can contain i18n fields or HTML tags that are not translated . Instead of comments to break up sections I just use a nested JSON object for each feature area. I find that nested arrays can be handy for creating things like static QSelect options or QTabs lists. I also merge in a separate language selector list where language names have been previously auto translated with native language names untranslated. So far the translation quality has been ok (according to my reviewers) but my source JSON file can contain rules that override translation for specific languages if I need to. A special key defines an array of output locales so adding a new language is very easy to do. The Quasar app I originally wrote for this takes about 25 seconds to generate its 50 language translations.

One issue I've not yet resolved is that I found the Google Translation API can randomly return different translations each time you run it so eventually I'll attempt to fix this by only translating keys that have changed by caching past results. The downside of this is that automated translation works best when it has more context so smaller translation requests may not be as accurate.

Obviously there are pros and cons of our different approaches. Your approach of using a CSV as the primary source is nice and simple to work with (KISS) and you can see the translations side by side which is likely much simpler for translators to assist you and you're in full control of the process.

Attribution

One gotcha I only recently discovered is that Google Translate requires attribution in your web site or app. Ouch! So I'm planning to switch to using Azure as they only recommend attribution and they have better support for locales like French (France vs Canada), Portuguese (Portugal vs Brazil), Cantonese and Kurdish (Central vs Northern).