N
Nuxt7mo ago
salomon_.

How to manage 'remote' localization

Hello, In my nuxt 3 app I get content in specified locale (using header) from CMS. So almost every component needs that data. What's the best way to manage it? Fetch that data on server and store in pinia? Or nuxt has an built in api to get cached data and I can use it? Can i18n module helps in my scenario?
4 Replies
Anjjar
Anjjar7mo ago
Hello again, Yes, i18n is exactly what you need. It lets you manage the language data to be displayed to the user. Here's the scenario: a user whose default language is English (EN) uses your application. The application must be able to retrieve data for EN only (retrieving data for all locales will hurt the application performance). Then, if the same user decides to change language, the application will retrieve the corresponding data.
salomon_.
salomon_.OP7mo ago
@Anjjar but usually locale data stored in json files and then utilize by i18n module, how it will be in my case?
Anjjar
Anjjar7mo ago
How does your CMS handle local data?
Sam  K
Sam K7mo ago
hey, take a look at in-component translations https://i18n.nuxtjs.org/docs/guide/per-component-translations
@nuxtjs/i18n
Per-Component Translations
Inline your translation messages within your components.
Want results from more Discord servers?
Add your server