@pyxo/quasar-app-extension-int
Version:
A Quasar app extension to add internationalization support.
51 lines (50 loc) • 1.7 kB
JavaScript
export function getQintConf( /* { app, router, ... } */) {
const qintConf = {
langTags: ['ar', 'en'],
langTagsConf: {
ar: { nativeName: 'العربية' },
en: {
nativeName: 'English',
quasarLang: {
isoName: 'en-US',
},
},
},
quasarLangConf: {
importQLang: async (isoName, custom) => {
if (custom) {
return ((
// Modify if the custom language packs are in a different location.
await import(`./q-lang-packs/${isoName}`)).default);
}
else {
return (await import(
// Update this webpack magic comment according to your needs.
/* webpackInclude: /(ar|en-US)\.js$/ */
`quasar/lang/${isoName}`)).default;
}
},
},
vueI18nConf: {
legacy: false,
importGeneralMsg: async (langTag) => (
// Modify if the messages are in a different location.
await import(`src/../src-int/i18n/general-msgs/${langTag}`)).default,
},
cookieConf: {
useCookie: true,
cookieOptions: {
maxAge: 365 * 24 * 60 * 60,
path: '/',
sameSite: 'lax',
},
},
};
qintConf.vueI18nConf.composerOptions = {
locale: qintConf.langTags[0],
fallbackLocale: qintConf.langTags[0],
missingWarn: false,
fallbackWarn: false, // !!process.env.DEV
};
return qintConf;
}