Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: v-t directive SSR #2946

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"dependencies": {
"@intlify/h3": "^0.5.0",
"@intlify/shared": "^9.9.0",
"@intlify/unplugin-vue-i18n": "^3.0.1",
"@intlify/unplugin-vue-i18n": "5.0.0-beta.3",
"@intlify/utils": "^0.12.0",
"@miyaneee/rollup-plugin-json5": "^1.1.2",
"@nuxt/kit": "^3.10.3",
Expand Down
164 changes: 137 additions & 27 deletions pnpm-lock.yaml

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

12 changes: 12 additions & 0 deletions specs/basic_usage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,18 @@ describe('basic usage', async () => {
expect(await page.url()).include('/user/profile?foo=1')
})

test('`v-t` directive SSR', async () => {
const pageHTML = await $fetch('/')
const pageDOM = getDom(pageHTML)
expect(pageDOM.querySelector('#t-directive #t-directive-path')?.textContent).toEqual('Welcome')
expect(pageDOM.querySelector('#t-directive #t-directive-argument')?.textContent).toEqual('Hello directive!')

const pageHTMLFrench = await $fetch('/fr')
const pageDOMFrench = getDom(pageHTMLFrench)
expect(pageDOMFrench.querySelector('#t-directive #t-directive-path')?.textContent).toEqual('Bienvenue')
expect(pageDOMFrench.querySelector('#t-directive #t-directive-argument')?.textContent).toEqual('Bonjour directive!')
})

test('nuxt context extension', async () => {
const { page } = await renderPage('/nuxt-context-extension')

Expand Down
6 changes: 4 additions & 2 deletions specs/fixtures/basic_usage/config/i18n.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ export default defineI18nConfig(() => {
snakeCaseText: "@.snakeCase:{'aboutSite'}",
pascalCaseText: "@.pascalCase:{'aboutSite'}",
hello: 'Bonjour le monde!',
modifier: "@.snakeCase:{'hello'}"
modifier: "@.snakeCase:{'hello'}",
helloMessage: 'Bonjour {name}!'
},
en: {
home: 'Homepage',
Expand All @@ -28,7 +29,8 @@ export default defineI18nConfig(() => {
hello: 'Hello world!',
modifier: "@.snakeCase:{'hello'}",
fallbackMessage: 'This is the fallback message!',
runtimeKey: config.public.runtimeValue
runtimeKey: config.public.runtimeValue,
helloMessage: 'Hello {name}!'
},
nl: {
aboutSite: 'Over deze site',
Expand Down
Loading
Loading