gadicc / meteor-messageformat

MessageFormat i18n support for Meteor, with reactive templates
54 stars 22 forks source link

Forcing same language for all users. #257

Open aviavia opened 7 years ago

aviavia commented 7 years ago

Hi, currently the translation looks for logged in users, the "locale" value at the users collection and translates according to it. How do I force it to display only Hebrew? My settings at the moment are: //config.js msgfmt.init('en', { sendPolicy: 'current' }); //settings.json "msgfmt": { "native": "en", "locales": ["he"], "logLevel": "debug" } Thanks, Avi.

aviavia commented 7 years ago

any comment anyone? Thanks.

gadicc commented 7 years ago

Hey @aviavia. Do you think this is the same as #249? I think the simplest way for now is to just add msgfmt.setLocale('he') in the client code (you could probably do it right after msgfmt.init).

aviavia commented 7 years ago

Great, thanks, I'll give it a try.

aviavia commented 7 years ago

I get this error: msgfmt.setLocale is not a function.

gadicc commented 7 years ago

Oh, I guess if you're doing it straight after msgfmt.init(), you probably have that in an isomorphic file, so you'd need some extra code to keep it just on the client, i.e.

if (Meteor.isClient)
  msgfmt.setLocale('he');
aviavia commented 7 years ago

Cool, now it's working. Will check tomorrow if it's ok inside cordova....Thanks!

gadicc commented 7 years ago

Great!