GIScience / ors-map-client

Openrouteservice API web SPA client using VueJS, Vuetify and Vue2Leaflet
http://maps.openrouteservice.org
Apache License 2.0
107 stars 32 forks source link

Use translation tool for i18n #290

Open koebi opened 1 year ago

koebi commented 1 year ago

Translations are all over the place, since they mostly live with their fragment. While this structure is in general good and wanted, it means that localization is hard, since dozens of files have to be changed.

Setting up a translation tool like weblate might help with this.

amoncaldas commented 1 year ago

The project is using feature-by-folder design https://github.com/GIScience/ors-map-client#feature-by-folder-design. Please see this https://softwareengineering.stackexchange.com/questions/338597/folder-by-type-or-folder-by-feature and this https://softwareengineering.stackexchange.com/questions/338597/folder-by-type-or-folder-by-feature

If wanted, all the translations can be directly declared, for example for English, here https://github.com/GIScience/ors-map-client/blob/master/src/i18n/translations/en-us/global.js.

On compile time all the translations files are integrated into global.js. I don't see any benefit of having a huge translation file, but it is technically possible, in the current setup. Generally it makes it more difficult to maintain and will break the app feature-by-folder design.

It is also possible to generate a unique json file with all the translations for a given language in development evironment. This file can be useful to be sent to someone who will just provide translations. Just add a console.log(translationObj) at line 24 https://github.com/GIScience/ors-map-client/blob/master/src/i18n/translations/en-us/builder.js#L24

MichaelsJP commented 1 year ago

References #170