Skip to content

Commit

Permalink
nuxt-i18n is dead; love live @nuxtjs/i18n
Browse files Browse the repository at this point in the history
Sets en-GB as the default English (en) locale
Sets zh-Hans as the default Chinese (zh) locale
  • Loading branch information
BobChao87 committed Dec 10, 2021
1 parent 830f97b commit 60ac9ba
Show file tree
Hide file tree
Showing 6 changed files with 168 additions and 148 deletions.
2 changes: 1 addition & 1 deletion components/widget/LanguagePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<script lang="ts">
import Vue from 'vue';
/* eslint-disable-next-line import/named */ /* ESLint has trouble with this import... */
import { LocaleObject } from 'nuxt-i18n';
import { LocaleObject } from '@nuxtjs/i18n';
export default Vue.extend({
data() {
Expand Down
6 changes: 2 additions & 4 deletions configs/i18n.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const locales = [
{ code: 'da', iso: 'da', file: 'da.json', nativeName: 'dansk' },
{ code: 'de', iso: 'de', file: 'de.json', nativeName: 'Deutsch' },
{ code: 'el', iso: 'el', file: 'el.json', nativeName: 'Ελληνικά' },
{ code: 'en-GB', iso: 'en-GB', file: 'en.json', nativeName: 'English' },
{ code: 'en-GB', iso: 'en-GB', file: 'en.json', nativeName: 'English', isCatchallLocale: true },
{ code: 'en-US', iso: 'en-US', file: 'en.json', nativeName: 'English (United States)' },
{ code: 'es', iso: 'es', file: 'es.json', nativeName: 'español' },
{ code: 'fi', iso: 'fi', file: 'fi.json', nativeName: 'suomi' },
Expand All @@ -20,7 +20,7 @@ export const locales = [
{ code: 'pt-BR', iso: 'pt-BR', file: 'pt_BR.json', nativeName: 'Português (Brazil)' },
{ code: 'ru', iso: 'ru', file: 'ru.json', nativeName: 'русский язык' },
{ code: 'tr', iso: 'tr', file: 'tr.json', nativeName: 'Türkçe' },
{ code: 'zh-Hans', iso: 'zh', file: 'zh_Hans.json', nativeName: '中文 (简体中文)' },
{ code: 'zh-Hans', iso: 'zh', file: 'zh_Hans.json', nativeName: '中文 (简体中文)', isCatchallLocale: true },
{ code: 'zh-Hant-HK', iso: 'zh-HK', file: 'zh_Hant_HK.json', nativeName: '中文 (香港)' },
];

Expand All @@ -43,7 +43,5 @@ export function i18nConfig() {
vueI18nLoader: true,
// This import takes places inside webpack from a different PWD, so we need the ~ pathing
vueI18n: '~/configs/vue-i18n.config.js',
// Performant language-based SEO: https://i18n.nuxtjs.org/seo#improving-performance
seo: false,
};
}
5 changes: 4 additions & 1 deletion layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ import { MetaInfo } from 'vue-meta';
export default Vue.extend({
head(): Required<Pick<MetaInfo, 'htmlAttrs'|'link'|'meta'>> {
return this.$nuxtI18nHead({ addSeoAttributes: true });
return this.$nuxtI18nHead({
addDirAttribute: true,
addSeoAttributes: true,
});
},
watch: {
$route(): void {
Expand Down
299 changes: 159 additions & 140 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 60ac9ba

Please sign in to comment.