refactor: global shared state and function (#79)

* refactor: expose i18n instance

* feat: add global app utility function

* refactor: use global utility function

* refactor: avoid undefined when use outside vue

refactor: avoid undefined when use outside vue

* refactor: remove dup code and use util

* refactor: auto fetch option when use store
This commit is contained in:
Methapon Metanipat 2024-11-21 11:55:44 +07:00 committed by GitHub
parent aa79a4ef7d
commit b0136bba4d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 136 additions and 216 deletions

View file

@ -21,13 +21,16 @@ declare module 'vue-i18n' {
}
/* eslint-enable @typescript-eslint/no-empty-interface */
export default boot(({ app }) => {
const i18n = createI18n({
locale: 'tha',
legacy: false,
messages,
});
export const i18n = createI18n({
locale: 'tha',
legacy: false,
messages: {
'en-US': {},
...messages,
},
});
export default boot(({ app }) => {
// Set i18n instance on app
app.use(i18n);
});