mirror of
https://github.com/wassname/Open-Assistant.git
synced 2026-08-19 11:50:35 +08:00
Make the first letter of the language selector upper case (#1214)
This commit is contained in:
@@ -20,11 +20,15 @@ const LanguageSelector = () => {
|
||||
}
|
||||
}, [cookies, setCookie, router]);
|
||||
|
||||
const firstLetterUppercase = (str) => {
|
||||
return str.charAt(0).toLocaleUpperCase() + str.slice(1);
|
||||
};
|
||||
|
||||
// Memo the set of locales and their display names.
|
||||
const localesAndNames = useMemo(() => {
|
||||
return router.locales.map((locale) => ({
|
||||
locale,
|
||||
name: new Intl.DisplayNames([locale], { type: "language" }).of(locale),
|
||||
name: firstLetterUppercase(new Intl.DisplayNames([locale], { type: "language" }).of(locale)),
|
||||
}));
|
||||
}, [router.locales]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user