meteor-messageformat
meteor-messageformat copied to clipboard
setlocale issue
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?
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?
we are calling it on the server here i think (meteor method) so I think locale is out-of-context or something.
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.