File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,18 @@ interface Language {
5151 * @returns locale that linked with correct name
5252 */
5353function linkLocale ( locale : string ) {
54+ // The C locale is the default system locale for POSIX systems.
55+ // https://docs.oracle.com/cd/E36784_01/html/E36823/glmar.html
56+ // https://sourceware.org/glibc/wiki/Proposals/C.UTF-8
57+ // It is common among containerized environments or minimal virtual environments
58+ // though most user-facing systems would have a more specific locale set.
59+ // The problem here is that the C locale is not a valid language tag for the Intl API.
60+ // But it is not desirable to throw an error in this case.
61+ // So we map it to 'en-US'.
62+ if ( locale === 'C' ) {
63+ return 'en-US'
64+ }
65+
5466 let linkedLocale : string
5567 try {
5668 linkedLocale = Intl . getCanonicalLocales ( locale ) [ 0 ]
You can’t perform that action at this time.
0 commit comments