Skip to content

Commit

Permalink
* get HMR working for locales
Browse files Browse the repository at this point in the history
  • Loading branch information
ConorMurphy21 committed Feb 18, 2024
1 parent 662dbe4 commit f4cc222
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion client/src/locales/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,19 @@ const messages = {
}
};

export default createI18n<[typeof en], 'en'>({
const i18n = createI18n<[typeof en], 'en'>({
locale: 'en',
fallbackLocale: 'en',
legacy: false,
messages
});

export default i18n;

if (import.meta.hot) {
import.meta.hot.accept('./en.ts', (newEn) => {
if (newEn) {
i18n.global.setLocaleMessage('en', newEn.default);
}
});
}

0 comments on commit f4cc222

Please sign in to comment.