ITADN

v134, v133 woes

#365OpenThorin-Oakenpants 创建于 2024-11-27
feature detection
@sertonix ```js try {if ('lij' == Intl.PluralRules.supportedLocalesOf('lij').join()) {return 134}} catch(e) {} // 1927706 ``` It's my version 134 test. They added it wayback in UDK v105 then rolled it back - these changes come with updates to ICU. On windows I correctly only trigger this in v134 or higher. So I wonder if something else is going on in linux. I'm usually loathe to use anything that an extension could tamper with, but this is low risk and I couldn't really find anything else - I need changes that are not pref based. I didn't 100% confirm that [1927706](https://bugzilla.mozilla.org/show_bug.cgi?id=1927706) is the change, but 99% sure it is. what do you get if you run this in the console ```js function test() { let aCodes = [ 'ie', 'lij', 'oc', 'st', 'szl', 'tn', 'za'] let aIntl = ['C', 'DTF','DN','DF','LF','NF','PR','RTF','S'] let oData = [], test = '' aIntl.forEach(function(method){ try { if (method == "C") { test = Intl.Collator.supportedLocalesOf(aCodes) } else if (method == "DTF") { test = Intl.DateTimeFormat.supportedLocalesOf(aCodes) } else if (method == "DN") { test = Intl.DisplayNames.supportedLocalesOf(aCodes) } else if (method == "DF") { test = Intl.DurationFormat.supportedLocalesOf(aCodes) } else if (method == "LF") { test = Intl.ListFormat.supportedLocalesOf(aCodes) } else if (method == "NF") { test = Intl.NumberFormat.supportedLocalesOf(aCodes) } else if (method == "PR") { test = Intl.PluralRules.supportedLocalesOf(aCodes) } else if (method == "RTF") { test = Intl.RelativeTimeFormat.supportedLocalesOf(aCodes) } else if (method == "S") { test = Intl.Segmenter.supportedLocalesOf(aCodes) } } catch(e) { } oData.push(method +': ' + test.join(', ')) }) console.log(oData.join('\n')) } test() ``` I get this in v134 ``` C: lij, st, tn DTF: ie, lij, oc, st, szl, tn, za DN: ie, lij, oc, st, szl, tn, za DF: ie, lij, oc, st, szl, tn, za LF: ie, lij, oc, st, szl, tn, za NF: ie, lij, oc, st, szl, tn, za PR: ie, lij, oc, st, szl, tn, za RTF: ie, lij, oc, st, szl, tn, za S: ie, lij, oc, st, szl, tn, za ``` and this in 133 ``` C: DTF: DN: DF: LF: NF: PR: RTF: S: ```
24 条评论