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/es5/services/lang/index.js.map

1 line
3.2 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":";;;;;;;AACA;;AAGA;;AAGA;;AACA;;;;;;;;;;;;;;;;;;;;;;AAQA,IAAM,WAAW,GAAG,WAApB;AACA,IAAM,QAAQ,GAAG,MAAM,CAAC,eAAD,CAAvB;;AAEA,SAAS,cAAT,CACE,MADF,EAEE,GAFF,EAGuB;AAAA,MAArB,aAAqB,uEAAL,KAAK;AAErB,MAAM,QAAQ,GAAG,GAAG,CAAC,OAAJ,CAAY,WAAZ,EAAyB,EAAzB,CAAjB;AACA,MAAI,WAAW,GAAG,mCAAqB,MAArB,EAA6B,QAA7B,EAAuC,QAAvC,CAAlB;;AAEA,MAAI,WAAW,KAAK,QAApB,EAA8B;AAC5B,QAAI,aAAJ,EAAmB;AACjB,6DAAiC,QAAjC;AACA,MAAA,WAAW,GAAG,GAAd;AACD,KAHD,MAGO;AACL,4DAAgC,QAAhC;AACA,MAAA,WAAW,GAAG,cAAc,CAAC,WAAD,EAAK,GAAL,EAAU,IAAV,CAA5B;AACD;AACF;;AAED,SAAO,WAAP;AACD;;IAEY,I;;;;;AASX,kBAAsD;AAAA;;AAAA,QAAzC,OAAyC,uEAAF,EAAE;;AAAA;;AACpD;AACA,UAAK,OAAL,GAAe,OAAO,CAAC,OAAR,IAAmB,IAAlC;AACA,UAAK,OAAL,GAAe,MAAM,CAAC,MAAP,CAAc;AAAE,MAAA,EAAE,EAAF;AAAF,KAAd,EAAsB,OAAO,CAAC,OAA9B,CAAf;AACA,UAAK,UAAL,GAAkB,OAAO,CAAC,CAA1B;AAJoD;AAKrD;;;;sBAES,G,EAA6B;AAAA,wCAAb,MAAa;AAAb,QAAA,MAAa;AAAA;;AACrC,UAAI,CAAC,GAAG,CAAC,UAAJ,CAAe,WAAf,CAAL,EAAkC,OAAO,GAAP;AAElC,UAAI,KAAK,UAAT,EAAqB,OAAO,KAAK,UAAL,cAAgB,GAAhB,SAAwB,MAAxB,EAAP;AAErB,UAAM,WAAW,GAAG,cAAc,CAAC,KAAK,OAAL,CAAa,KAAK,OAAlB,CAAD,EAA6B,GAA7B,CAAlC;AAEA,aAAO,WAAW,CAAC,OAAZ,CAAoB,YAApB,EAAkC,UAAC,KAAD,EAAgB,KAAhB,EAAiC;AACxE;AACA,eAAO,MAAM,CAAC,MAAM,CAAC,CAAC,KAAF,CAAP,CAAb;AACD,OAHM,CAAP;AAID;;;;EA3BuB,gB;;;AACjB,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"}