Skip to content
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

Troubleshooting docs, Q&A, cache issues, etc. #240

Open
tab00 opened this issue Jul 15, 2016 · 7 comments
Open

Troubleshooting docs, Q&A, cache issues, etc. #240

tab00 opened this issue Jul 15, 2016 · 7 comments
Milestone

Comments

@tab00
Copy link

tab00 commented Jul 15, 2016

I wanted to change the language code (as seen on the /translate page) because I had realized that the code that I had originally entered was wrong. So I tried to update the following collections:

mfMeta (_id field, by deleting the document and adding a new one with the correct value)
mfRevisions (lang field)
mfStrings (lang field)

The /translate page then showed the correct code and all the translations were intact too.

However msgfmt.setLocale() no longer changed the texts, even though the locale does successfully change, verified by console.log(msgfmt.locale()) showing the correct value.

So how can I properly change the originally entered language code (without having to start over with a new language code and manually enter each translation one by one again)?

@gadicc
Copy link
Owner

gadicc commented Jul 15, 2016

That all sounds right, good job! There is a bunch of stuff that is configured only when Meteor loads though, so you'll have to restart it. Before doing that, make sure to delete / move (as a backup) your server/mfAll.js to make sure the original language code isn't restored.

(Another potential alternative could be do delete all mf* Collections and do the change in the mfAll.js file. You can also always verify what's in memory with meteor shell and inspecting the msgfmt key, particularly msgfmt.strings).

@tab00
Copy link
Author

tab00 commented Jul 15, 2016

I had actually tried both approaches before creating the issue, but neither had worked. I did restart Meteor (many times).

I've just tried the mfAll.js approach again, and I still get the same problem - changing the locale using msgfmt.setLocale() does not change the texts to the new language on any page, even though msgfmt.locale() does correctly return the new locale afterward.

in meteor shell, msgfmt.strings does show the correct new language code (in addition to en).

So could there be something that I've missed that also needs to be changed?

@gadicc
Copy link
Owner

gadicc commented Jul 15, 2016

Mmm. I think this might be a caching issue then. You can check by typing msgfmt.resetStorage() in your browser console followed by Ctrl-Shift-R. I think to fix this for all users you'd need to, in mfAll.js (or mfMeta table), change the updatedAt "meta" attribute to a later time (even by 1ms). In mfAll.js, the "meta" info immediately follows all the strings for each language.

In case that still doesn't work, is there a staging site anywhere I can take a look at? Otherwise view-source on your site and check both the injected list of languages and their update times, and the network request that's sent to update the local cache (in local storage).

Hope this helps! Let me know.

@tab00
Copy link
Author

tab00 commented Jul 15, 2016

I've just cleared all my browsing data from Chrome Browser and it appears that solved my problem. I should have tried that before. I'm feeling silly now. Thank you anyway for your time (and for your great package).

@tab00 tab00 closed this as completed Jul 15, 2016
@gadicc
Copy link
Owner

gadicc commented Jul 15, 2016

I'm really happy so many people are still getting so much from a pre-release with little documentation, I wish I had more time to work on this :/

If your site is already live, you might still need to update the updatedAt metas to force the change down to existing users.

@1u
Copy link
Contributor

1u commented Jul 15, 2016

I've just cleared all my browsing data from Chrome Browser and it appears that solved my problem.

Yes. That was an annoying one, right? I had the exact same problem last year (except that it was the firefox-cache:). Just saw this one, if only I had waken up earlier... :)

@gadicc gadicc added this to the v2.1 milestone Jul 15, 2016
@gadicc gadicc changed the title Couldn't change language code Troubleshooting docs, Q&A, cache issues, etc. Jul 15, 2016
@gadicc
Copy link
Owner

gadicc commented Jul 15, 2016

Feel like this should be covered in the docs :)

@gadicc gadicc reopened this Jul 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants