]> git.ipfire.org Git - thirdparty/vuejs/create-vue.git/commit
fix: prioritize enviornment variables over Intl.DateTimeFormat
authorHaoqun Jiang <haoqunjiang@gmail.com>
Wed, 6 Dec 2023 05:44:49 +0000 (13:44 +0800)
committerHaoqun Jiang <haoqunjiang@gmail.com>
Wed, 6 Dec 2023 05:44:49 +0000 (13:44 +0800)
commitbb11f04a5319cecde4bd6e87c3bbb1612d7a88ae
treefdb4fcfa5f690793fa4cec8391f2f1c422647ba0
parent6665f0eb691a040fd81dbdf96e3bf13dee5bf749
fix: prioritize enviornment variables over Intl.DateTimeFormat

While `Intl.DateTimeFormat` should be the most reliable way to get the
user's locale, it lacks flexibility.
For example, on Windows PowerShell, there's no way to change the
detection result in-session (you have to logout and login again).

So in order to provide an escape hatch for developers and users who
want to temporarily change the locale, we prioritize environment
variables over `Intl.DateTimeFormat`.

In POSIX shells, you can do `LANG=zh_CN.UTF-8` to change the locale to
Chinese;
In CMD, it's `set LANG=zh_CN.UTF-8`;
In PowerShell, it's `$env:LANG = 'zh_CN.UTF-8'`.

Closes #369
utils/getLanguage.ts