Use system provided Intl.Locale since textInfo doesn't work anyway

This commit is contained in:
root
2023-06-23 13:55:21 +05:30
parent b16b4e3c89
commit 9829cd4213
4 changed files with 15 additions and 45 deletions
-1
View File
@@ -17,7 +17,6 @@
"@fontsource/noto-sans-tc": "^5.0.3",
"@fontsource/nunito-sans": "^5.0.3",
"@fontsource/roboto": "^5.0.3",
"@formatjs/intl-locale": "^3.3.2",
"@formatjs/intl-localematcher": "^0.2.32",
"@mdi/js": "^6.9.96",
"@mojee/file-utils": "https://cf-ipfs.com/ipfs/QmYEtpbjQqWYJDbcoixZvcccXkRFKBcTuRw5aa3hb8BWt8?filename=js-file-utils.tgz",
+2 -3
View File
@@ -2,7 +2,6 @@ import Vue from 'vue'
import VueI18n from 'vue-i18n'
import TimeAgo from 'javascript-time-ago'
import * as LocaleMatcher from '@formatjs/intl-localematcher'
import Locale from '@formatjs/intl-locale'
import store from '@/store'
import ENTranslations from '@/translations/en.json'
@@ -433,7 +432,7 @@ export const TIME_AGO_EXCEPTIONS = {}
// Similar switches for RTL can be found in the i18n store
async function syncStylesPerLanguage (locale) {
document.documentElement.setAttribute('lang', locale.baseName)
document.documentElement.setAttribute('lang', locale.toString())
switch (locale.script) {
// All the Inter-based languages
case 'Latn':
@@ -527,7 +526,7 @@ export async function changeLocale (lang) {
lang = DEPRECATED_LANGUAGES_MAP.get(lang)
}
const parsed = new Locale(lang).maximize()
const parsed = new Intl.Locale(lang).maximize()
await Promise.all([
loadLocale(lang),
syncStylesPerLanguage(parsed),
+13 -2
View File
@@ -46,7 +46,18 @@ export const i18nStore = {
state.collator = new Intl.Collator(locale)
state.timeAgo = timeAgo
switch (parsed.textInfo) {
switch (parsed.script) {
case 'Arab':
case 'Aran':
state.rtl = true
break
default:
state.rtl = false
break
}
/* Doesn't work right now for unknown reasons
* switch (parsed.textInfo) {
case 'rtl':
state.rtl = true
break
@@ -54,7 +65,7 @@ export const i18nStore = {
default:
state.rtl = false
break
}
} */
}
},
-39
View File
@@ -1041,14 +1041,6 @@
"@formatjs/intl-localematcher" "0.2.32"
tslib "^2.4.0"
"@formatjs/ecma402-abstract@1.17.0":
version "1.17.0"
resolved "https://registry.yarnpkg.com/@formatjs/ecma402-abstract/-/ecma402-abstract-1.17.0.tgz#2ce191a3bde4c65c6684e03fa247062a4a294b9e"
integrity sha512-6ueQTeJZtwKjmh23bdkq/DMqH4l4bmfvtQH98blOSbiXv/OUiyijSW6jU22IT8BNM1ujCaEvJfTtyCYVH38EMQ==
dependencies:
"@formatjs/intl-localematcher" "0.4.0"
tslib "^2.4.0"
"@formatjs/fast-memoize@2.0.1":
version "2.0.1"
resolved "https://registry.yarnpkg.com/@formatjs/fast-memoize/-/fast-memoize-2.0.1.tgz#f15aaa73caad5562899c69bdcad8db82adcd3b0b"
@@ -1073,30 +1065,6 @@
"@formatjs/ecma402-abstract" "1.15.0"
tslib "^2.4.0"
"@formatjs/intl-enumerator@1.3.2":
version "1.3.2"
resolved "https://registry.yarnpkg.com/@formatjs/intl-enumerator/-/intl-enumerator-1.3.2.tgz#c26de2557ba733736aff4542df95f71236895f39"
integrity sha512-bG0XyG0rCTdmoZRJJXe0oF0PTK7PzJjlLM6PmRlnZs6K5DQYHk4D9TNCwtK2e6OxvBI5EFW4Iy3dhQf/UToxPQ==
dependencies:
tslib "^2.4.0"
"@formatjs/intl-getcanonicallocales@2.2.1":
version "2.2.1"
resolved "https://registry.yarnpkg.com/@formatjs/intl-getcanonicallocales/-/intl-getcanonicallocales-2.2.1.tgz#0d70251b16bec06c1c4a40b37892ea5b51e3a2bb"
integrity sha512-KooqmyY+Mhq3ioASPzoU6p6Cy9Mx+cWSVQSP6lF+vEW2tiaN90ti08cp82p1dzFschenduOYgPKrNcBpsDi6+g==
dependencies:
tslib "^2.4.0"
"@formatjs/intl-locale@^3.3.2":
version "3.3.2"
resolved "https://registry.yarnpkg.com/@formatjs/intl-locale/-/intl-locale-3.3.2.tgz#0a5aaafdabec1c5180064dee8e9cb8f0e7097d2d"
integrity sha512-RnL5Bzb1J3ggIOFEeVRAgBUjILHOkP5DX6iH4ALDywhJmT6fArTskPc+b0GreOQtqL6zOb8mU7HxbgRV+P2S5w==
dependencies:
"@formatjs/ecma402-abstract" "1.17.0"
"@formatjs/intl-enumerator" "1.3.2"
"@formatjs/intl-getcanonicallocales" "2.2.1"
tslib "^2.4.0"
"@formatjs/intl-localematcher@0.2.32", "@formatjs/intl-localematcher@^0.2.32":
version "0.2.32"
resolved "https://registry.yarnpkg.com/@formatjs/intl-localematcher/-/intl-localematcher-0.2.32.tgz#00d4d307cd7d514b298e15a11a369b86c8933ec1"
@@ -1104,13 +1072,6 @@
dependencies:
tslib "^2.4.0"
"@formatjs/intl-localematcher@0.4.0":
version "0.4.0"
resolved "https://registry.yarnpkg.com/@formatjs/intl-localematcher/-/intl-localematcher-0.4.0.tgz#63bbc37a7c3545a1bf1686072e51d9a3aed98d6b"
integrity sha512-bRTd+rKomvfdS4QDlVJ6TA/Jx1F2h/TBVO5LjvhQ7QPPHp19oPNMIum7W2CMEReq/zPxpmCeB31F9+5gl/qtvw==
dependencies:
tslib "^2.4.0"
"@hapi/hoek@^9.0.0":
version "9.3.0"
resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.3.0.tgz#8368869dcb735be2e7f5cb7647de78e167a251fb"