Sort the language list
I think using the 'values' for the keys should be fine since each language name is unique. A key-clash would also help us catch mistakes like not differentiating sub-languages if support any (e.g. "English" vs. "English (British)") Had to cast to String for lint.
This commit is contained in:
parent
b17ba20fd5
commit
bfcdbd575f
2 changed files with 14 additions and 7 deletions
|
@ -8,6 +8,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||
|
||||
### Added
|
||||
|
||||
- Japanese, Afrikaans, Filipino, Thai and Vietnamese language support ([#5684](https://github.com/lbryio/lbry-desktop/issues/5684))
|
||||
|
||||
### Changed
|
||||
|
||||
- Keyboard shortcut additions and changes _community pr!_ ([#5717](https://github.com/lbryio/lbry-desktop/pull/5717))
|
||||
|
|
|
@ -8,9 +8,9 @@ import { getDefaultLanguage } from 'util/default-languages';
|
|||
|
||||
type Props = {
|
||||
language: string,
|
||||
setLanguage: string => void,
|
||||
setLanguage: (string) => void,
|
||||
searchInLanguage: boolean,
|
||||
setSearchInLanguage: boolean => void,
|
||||
setSearchInLanguage: (boolean) => void,
|
||||
};
|
||||
|
||||
function SettingLanguage(props: Props) {
|
||||
|
@ -41,11 +41,16 @@ function SettingLanguage(props: Props) {
|
|||
'Multi-language support is brand new and incomplete. Switching your language may have unintended consequences, like glossolalia.'
|
||||
)}
|
||||
>
|
||||
{Object.keys(languages).map(language => (
|
||||
<option key={language} value={language}>
|
||||
{languages[language]}
|
||||
{Object.values(languages)
|
||||
.sort()
|
||||
.map((language) => {
|
||||
const lang = String(language);
|
||||
return (
|
||||
<option key={lang} value={lang}>
|
||||
{lang}
|
||||
</option>
|
||||
))}
|
||||
);
|
||||
})}
|
||||
</FormField>
|
||||
{previousLanguage && <Spinner type="small" />}
|
||||
<FormField
|
||||
|
|
Loading…
Reference in a new issue