forked from nuxt-modules/i18n
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: confirm runtime config can be used in vue i18n config file
- Loading branch information
1 parent
178aff0
commit 52fefba
Showing
4 changed files
with
49 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,38 @@ | ||
export default defineI18nConfig(() => ({ | ||
legacy: false, | ||
locale: 'en', | ||
messages: { | ||
fr: { | ||
welcome: 'Bienvenue', | ||
home: 'Accueil', | ||
profile: 'Profil', | ||
aboutSite: 'À propos de ce site', | ||
snakeCaseText: "@.snakeCase:{'aboutSite'}", | ||
pascalCaseText: "@.pascalCase:{'aboutSite'}", | ||
hello: 'Bonjour le monde!', | ||
modifier: "@.snakeCase:{'hello'}" | ||
export default defineI18nConfig(() => { | ||
const config = useRuntimeConfig() | ||
|
||
return { | ||
legacy: false, | ||
locale: 'en', | ||
messages: { | ||
fr: { | ||
welcome: 'Bienvenue', | ||
home: 'Accueil', | ||
profile: 'Profil', | ||
aboutSite: 'À propos de ce site', | ||
snakeCaseText: "@.snakeCase:{'aboutSite'}", | ||
pascalCaseText: "@.pascalCase:{'aboutSite'}", | ||
hello: 'Bonjour le monde!', | ||
modifier: "@.snakeCase:{'hello'}" | ||
}, | ||
en: { | ||
welcome: 'Welcome', | ||
home: 'Homepage', | ||
profile: 'Profile', | ||
hello: 'Hello world!', | ||
modifier: "@.snakeCase:{'hello'}", | ||
fallbackMessage: 'This is the fallback message!', | ||
runtimeKey: config.public.runtimeValue | ||
}, | ||
nl: { | ||
aboutSite: 'Over deze site', | ||
snakeCaseText: "@.snakeCase:{'aboutSite'}", | ||
pascalCaseText: "@.pascalCase:{'aboutSite'}" | ||
} | ||
}, | ||
en: { | ||
welcome: 'Welcome', | ||
home: 'Homepage', | ||
profile: 'Profile', | ||
hello: 'Hello world!', | ||
modifier: "@.snakeCase:{'hello'}", | ||
fallbackMessage: 'This is the fallback message!' | ||
}, | ||
nl: { | ||
aboutSite: 'Over deze site', | ||
snakeCaseText: "@.snakeCase:{'aboutSite'}", | ||
pascalCaseText: "@.pascalCase:{'aboutSite'}" | ||
modifiers: { | ||
// @ts-ignore | ||
snakeCase: (str: string) => str.split(' ').join('-') | ||
} | ||
}, | ||
modifiers: { | ||
// @ts-ignore | ||
snakeCase: (str: string) => str.split(' ').join('-') | ||
} | ||
})) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters