I’m using vuejs 3, quasar 2 and vue-i18n for my traductions. how can i use $t or $tc in translation file like this ? i have the error “$tc is not defined” Answer You should be able to do this with “Linked Locale Messages” (https://kazupon.github.io/vue-i18n/guide/messages.html#linked-locale-messages) So with a messages file something like this: You would then do <div>{{ $t(‘message.linked’, 10)
Tag: internationalization
How to enforce i18n locale slugs and achieve i18n consistency upon reload in Next.js?
I’m using next-translate. By default, my routes are recognized as follows: but I’d like to enforce a locale for all paths: Here’s my config: next.config.js i18n.js Note that I also have a lang change component that persists the NEXT_LOCALE cookie. As such, I would expect that when I access /about and my NEXT_LOCALE cookie had previously been set to de,
defaultLocale is not keeping default lang in Next.js i18n
I’m trying to make my default language in Next.js i18n but always is getting “En” as default language called like fallback. And I also get this error: Error: [@formatjs/intl Error MISSING_DATA] Missing locale data for locale: “sq” in Intl.NumberFormat. Using default locale: “en” as fallback Answer Next.js will automatically detect which locale the user prefers based on the Accept-Language header
Next.js router locale issue
I have set up some locales for our app which are uk and us. For the blog we can have either us/blog or just /blog for the uk locale. When I switch to us like so: (locale = “us”) the url gets correctly updated to have us/ prepended. When I switch back to uk using handleRoute (locale= “”), it stays
Language getting detected but translation not working with i18n
I have set up the i18n middleware in my Express Node js server like this: Here is the translation test file: The value of title in English is title and for Malaysian, it’s tajuk As per the express middleware documentation, I’m passing my as the accept-language header , and console.log(req.i18n.language) is correctly printing it. However, console.log(t(‘title’)) is still printing title
I18n-js – is there a way to check if a translation exists or not?
Is there a way to check if a translation exists or not with the library I18n-js? Answer You can use the method lookup(). It returns undefined when the translation does not exist, so you can put it in your conditional. For example:
I18N change language in Next.JS
I have some problems with I18N and NextJS. So I configured my I18N, everything works with default locale, but everything crashes if I want to change locale from local storage. In _app.js I tried to use this function: I have imported: When app is loaded it crashes and give error: I’m using the newest Next.js and I18N What I found
Alternatives to deprecated Webpack’s i18n plugin and loader
I’m working on a TypeScript project that needs to load translations from .json files, the intention is to have a single language file per country. Example: en.json, es.json. Then I should to be able to use the translations inside .ts files with some function like __(‘red’) or as other extensions offer. Then the final compiled .js files should contain all
intl.NumberFormat shows incorrect result for es-ES currency formatting
I expect that output for es-ES and de-DE locale to be identical. (I asked my Spanish colleague to check his salary slip, and he confirms that there is indeed a decimal after thousand) Results: Answer According to the Real Academia EspaƱola, the standard form in Spanish is to separate numbers in groups of three, separated with whitespace, if the number
How to get the weekday names using Intl?
I’d like to display in my i18n-ed app a list of the 7 weekdays: I rely on the Intl global object for formatting date/time but I can’t find an easy way to get only the weekday names. I thought I could add some days to the EPOCH time, to reach the first day of the week, but I’m failing to