Skip to content

Commit 93f1aa9

Browse files
committed
fix
1 parent 2cfb559 commit 93f1aa9

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

packages/vue-i18n-core/src/i18n.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ export function useI18n<
773773

774774
i18nInternal.__setInstance(instance, composer)
775775
} else {
776-
if (scope === 'local') {
776+
if (__DEV__ && scope === 'local') {
777777
throw createI18nError(I18nErrorCodes.DUPLICATE_USE_I18N_CALLING)
778778
}
779779
}

packages/vue-i18n-core/test/__snapshots__/i18n.test.ts.snap

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,3 @@ exports[`slot reactivity > composable > ja 1`] = `"<h1>Root</h1><form><select><o
77
exports[`slot reactivity > legacy > en 1`] = `"<h1>Root</h1><form><select><option value="en">en</option><option value="ja">ja</option></select></form><p>hello!</p><div class="child"><h1>Child</h1><form><select><option value="en">en</option><option value="ja">ja</option></select></form><p>hello!</p><div class="sub-child"><h1>Sub Child</h1><form><select><option value="en">en</option><option value="ja">ja</option></select></form><p>hello!</p></div> $t inside of slot <p>hello!</p> i18n-t inside of slot <p>hello!</p></div>"`;
88

99
exports[`slot reactivity > legacy > ja 1`] = `"<h1>Root</h1><form><select><option value="en">en</option><option value="ja">ja</option></select></form><p>こんにちは!</p><div class="child"><h1>Child</h1><form><select><option value="en">en</option><option value="ja">ja</option></select></form><p>こんにちは!</p><div class="sub-child"><h1>Sub Child</h1><form><select><option value="en">en</option><option value="ja">ja</option></select></form><p>こんにちは!</p></div> $t inside of slot <p>こんにちは!</p> i18n-t inside of slot <p>こんにちは!</p></div>"`;
10-
11-
exports[`useI18n > Duplicate \`useI18n\` calling by local scope. Please don't call it on local scope 1`] = `"<h1>Root</h1><form><select><option value="en">en</option><option value="ja">ja</option></select></form><p>hi!</p><p></p><p>Duplicate \`useI18n\` calling by local scope. Please don't call it on local scope</p>"`;

packages/vue-i18n-core/test/i18n.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -679,8 +679,8 @@ describe('useI18n', () => {
679679
<p>{{ error }}</p>
680680
`
681681
})
682-
const { html } = await mount(App, i18n as any) // eslint-disable-line @typescript-eslint/no-explicit-any
683-
expect(html()).toMatchSnapshot()
682+
await mount(App, i18n as any) // eslint-disable-line @typescript-eslint/no-explicit-any
683+
expect(error).toBe(errorMessages[I18nErrorCodes.DUPLICATE_USE_I18N_CALLING])
684684
})
685685
})
686686

0 commit comments

Comments
 (0)