import { Component, linkEvent } from "inferno";
-import ISO6391 from "iso-639-1";
import {
BlockCommunity,
BlockCommunityResponse,
fetchCommunities,
fetchUsers,
getLanguage,
+ getNativeLanguageName,
isBrowser,
languages,
personSelectName,
<option disabled aria-hidden="true">
──
</option>
- {languages.sort().map(lang => (
- <option value={lang.code}>
- {ISO6391.getNativeName(lang.code) || lang.code}
- </option>
- ))}
+ {languages
+ .sort((a, b) => a.code.localeCompare(b.code))
+ .map(lang => (
+ <option value={lang.code}>
+ {getNativeLanguageName(lang.code)}
+ </option>
+ ))}
</select>
</div>
</div>
import emojiShortName from "emoji-short-name";
+import ISO6391 from "iso-639-1";
import {
BlockCommunityResponse,
BlockPersonResponse,
};
}
+export function getNativeLanguageName(code: string): string {
+ let [isoCode, qualifier] = code.split("_");
+
+ let native = ISO6391.getNativeName(isoCode) || code;
+
+ if (qualifier) {
+ return `${native}_${qualifier}`;
+ } else {
+ return native;
+ }
+}
+
// TODO
export function getLanguage(override?: string): string {
let myUserInfo = UserService.Instance.myUserInfo;