Remove abbreviation of “language” in function names
This commit is contained in:
@@ -21,7 +21,7 @@ import { useTranslation } from 'react-i18next';
|
||||
import { Virtuoso } from 'react-virtuoso';
|
||||
import { CustomTooltip } from '@/modules/core/components/CustomTooltip.tsx';
|
||||
import { translateExtensionLanguage } from '@/modules/extension/Extensions.utils.ts';
|
||||
import { langSortCmp, toUniqueLanguageCodes } from '@/modules/core/utils/Languages.ts';
|
||||
import { languageSortComparator, toUniqueLanguageCodes } from '@/modules/core/utils/Languages.ts';
|
||||
|
||||
interface IProps {
|
||||
selectedLanguages: string[];
|
||||
@@ -38,7 +38,10 @@ export function LanguageSelect(props: IProps) {
|
||||
|
||||
const languagesSortedBySelectState = useMemo(
|
||||
() =>
|
||||
toUniqueLanguageCodes([...tmpSelectedLanguages.toSorted(langSortCmp), ...languages.toSorted(langSortCmp)]),
|
||||
toUniqueLanguageCodes([
|
||||
...tmpSelectedLanguages.toSorted(languageSortComparator),
|
||||
...languages.toSorted(languageSortComparator),
|
||||
]),
|
||||
[languages, tmpSelectedLanguages],
|
||||
);
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ export function getLanguage(code: string): LanguageObject {
|
||||
};
|
||||
}
|
||||
|
||||
export function langCodeToName(code: string): string {
|
||||
export function languageCodeToName(code: string): string {
|
||||
return getLanguage(code).nativeName;
|
||||
}
|
||||
|
||||
@@ -89,12 +89,13 @@ function defaultNativeLang(): readonly string[] {
|
||||
return preferredLanguages;
|
||||
}
|
||||
|
||||
export function extensionDefaultLangs(): string[] {
|
||||
export function extensionDefaultLanguages(): string[] {
|
||||
return [...defaultNativeLang()];
|
||||
}
|
||||
|
||||
export function sourceDefualtLangs(): string[] {
|
||||
export function sourceDefaultLanguages(): string[] {
|
||||
return [...defaultNativeLang()];
|
||||
}
|
||||
|
||||
export const langSortCmp = (a: string, b: string) => langCodeToName(a).localeCompare(langCodeToName(b));
|
||||
export const languageSortComparator = (a: string, b: string) =>
|
||||
languageCodeToName(a).localeCompare(languageCodeToName(b));
|
||||
|
||||
Reference in New Issue
Block a user