defaultLang is now lang
This commit is contained in:
parent
4cc10fe36c
commit
457a20511b
4
mailgo.d.ts
vendored
4
mailgo.d.ts
vendored
@ -6,9 +6,9 @@ declare module "mailgo";
|
|||||||
|
|
||||||
export type MailgoConfig = {
|
export type MailgoConfig = {
|
||||||
initEvent?: string;
|
initEvent?: string;
|
||||||
defaultLang?: string;
|
lang?: string;
|
||||||
forceLang?: boolean;
|
forceLang?: boolean;
|
||||||
additionalCSS?: string;
|
// additionalCSS?: string;
|
||||||
// TODO here mailgo configurations!
|
// TODO here mailgo configurations!
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -74,17 +74,20 @@ const mailgoInit = (mailgoConfig?: MailgoConfig): void => {
|
|||||||
let translations: any = i18n.translations;
|
let translations: any = i18n.translations;
|
||||||
|
|
||||||
// if a default language is defined use it
|
// if a default language is defined use it
|
||||||
if (
|
if (mailgoConfig?.lang && i18n.languages.includes(mailgoConfig.lang)) {
|
||||||
mailgoConfig?.defaultLang &&
|
lang = mailgoConfig.lang;
|
||||||
i18n.languages.includes(mailgoConfig.defaultLang)
|
|
||||||
) {
|
|
||||||
lang = mailgoConfig.defaultLang;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if is defined <html lang=""> use it!
|
// if is defined <html lang=""> use it!
|
||||||
if (!mailgoConfig?.forceLang && document.documentElement.lang) {
|
if (!mailgoConfig?.forceLang) {
|
||||||
|
// keep the lang from html
|
||||||
|
let htmlLang = document.documentElement.lang;
|
||||||
|
|
||||||
|
// if there are translations...
|
||||||
|
if (i18n.languages.includes(htmlLang)) {
|
||||||
lang = document.documentElement.lang;
|
lang = document.documentElement.lang;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// strings
|
// strings
|
||||||
let defaultStrings: any = translations[DEFAULT_LANG];
|
let defaultStrings: any = translations[DEFAULT_LANG];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user