-
Notifications
You must be signed in to change notification settings - Fork 338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix language names #580
Fix language names #580
Conversation
return allowedLangs[0]; | ||
} | ||
|
||
export function getMomentLanguage(): string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is not necessary at all, as momentjs does it much smarter on its own.
{ resource: vi, code: "vi", name: "Tiếng Việt" }, | ||
{ resource: zh, code: "zh", name: "中文" }, | ||
{ resource: zh_Hant, code: "zh_Hant", name: "文言" }, | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merge the different language lists in a single place for simplicity, also sort alphabetically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is much better.
} else { | ||
return lang; | ||
return [lang]; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes more sense to return a list of preferred languages here, momentjs uses this. Unfortunately i18next doesnt, it can only set a single language. So if a word isnt translated into the browser language, it will always fallback to English, even if the browser specifies another fallback language.
{ resource: vi, code: "vi", name: "Tiếng Việt" }, | ||
{ resource: zh, code: "zh", name: "中文" }, | ||
{ resource: zh_Hant, code: "zh_Hant", name: "文言" }, | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is much better.
@@ -527,7 +525,7 @@ export class Settings extends Component<any, SettingsState> { | |||
.sort((a, b) => a.code.localeCompare(b.code)) | |||
.map(lang => ( | |||
<option value={lang.code}> | |||
{getNativeLanguageName(lang.code)} | |||
{getLanguages(lang.code)[0]} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the language name here, and I'm not sure why this needed to call getLanguages again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, i changed this before merging the language lists.
As described in LemmyNet/joinlemmy-site#76 (comment)
There is still a problem in that all language names are rendered left to right, even those which should be rtl (like Arabic).