Fix text direction info

The spec changed and has been implemented in WebKit:
https://bugs.webkit.org/show_bug.cgi?id=252444

But not in Chromium yet:
https://crbug.com/v8/13835
This commit is contained in:
John Factotum
2023-04-23 14:00:17 +08:00
parent df9822201f
commit abf95a4e9a
+1 -1
View File
@@ -45,7 +45,7 @@ export class View {
const tag = typeof language === 'string' ? language : language[0] const tag = typeof language === 'string' ? language : language[0]
const locale = new Intl.Locale(tag) const locale = new Intl.Locale(tag)
this.isCJK = ['zh', 'ja', 'kr'].includes(locale.language) this.isCJK = ['zh', 'ja', 'kr'].includes(locale.language)
this.textDirection = locale.textInfo.direction this.textDirection = (locale.getTextInfo?.() ?? locale.textInfo)?.direction
} catch(e) { } catch(e) {
console.warn(e) console.warn(e)
} }