This repository has been archived on 2024-07-27. You can view files and clone it, but cannot push or open issues or pull requests.
keksAccountGUI/node_modulesOLD/vuetify/lib/services/lang/index.js.map

1 line
3.3 KiB
Text
Raw Permalink Normal View History

2019-08-11 18:48:02 +00:00
{"version":3,"sources":["../../../src/services/lang/index.ts"],"names":[],"mappings":"AAAA;AACA,SAAS,OAAT,QAAwB,YAAxB,C,CAEA;;AACA,OAAO,EAAP,MAAe,iBAAf,C,CAEA;;AACA,SAAS,oBAAT,QAAqC,oBAArC;AACA,SAAS,YAAT,EAAuB,WAAvB,QAA0C,oBAA1C;AAQA,MAAM,WAAW,GAAG,WAApB;AACA,MAAM,QAAQ,GAAG,MAAM,CAAC,eAAD,CAAvB;;AAEA,SAAS,cAAT,CACE,MADF,EAEE,GAFF,EAGE,aAAa,GAAG,KAHlB,EAGuB;AAErB,QAAM,QAAQ,GAAG,GAAG,CAAC,OAAJ,CAAY,WAAZ,EAAyB,EAAzB,CAAjB;AACA,MAAI,WAAW,GAAG,oBAAoB,CAAC,MAAD,EAAS,QAAT,EAAmB,QAAnB,CAAtC;;AAEA,MAAI,WAAW,KAAK,QAApB,EAA8B;AAC5B,QAAI,aAAJ,EAAmB;AACjB,MAAA,YAAY,CAAC,oBAAoB,QAAQ,yBAA7B,CAAZ;AACA,MAAA,WAAW,GAAG,GAAd;AACD,KAHD,MAGO;AACL,MAAA,WAAW,CAAC,oBAAoB,QAAQ,sCAA7B,CAAX;AACA,MAAA,WAAW,GAAG,cAAc,CAAC,EAAD,EAAK,GAAL,EAAU,IAAV,CAA5B;AACD;AACF;;AAED,SAAO,WAAP;AACD;;AAED,OAAM,MAAO,IAAP,SAAoB,OAApB,CAA2B;AAS/B,EAAA,WAAA,CAAa,OAAA,GAAuC,EAApD,EAAsD;AACpD;AACA,SAAK,OAAL,GAAe,OAAO,CAAC,OAAR,IAAmB,IAAlC;AACA,SAAK,OAAL,GAAe,MAAM,CAAC,MAAP,CAAc;AAAE,MAAA;AAAF,KAAd,EAAsB,OAAO,CAAC,OAA9B,CAAf;AACA,SAAK,UAAL,GAAkB,OAAO,CAAC,CAA1B;AACD;;AAEM,EAAA,CAAC,CAAE,GAAF,EAAe,GAAG,MAAlB,EAA+B;AACrC,QAAI,CAAC,GAAG,CAAC,UAAJ,CAAe,WAAf,CAAL,EAAkC,OAAO,GAAP;AAElC,QAAI,KAAK,UAAT,EAAqB,OAAO,KAAK,UAAL,CAAgB,GAAhB,EAAqB,GAAG,MAAxB,CAAP;AAErB,UAAM,WAAW,GAAG,cAAc,CAAC,KAAK,OAAL,CAAa,KAAK,OAAlB,CAAD,EAA6B,GAA7B,CAAlC;AAEA,WAAO,WAAW,CAAC,OAAZ,CAAoB,YAApB,EAAkC,CAAC,KAAD,EAAgB,KAAhB,KAAiC;AACxE;AACA,aAAO,MAAM,CAAC,MAAM,CAAC,CAAC,KAAF,CAAP,CAAb;AACD,KAHM,CAAP;AAID;;AA3B8B;AACxB,IAAA,CAAA,QAAA,GAAW,MAAX","sourcesContent":["// Extensions\nimport { Service } from '../service'\n\n// Language\nimport en from '../../locale/en'\n\n// Utilities\nimport { getObjectValueByPath } from '../../util/helpers'\nimport { consoleError, consoleWarn } from '../../util/console'\n\n// Types\nimport {\n VuetifyLangOptions,\n VuetifyLocale,\n} from 'vuetify/types/services/lang'\n\nconst LANG_PREFIX = '$vuetify.'\nconst fallback = Symbol('Lang fallback')\n\nfunction getTranslation (\n locale: VuetifyLocale,\n key: string,\n usingFallback = false\n): string {\n const shortKey = key.replace(LANG_PREFIX, '')\n let translation = getObjectValueByPath(locale, shortKey, fallback) as string | typeof fallback\n\n if (translation === fallback) {\n if (usingFallback) {\n consoleError(`Translation key \"${shortKey}\" not found in fallback`)\n translation = key\n } else {\n consoleWarn(`Translation key \"${shortKey}\" not found, falling back to default`)\n translation = getTranslation(en, key, true)\n }\n }\n\n return translation\n}\n\nexport class Lang extends Service {\n static property = 'lang'\n\n public locales: Record<string, VuetifyLocale>\n\n public current: string\n\n private translator: ((key: string, ...params: any[]) => string) | undefined\n\n constructor (options: Partial<VuetifyLangOptions> = {}) {\n super()\n this.current = options.current || 'en'\n this.locales = Object.assign({ en }, options.locales)\n this.translator = options.t\n }\n\n public t (key: string, ...params: any[]) {\n if (!key.startsWith(LANG_PREFIX)) return key\n\n if (this.translator) return this.translator(key, ...params)\n\n const translation = getTranslation(this.locales[this.current], key)\n\n return translation.replace(/\\{(\\d+)\\}/g, (match: string, index: string) => {\n /* istanbul ignore next */\n return String(params[+index])\n })\n }\n}\n"],"sourceRoot":"","file":"index.js"}