fix(core): Issue #2625. error with process.env.LANG larger than 5 (#2645)

* Update logger.ts

Solving #2625

* chore: add changeset

Co-authored-by: Nate Moore <nate@skypack.dev>
This commit is contained in:
Javier Cortés 2022-02-24 21:38:31 +01:00 committed by GitHub
parent a9656e743b
commit 2e5c3b5126
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Fix issue when process.env.LANG was longer than 5 characters

View file

@ -18,7 +18,7 @@ function getLoggerLocale(): string {
// Check if language code is atleast two characters long (ie. en, es).
// NOTE: if "c" locale is encountered, the default locale will be returned.
if (extractedLocale.length < 2) return defaultLocale;
else return extractedLocale;
else return extractedLocale.substring(0, 5);
} else return defaultLocale;
}