tolgee-js
tolgee-js copied to clipboard
Some localized strings are not shown properly on production, but they look just fine locally
Recently, we faced a problem: some of our strings did not look like they had to.
This is what it looks like on production:
This is what it has to be (we have it locally):
As you can see, only some of them are not displayed correctly while others are just fine. Honestly, I have no idea why it looks like this
Hello! Thanks for reporting. Can you please share more about your stack? Are you using Tolgee JS SDK?
Hello! Thanks for reporting. Can you please share more about your stack? Are you using Tolgee JS SDK?
Hello! Thank you for your reply. We use Tolgee i18n library for React – npm i @tolgee/react
Oh, then this has to be trasferred to tolgee-js repository. Anyway, we will need more information about your issue. @stepan662
Here is some demonstration:
https://github.com/tolgee/tolgee-js/assets/44207160/2fcb4ea8-254c-4125-8f7a-311eac964d89
Are you using Tolgee Cloud or Self-hosted version? I guess this might happen due to using structured export. How are you getting the translations to production?
We are using Tolgee Cloud, but we are planning to move to Self-hosted version in the near future. File with translations are downloaded during the building process of production
Can you please share how exactly you're exporting the data in the build process, including the code?
During the building process of production the translations are fetched using this command:
"cd public/i18n && curl https://app.tolgee.io/v2/projects/export -H \"X-API-Key: ${VITE_TOLGEE_API_KEY}\" | jar xv && cd ../.."
Hey, could you also share the Tolgee initialization?
Hey, could you also share the Tolgee initialization?
const tolgee = Tolgee()
.use(DevTools())
.use(FormatIcu())
.use(BackendFetch())
.init({
language: getLanguage(),
fallbackLanguage: "en",
apiUrl: import.meta.env.VITE_TOLGEE_API_URL,
apiKey: import.meta.env.VITE_TOLGEE_API_KEY,
})
Hmm, that looks OK 🙁 One other thing you can debug is to check how is the tolgee cache looking after you load the data. If you add this piece, it should dump the cache content to the console, so we can check if anything is wrong there.
tolgee.on('initialLoad', () => {
console.log(tolgee.getAllRecords());
});
Any updates @vadimkalaida?
Any updates @vadimkalaida?
Just moved from hosted Tolgee, and everything seems fine now
OK, thanks for reporting. :)