Skip to content

Commit

Permalink
refactor: remove unused langDir
Browse files Browse the repository at this point in the history
  • Loading branch information
BobbieGoede committed Aug 9, 2023
1 parent 39c0075 commit 17500fa
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 18 deletions.
1 change: 0 additions & 1 deletion src/gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ const debug = createDebug('@nuxtjs/i18n:gen')

export function generateLoaderOptions(
lazy: NonNullable<NuxtI18nOptions['lazy']>,
langDir: NuxtI18nOptions['langDir'],
localesRelativeBase: string,
vueI18nConfigPathInfo: VueI18nConfigPathInfo,
vueI18nConfigPaths: VueI18nConfigPathInfo[],
Expand Down
1 change: 0 additions & 1 deletion src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ export default defineNuxtModule<NuxtI18nOptions>({
getContents: () => {
return generateLoaderOptions(
options.lazy,
options.langDir,
localesRelativeBasePath,
vueI18nConfigPathInfo,
layerVueI18nConfigPaths,
Expand Down
7 changes: 2 additions & 5 deletions src/runtime/plugins/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ export default defineNuxtPlugin(async nuxt => {
differentDomains,
skipSettingLocaleOnNavigate,
lazy,
langDir,
routesNameSeparator,
defaultLocaleRouteNameSuffix,
strategy,
Expand Down Expand Up @@ -192,8 +191,7 @@ export default defineNuxtPlugin(async nuxt => {
differentDomains,
initial: localeSetup,
skipSettingLocaleOnNavigate,
lazy,
langDir
lazy
})

if (modified && localeSetup) {
Expand Down Expand Up @@ -440,8 +438,7 @@ export default defineNuxtPlugin(async nuxt => {
differentDomains,
initial: localeSetup,
skipSettingLocaleOnNavigate,
lazy,
langDir
lazy
})

if (modified && localeSetup) {
Expand Down
6 changes: 2 additions & 4 deletions src/runtime/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,9 @@ export async function loadAndSetLocale<Context extends NuxtApp = NuxtApp>(
skipSettingLocaleOnNavigate = nuxtI18nOptionsDefault.skipSettingLocaleOnNavigate,
differentDomains = nuxtI18nOptionsDefault.differentDomains,
initial = false,
lazy = false,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
langDir = null
lazy = false
}: Pick<DetectBrowserLanguageOptions, 'useCookie'> &
Pick<NuxtI18nOptions<Context>, 'lazy' | 'langDir' | 'skipSettingLocaleOnNavigate' | 'differentDomains'> & {
Pick<NuxtI18nOptions<Context>, 'lazy' | 'skipSettingLocaleOnNavigate' | 'differentDomains'> & {
initial?: boolean
} = {}
): Promise<[boolean, string]> {
Expand Down
8 changes: 1 addition & 7 deletions test/gen.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ test('basic', async () => {
const { generateLoaderOptions } = await import('../src/gen')
const code = generateLoaderOptions(
false,
'locales',
'..',
NUXT_I18N_VUE_I18N_CONFIG,
[],
Expand All @@ -90,7 +89,6 @@ test('basic', async () => {
test('lazy', () => {
const code = generateLoaderOptions(
true,
'locales',
'..',
NUXT_I18N_VUE_I18N_CONFIG,
[],
Expand All @@ -109,7 +107,6 @@ test('lazy', () => {
test('multiple files', () => {
const code = generateLoaderOptions(
true,
'locales',
'..',
NUXT_I18N_VUE_I18N_CONFIG,
[],
Expand Down Expand Up @@ -142,7 +139,6 @@ test('multiple files', () => {
test('locale file in nested', () => {
const code = generateLoaderOptions(
true,
'locales',
'..',
NUXT_I18N_VUE_I18N_CONFIG,
[],
Expand Down Expand Up @@ -177,7 +173,6 @@ test('locale file in nested', () => {
test('vueI18n option', () => {
const code = generateLoaderOptions(
false,
'locales',
'..',
NUXT_I18N_VUE_I18N_CONFIG,
[
Expand Down Expand Up @@ -211,7 +206,6 @@ test('vueI18n option', () => {
test('toCode: function (arrow)', () => {
const code = generateLoaderOptions(
false,
'locales',
'..',
NUXT_I18N_VUE_I18N_CONFIG,
[],
Expand All @@ -236,7 +230,7 @@ test('toCode: function (arrow)', () => {
})

test('toCode: function (named)', () => {
const code = generateLoaderOptions(false, 'locales', '..', NUXT_I18N_VUE_I18N_CONFIG, [], {
const code = generateLoaderOptions(false, '..', NUXT_I18N_VUE_I18N_CONFIG, [], {
localeCodes: LOCALE_CODES,
nuxtI18nOptions: {
...NUXT_I18N_OPTIONS,
Expand Down

0 comments on commit 17500fa

Please sign in to comment.