meteor-messageformat icon indicating copy to clipboard operation
meteor-messageformat copied to clipboard

setlocale issue

Open Maxhodges opened this issue 8 years ago • 3 comments

I get lots of these warnings with the latest version of msgfmt

W20161211-01:37:19.037(9)? (STDERR) 2016-12-11 01:37:11.532 warn:  [msgfmt]  [Q] You called mf() with the key 'order_status_client_authorized' outside of a method/publish and without specifying a locale, defaulting to native (en)

I tried to change lines like this:

Order.statusForClient[Order.status.AUTHORIZED] = mf('order_status_client_authorized', 'UNDER REVIEW');

to this:

Order.statusForClient[Order.status.AUTHORIZED] = mf('order_status_client_authorized', 'UNDER REVIEW', null, 'en');

But it still shows up in as a warning.

Any tips?

Maxhodges avatar Dec 10 '16 16:12 Maxhodges

That is... surprising. The function looks like this:

function mf(key, params, message, locale) {
   if (!locale) {  // 1st line!
            ...
            log.warn("You called mf() with the key '" + key...);
            ...
   }
   ...
}

Is there any chance you're calling it in more than one place?

gadicc avatar Dec 12 '16 08:12 gadicc

we are calling it on the server here i think (meteor method) so I think locale is out-of-context or something.

Maxhodges avatar Dec 12 '16 10:12 Maxhodges

Oh I was referring to the fact that even after adding the locale parameter you still get the warning... it shouldn't be possible :) So was wondering if you're running a similar step with the same key elsewhere.

If you just meant you get the warning inside a method without specifying the locale, which should be fine, Meteor might have changed something around DDP and I'll need to take a look.

gadicc avatar Dec 12 '16 12:12 gadicc