-
Notifications
You must be signed in to change notification settings - Fork 22
[V2] trouble with msgfmt.setLocale #167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
That's weird! What does "console.log(msgfmt.setLocale)" show? |
Also, that's on the client, right? You can't setLocale on the server, since generally you want the result to depend on the client's locale... msgfmt usually picks this up automatically (in methods & public functions) so no need to set by hand. |
That's weird, there it's defined but returning a different module? What else is coming up your console? Can you show the full output including all debug messages? |
sorry my last post was a mistake (was from localhost) you can see the issue here on staging |
it's weird. I only refreshed the browser and now it's not generating that error. But after I set, it's reads back the wrong locale
|
gonna try and deploy again |
Slick looking site! Sorry, the console.log output was actually ok (where it returns the logging stuff). It could definitely return something more useful but it's not a bug. The issue seems to be that the 'jp' locale doesn't exist on that site (you can see immediately from the top of source of the page). Did you save mfAll.js from the /translate page before deploying? (or are you doing crowd translation?) |
I wanted to deploy to staging so that a Chinese staff member can add the translations. Then we'll move the mfAll.js from staging to production. is that a reasonable plan? Once it's on production do we need to edit any translations on the staging site and copy to production forever? or is there a way to lock-down the translation tool or something? Not sure what is the best practice. We haven't gotten this far before ;) |
Mazel tov! Hehe. Yeah the v1 docs are still relevant for security, see http://messageformat.meteor.com/docs#security. You just use Meteor-inspired But it sounds like you've already done some jp translations before, so where are they? :) |
Btw, I can't recall which issue it was now, but next on my list is some improvements on the translation UI, for sort order etc. |
i've renamed the keys a few times, so there is a lot of junk in the database. When keys are removed I see they are 'marked for delete'. How do you actually clean them out? Do I just need to purge the mfAll.js file AND delete the database collection? The tool issues were documented here Thanks! |
Umm, yeah, for now. By the final there will be tools to help with these kinds of things (you could just leave them in until then I guess). IIRC deleted strings already shouldn't be served to the client, but we were trying to decide exactly how far to make use of them, e.g. should translations depending on deleted strings also be deleted, be shown as being deleted (because their dependency was deleted), and maybe even show when this happened and by who. Btw, some of those issues you point to should be fixed by now? Can you confirm? |
is the code for your messageformat examples app in a repo? Maybe I could search that code for EDIT: ah I see it's not locked down! |
I tried to just slap in some course security permissions for starters
oddly it runs locally but not when deployed
|
maybe the security docs are wrong? should be |
is this the right idea? unfortunately none of my console.log statements are running so I guess we still got something wrong if (Meteor.isClient) {
mfPkg.webUI.allow({
insert: function () {
console.log('allow mf client');
return Users.isStaff(Meteor.userId());
}, update: function () {
console.log('allow mf client');
return Users.isStaff(Meteor.userId());
}, remove: function () {
console.log('allow mf client');
return Users.isStaff(Meteor.userId());
},
});
} else {
mfPkg.webUI.allow({
insert: function (userId) {
console.log('allow mf svr');
return Users.isStaff(userId);
}, update: function (userId) {
console.log('allow mf client');
return Users.isStaff(userId);
}, remove: function (userId) {
console.log('allow mf client');
return Users.isStaff(userId);
},
});
} |
I ran meteor update but msgfmt didn't appear in the list of updated packages. Did you deploy? |
|
Oh wow, I'm really behind, sorry! :(
Re versions, yes, unfortunately the bad side about pre release packages in Meteor is that they don't update automatically. It kind of makes sense though since things are more likely to break without warning. These are all the latest versions:
You need to just e.g. |
Thanks sir! btw how do I know when you've released a new preview (and what the name will be)? I don't see this info in atmosphere . . . Cheers! |
Yeah it's a bit difficult atm with the preview releases :( But at least you know nothing will break on a "meteor upgrade". In the issues now, any time I refer I do a new release that affects that issue, I'll tag it, e.g. see the bottom of #152 for the hint, or just the list of commits at https://github.com/gadicc/meteor-messageformat/commits/v2. Obviously this is not ideal and will be a lot better when the final release is out, but I think it's important to be clear now that we're not "release quality", which should include, e.g. https://github.com/gadicc/meteor-messageformat/issues?q=is%3Aopen+is%3Aissue+milestone%3Av2 (thankfully many of those are partially solved already). |
Use msgfmt.setLocale(locale) to set the locale.
you sure?
The text was updated successfully, but these errors were encountered: