mirror of
https://github.com/wassname/Open-Assistant.git
synced 2026-09-09 11:15:08 +08:00
Fixing basque language name hydration issues on Google Chrome (#1415)
This commit is contained in:
@@ -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);
|
||||
};
|
||||
Reference in New Issue
Block a user