Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing basque language name hydration issues on Google Chrome (#1415)
- Loading branch information
1 parent
aaa1276
commit ebd05e8
Showing
5 changed files
with
22 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* Returns the locale's name. | ||
*/ | ||
export const getLocaleDisplayName = (locale, displayLocale = undefined) => { | ||
// Different browsers seem to handle "eu" differently from the Node server. | ||
// Special case this to avoid a hydration failure. | ||
if (locale === "eu") { | ||
return "Eurakasa"; | ||
} | ||
const displayName = new Intl.DisplayNames([displayLocale || locale], { type: "language" }).of(locale); | ||
// Return the Titlecased version of the language name. | ||
return displayName.charAt(0).toLocaleUpperCase() + displayName.slice(1); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters