-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
👽 [#724] Update react-intl addon init code to not use require
require doesn't exist in Vite, but import.meta can be used instead.
- Loading branch information
1 parent
f3f66d3
commit 9d553e9
Showing
3 changed files
with
19 additions
and
16 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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const locales = ['nl', 'en']; | ||
|
||
const messages = {}; | ||
const importMessages = import.meta.glob('../src/i18n/compiled/*.json', {eager: true}); | ||
|
||
// Populate the messages object | ||
locales.forEach(lang => { | ||
messages[lang] = importMessages[`../src/i18n/compiled/${lang}.json`]; | ||
}); | ||
|
||
const formats = {}; // optional, if you have any formats | ||
|
||
export const reactIntl = { | ||
defaultLocale: 'nl', | ||
locales, | ||
messages, | ||
formats, | ||
}; |