VulcanJS / Vulcan-Starter

VulcanJS starter repo. Use as a base for your own VulcanJS projects.
MIT License
127 stars 88 forks source link

Example-Forum latest build, VulcanJS 1.12.8, new way of handling localization ? #94

Open adalidda opened 6 years ago

adalidda commented 6 years ago

Hi, In the previous version of Example-Forum/Vulcan (based on meteor 1.6), I have 2 files for the text used in my app: i18n-en.js = english i18n-fr.js = french

then I import these files in my index.js as below: import './i18n-en.js'; import './i18n-fr.js';

then in my settings.json for English, I use "locale": "en",
for French, I use "locale": "fr",

Using above seems not working anymore in the latest version of Example-Forum latest build + VulcanJS 1.12.8, my App doesn't show text in French even if my settings.json use "fr" (still show English).

Seeing this, I check the package vulcan-i18n-fr-fr then I see that the localization file is add on the package.js, like below: api.addFiles([ 'lib/fr_FR.js' ], ['client', 'server']);

Could you confirm that this is the new way of handling localize file in VulcanJS ?

Thank You Adalidda

Apollinaire commented 6 years ago

Hi @adalidda , The I18n in Vulcan was updated at v1.11. You can see the docs here : http://docs.vulcanjs.org/internationalization.html

Seeing this, I check the package vulcan-i18n-fr-fr then I see that the localization file is add on the package.js, like below:

'lib/fr_FR.js'
], ['client', 'server']);

This won't help, it's just importing the files in the module, which your other files are already (through a longer pipeline though)

I don't know myself how to deal with this. It seems that the language is based on the client's locale now, so basically if your browser is not set to French the language will fallback to English by default. The docs probably provide something to handle this, but I have not had time to look into that yet

adalidda commented 6 years ago

Thank You @Apollinaire I will look to the doc in detail.

adalidda commented 6 years ago

After I set the cookies as following: cookies.set('locale', 'fr');

Everything is working fine and my App is now displaying the text in French.

Thank You @Apollinaire

Apollinaire commented 6 years ago

@adalidda could you describe more in detail what you did ?