jws-frontend/src/boot/i18n.ts

39 lines
1.1 KiB
TypeScript
Raw Normal View History

2025-03-26 11:51:27 +07:00
import { defineBoot } from '#q-app/wrappers';
2024-04-02 11:02:16 +07:00
import { createI18n } from 'vue-i18n';
import messages from 'src/i18n';
2025-04-04 11:27:51 +07:00
import { Lang } from 'src/utils/ui';
2024-04-02 11:02:16 +07:00
export type MessageLanguages = keyof typeof messages;
2024-08-26 16:24:08 +07:00
// Type-define 'eng' as the master schema for the resource
export type MessageSchema = (typeof messages)['eng'];
2024-04-02 11:02:16 +07:00
// See https://vue-i18n.intlify.dev/guide/advanced/typescript.html#global-resource-schema-type-definition
/* eslint-disable @typescript-eslint/no-empty-interface */
declare module 'vue-i18n' {
// define the locale messages schema
export interface DefineLocaleMessage extends MessageSchema {}
// define the datetime format schema
export interface DefineDateTimeFormat {}
// define the number format schema
export interface DefineNumberFormat {}
}
/* eslint-enable @typescript-eslint/no-empty-interface */
2025-03-26 11:51:27 +07:00
export const i18n = createI18n<
{ message: MessageSchema },
MessageLanguages,
false
>({
2025-04-04 16:07:34 +07:00
locale: 'tha',
legacy: false,
2025-03-26 11:51:27 +07:00
messages,
});
2024-04-02 11:02:16 +07:00
2025-03-26 11:51:27 +07:00
export default defineBoot(({ app }) => {
2024-04-02 11:02:16 +07:00
// Set i18n instance on app
app.use(i18n);
});