上記リンクによると、ブラウザ環境におけるIntlによるlocaleの判定は、Safari以外では動く。
また、node v4以降でも判定可能。
node
Intl.NumberFormat().resolvedOptions().locale
// => 'ja-JP'
chrome56
Intl.NumberFormat().resolvedOptions().locale
// => 'ja'
出力が全く同じというわけではない。
More than 5 years have passed since last update.
上記リンクによると、ブラウザ環境におけるIntlによるlocaleの判定は、Safari以外では動く。
また、node v4以降でも判定可能。
Intl.NumberFormat().resolvedOptions().locale
// => 'ja-JP'
Intl.NumberFormat().resolvedOptions().locale
// => 'ja'
出力が全く同じというわけではない。
Register as a new user and use Qiita more conveniently