Vue.js / Nuxt.js

Nuxt Internationalization

i18n module, translations, locale detection, route localization, language switching, multilingual SEO

18 면접 질문·
Senior
1

What does the @nuxtjs/i18n module bring to a Nuxt application?

답변

The @nuxtjs/i18n module integrates vue-i18n into Nuxt and adds framework-specific features like automatic routing per locale, browser language detection, multilingual SEO, and automatic generation of localized routes. It significantly simplifies setting up a multilingual application by automatically handling complex technical aspects like redirects, alternate meta tags, and lazy loading of translations.

2

Which configuration allows defining the default locale of a Nuxt i18n application?

답변

The defaultLocale property in the i18n configuration defines the default language used when no specific locale is detected or requested. This locale serves as a fallback and is used for the site root if the routing strategy allows it. It must correspond to one of the codes defined in the locales array. This is a fundamental parameter that ensures the application always has a functional reference language.

3

How to access translations in a Vue component with @nuxtjs/i18n?

답변

The useI18n composable provided by @nuxtjs/i18n exposes the t function which allows accessing translations defined in locale files. This function accepts a translation key and optional parameters for interpolation. This is the recommended method in Nuxt 3 with the Composition API, replacing the old this.$t syntax. The composable also provides access to other features like locale, locales, and setLocale to dynamically manage languages.

4

How to dynamically change the active locale in a Nuxt i18n application?

5

What is the difference between prefix_except_default and prefix routing strategies?

+15 면접 질문

다음 면접을 위해 Vue.js / Nuxt.js을 마스터하세요

모든 질문, flashcards, 기술 테스트, 코드 리뷰 연습, 면접 시뮬레이터에 접근하세요.

무료로 시작하기