All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.dist.locale.Locale.js.map Maven / Gradle / Ivy

{"version":3,"file":"Locale.js","sourceRoot":"","sources":["../../src/locale/Locale.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEnE,MAAM,OAAO,GAAG,4MAA4M,CAAC;AAE7N,MAAM,MAAM;IASX,YAAY,SAAiB;QAC5B,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;QAC3D,IAAI,OAAO,KAAK,IAAI,EAAE;YACrB,MAAM,IAAI,KAAK,CAAC,sBAAsB,SAAS,6BAA6B,CAAC,CAAC;SAC9E;QACD,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,gBAAgB,CAAC;QAChD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAChC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAChC,IAAI,CAAC,QAAQ,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;QAC5D,IAAI,CAAC,UAAU,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;QAC9D,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;QACtC,IAAI,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC;SAC9C;QACD,I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e;QAClC,OAAO,IAAI,CAAC,oBAAoB,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D,CAAC;IAED,QAAQ;QACP,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAE3B,IAAI,IAAI,CAAC,OAAO,EAAE;YACjB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SACrB;QACD,IAAI,IAAI,CAAC,OAAO,EAAE;YACjB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SACrB;QACD,IAAI,IAAI,CAAC,QAAQ,EAAE;YAClB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SACtB;QACD,IAAI,IAAI,CAAC,UAAU,EAAE;YACpB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SACxB;QACD,IAAI,IAAI,CAAC,WAAW,EAAE;YACrB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;SACzB;QACD,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACpB,CAAC;CACD;AAED,eAAe,MAAM,CAAC","sourcesContent":["import { DEFAULT_LANGUAGE } from \"../generated/AssetParameters.js\";\n\nconst rLocale = /^((?:[A-Z]{2,3}(?:-[A-Z]{3}){0,3})|[A-Z]{4}|[A-Z]{5,8})(?:-([A-Z]{4}))?(?:-([A-Z]{2}|[0-9]{3}))?((?:-[0-9A-Z]{5,8}|-[0-9][0-9A-Z]{3})*)((?:-[0-9A-WYZ](?:-[0-9A-Z]{2,8})+)*)(?:-(X(?:-[0-9A-Z]{1,8})+))?$/i;\n\nclass Locale {\n\tsLocaleId: string;\n\tsLanguage: string;\n\tsScript: string;\n\tsRegion: string;\n\tsVariant: string | null;\n\tsExtension: string | null;\n\tsPrivateUse: string | null;\n\n\tconstructor(sLocaleId: string) {\n\t\tconst aResult = rLocale.exec(sLocaleId.replace(/_/g, \"-\"));\n\t\tif (aResult === null) {\n\t\t\tthrow new Error(`The given language ${sLocaleId} does not adhere to BCP-47.`);\n\t\t}\n\t\tthis.sLocaleId = sLocaleId;\n\t\tthis.sLanguage = aResult[1] || DEFAULT_LANGUAGE;\n\t\tthis.sScript = aResult[2] || \"\";\n\t\tthis.sRegion = aResult[3] || \"\";\n\t\tthis.sVariant = (aResult[4] && aResult[4].slice(1)) || null;\n\t\tthis.sExtension = (aResult[5] && aResult[5].slice(1)) || null;\n\t\tthis.sPrivateUse = aResult[6] || null;\n\t\tif (this.sLanguage) {\n\t\t\tthis.sLanguage = this.sLanguage.toLowerCase();\n\t\t}\n\t\tif (this.sScript) {\n\t\t\tthis.sScript = this.sScript.toLowerCase().replace(/^[a-z]/, s => {\n\t\t\t\treturn s.toUpperCase();\n\t\t\t});\n\t\t}\n\t\tif (this.sRegion) {\n\t\t\tthis.sRegion = this.sRegion.toUpperCase();\n\t\t}\n\t}\n\n\tgetLanguage() {\n\t\treturn this.sLanguage;\n\t}\n\n\tgetScript() {\n\t\treturn this.sScript;\n\t}\n\n\tgetRegion() {\n\t\treturn this.sRegion;\n\t}\n\n\tgetVariant() {\n\t\treturn this.sVariant;\n\t}\n\n\tgetVariantSubtags() {\n\t\treturn this.sVariant ? this.sVariant.split(\"-\") : [];\n\t}\n\n\tgetExtension() {\n\t\treturn this.sExtension;\n\t}\n\n\tgetExtensionSubtags() {\n\t\treturn this.sExtension ? this.sExtension.slice(2).split(\"-\") : [];\n\t}\n\n\tgetPrivateUse() {\n\t\treturn this.sPrivateUse;\n\t}\n\n\tgetPrivateUseSubtags() {\n\t\treturn this.sPrivateUse ? this.sPrivateUse.slice(2).split(\"-\") : [];\n\t}\n\n\thasPrivateUseSubtag(sSubtag: string) {\n\t\treturn this.getPrivateUseSubtags().indexOf(sSubtag) >= 0;\n\t}\n\n\ttoString() {\n\t\tconst r = [this.sLanguage];\n\n\t\tif (this.sScript) {\n\t\t\tr.push(this.sScript);\n\t\t}\n\t\tif (this.sRegion) {\n\t\t\tr.push(this.sRegion);\n\t\t}\n\t\tif (this.sVariant) {\n\t\t\tr.push(this.sVariant);\n\t\t}\n\t\tif (this.sExtension) {\n\t\t\tr.push(this.sExtension);\n\t\t}\n\t\tif (this.sPrivateUse) {\n\t\t\tr.push(this.sPrivateUse);\n\t\t}\n\t\treturn r.join(\"-\");\n\t}\n}\n\nexport default Locale;\n"]}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy