-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8e8c741
commit 2a8ba29
Showing
4 changed files
with
33 additions
and
22 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,13 +1,26 @@ | ||
import { getRequestConfig } from 'next-intl/server'; | ||
import { i18nConfig } from 'vitnode-frontend/i18n'; | ||
|
||
export default getRequestConfig(async args => { | ||
const config = await i18nConfig({ | ||
...args, | ||
pathsToMessagesFromPlugins: async ({ plugin, locale }) => { | ||
return import(`@/plugins/${plugin}/langs/${locale}.json`); | ||
}, | ||
}); | ||
export default getRequestConfig(async ({ requestLocale }) => { | ||
// This typically corresponds to the `[locale]` segment | ||
let locale = await requestLocale; | ||
|
||
// Ensure that a valid locale is used | ||
if (!locale) { | ||
locale = 'en'; | ||
} | ||
|
||
return config; | ||
const core = (await import(`@/plugins/core/langs/${locale}.json`)).default; | ||
const admin = (await import(`@/plugins/admin/langs/${locale}.json`)).default; | ||
const welcome = (await import(`@/plugins/welcome/langs/${locale}.json`)) | ||
.default; | ||
|
||
return { | ||
locale, | ||
messages: { | ||
...core, | ||
...admin, | ||
...welcome, | ||
}, | ||
timeZone: 'UTC', | ||
}; | ||
}); |
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