{"action":"created","issue":{"url":"https://api.github.com/repos/vazco/meteor-universe-i18n/issues/17","repository_url":"https://api.github.com/repos/vazco/meteor-universe-i18n","labels_url":"https://api.github.com/repos/vazco/meteor-universe-i18n/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/vazco/meteor-universe-i18n/issues/17/comments","events_url":"https://api.github.com/repos/vazco/meteor-universe-i18n/issues/17/events","html_url":"https://github.com/vazco/meteor-universe-i18n/issues/17","id":139256426,"number":17,"title":"Loading","user":{"login":"nicolamr","id":574453,"avatar_url":"https://avatars.githubusercontent.com/u/574453?v=3","gravatar_id":"","url":"https://api.github.com/users/nicolamr","html_url":"https://github.com/nicolamr","followers_url":"https://api.github.com/users/nicolamr/followers","following_url":"https://api.github.com/users/nicolamr/following{/other_user}","gists_url":"https://api.github.com/users/nicolamr/gists{/gist_id}","starred_url":"https://api.github.com/users/nicolamr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicolamr/subscriptions","organizations_url":"https://api.github.com/users/nicolamr/orgs","repos_url":"https://api.github.com/users/nicolamr/repos","events_url":"https://api.github.com/users/nicolamr/events{/privacy}","received_events_url":"https://api.github.com/users/nicolamr/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2016-03-08T11:45:03Z","updated_at":"2016-03-21T09:07:20Z","closed_at":"2016-03-08T19:56:01Z","body":"Sometimes the UI is rendered before the translations (or the translations of a specific language) are loaded. This results in the page being only partially translated.\r\n\r\nHow do I make sure all translations are loaded before rendering a react component? Can I depend reactively on the translations?"},"comment":{"url":"https://api.github.com/repos/vazco/meteor-universe-i18n/issues/comments/199183408","html_url":"https://github.com/vazco/meteor-universe-i18n/issues/17#issuecomment-199183408","issue_url":"https://api.github.com/repos/vazco/meteor-universe-i18n/issues/17","id":199183408,"user":{"login":"nicolamr","id":574453,"avatar_url":"https://avatars.githubusercontent.com/u/574453?v=3","gravatar_id":"","url":"https://api.github.com/users/nicolamr","html_url":"https://github.com/nicolamr","followers_url":"https://api.github.com/users/nicolamr/followers","following_url":"https://api.github.com/users/nicolamr/following{/other_user}","gists_url":"https://api.github.com/users/nicolamr/gists{/gist_id}","starred_url":"https://api.github.com/users/nicolamr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicolamr/subscriptions","organizations_url":"https://api.github.com/users/nicolamr/orgs","repos_url":"https://api.github.com/users/nicolamr/repos","events_url":"https://api.github.com/users/nicolamr/events{/privacy}","received_events_url":"https://api.github.com/users/nicolamr/received_events","type":"User","site_admin":false},"created_at":"2016-03-21T09:07:20Z","updated_at":"2016-03-21T09:07:20Z","body":"Thanks a lot! Now there seems to be a bug (or the code behaves in a way different than expected):\r\n\r\n    i18n.onChangeLocale ->\r\n        console.log i18n.isLoaded()\r\n\r\nlogs false.\r\n\r\nAnd even if I use UNIVERSE_I18N_LOCALES='de-DE'\r\n\r\ni18n.isLoaded() is false at the beginning, even though exploring the object  i18n._translations[\"de-DE\"] is actually set.\r\n\r\nBased on this, my current version of the component is the following:\r\n\r\n\tTemplates.Translations = React.createClass\r\n\t\tgetInitialState: ->\r\n\t\t\ttranslationsReady: i18n.isLoaded() or i18n._translations[i18n.getLocale()]?\r\n\t\tcomponentDidMount: ->\r\n\t\t\tself = @\r\n\t\t\ti18n.onChangeLocale ->\r\n\t\t\t\tself.setState\r\n\t\t\t\t\ttranslationsReady: true\r\n\t\trender: ->\r\n\t\t\tif @state.translationsReady\r\n\t\t\t\t@props.children[0]\r\n\t\t\telse\r\n\t\t\t\t@props.children[1]"}}