@ethnolib/find-language 0.1.7 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/defaultExcludedHistoricLanguages.d.ts +1 -1
- package/index.d.ts +1 -0
- package/index.js +10 -10
- package/index.mjs +5524 -4063
- package/languageSearcher.d.ts +19 -0
- package/languageTagUtils.d.ts +0 -2
- package/package.json +6 -2
- package/searchForLanguage.d.ts +4 -3
- package/langtagProcessingHelpers.d.ts +0 -78
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare class LanguageSearcher {
|
|
2
|
+
private languageData;
|
|
3
|
+
private baseFuseOptions;
|
|
4
|
+
private spacePaddedLanguages;
|
|
5
|
+
private languageToId;
|
|
6
|
+
private completeMatchFuse;
|
|
7
|
+
private spacePaddedFuse;
|
|
8
|
+
private substringMatchFuse;
|
|
9
|
+
private fuzzyMatchFuse;
|
|
10
|
+
constructor(languageData: any[], languageToId: (language: any) => string, exactMatchFuseSearchKeys: any[], fuzzyMatchFuseSearchKeys: any[], additionalFuseOptions?: any, customLanguageSpacePadder?: (language: any) => any);
|
|
11
|
+
private searchCompleteMatches;
|
|
12
|
+
private searchWholeWordMatches;
|
|
13
|
+
private searchStartOfWordMatches;
|
|
14
|
+
private searchSubstringMatches;
|
|
15
|
+
private searchFuzzyMatches;
|
|
16
|
+
private revertSpacePaddedResults;
|
|
17
|
+
searchForLanguage(queryString: string): any[];
|
|
18
|
+
asyncSearchForLanguage(queryString: string, appendResults: (results: any[], forSearchString: string) => boolean): Promise<void>;
|
|
19
|
+
}
|
package/languageTagUtils.d.ts
CHANGED
|
@@ -22,8 +22,6 @@ interface ITagParts {
|
|
|
22
22
|
otherSubtags?: string[];
|
|
23
23
|
}
|
|
24
24
|
export declare function splitTag(tag: string): ITagParts;
|
|
25
|
-
export declare function parseLangtagFromLangChooser(languageTag: string, // must be the default language subtag for the language
|
|
26
|
-
searchResultModifier?: (results: ILanguage[], searchString: string) => ILanguage[]): IOrthography | undefined;
|
|
27
25
|
export declare function defaultRegionForLangTag(languageTag: string): IRegion | undefined;
|
|
28
26
|
export declare function createTagFromOrthography(orthography: IOrthography): string;
|
|
29
27
|
export declare function defaultDisplayName(language?: ILanguage, script?: IScript): string | undefined;
|
package/package.json
CHANGED
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
"description": "A library for fuzzy-searching for languages and other utils for language choosers",
|
|
4
4
|
"author": "SIL Global",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "0.1.
|
|
6
|
+
"version": "0.1.9",
|
|
7
7
|
"main": "./index.js",
|
|
8
8
|
"types": "./index.d.ts",
|
|
9
|
+
"sideEffects": false,
|
|
9
10
|
"scripts": {
|
|
10
|
-
"langtag-processing": "tsx ./langtagProcessing.ts",
|
|
11
|
+
"langtag-processing": "tsx ./scripts/langtagProcessing.ts",
|
|
11
12
|
"prebuild": "npm run langtag-processing",
|
|
12
13
|
"build": "nx vite:build",
|
|
13
14
|
"typecheck": "tsc",
|
|
@@ -25,5 +26,8 @@
|
|
|
25
26
|
"@types/node": "^20.16.11",
|
|
26
27
|
"tsx": "^4.19.2",
|
|
27
28
|
"typescript": "^5.2.2"
|
|
29
|
+
},
|
|
30
|
+
"volta": {
|
|
31
|
+
"extends": "../../../../package.json"
|
|
28
32
|
}
|
|
29
33
|
}
|
package/searchForLanguage.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { ILanguage } from './findLanguageInterfaces';
|
|
2
|
-
export declare
|
|
1
|
+
import { ILanguage, IOrthography } from './findLanguageInterfaces';
|
|
2
|
+
export declare function searchForLanguage(queryString: string): ILanguage[];
|
|
3
3
|
export declare function asyncSearchForLanguage(queryString: string, appendResults: (results: ILanguage[], forSearchString: string) => boolean): Promise<void>;
|
|
4
|
-
export declare function asyncGetAllLanguageResults(searchString: string): Promise<ILanguage[]>;
|
|
5
4
|
export declare function getLanguageBySubtag(code: string, searchResultModifier?: (results: ILanguage[], searchString: string) => ILanguage[]): ILanguage | undefined;
|
|
5
|
+
export declare function parseLangtagFromLangChooser(languageTag: string, // must be the default language subtag for the language
|
|
6
|
+
searchResultModifier?: (results: ILanguage[], searchString: string) => ILanguage[]): IOrthography | undefined;
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { ILanguage, IScript, LanguageType } from './findLanguageInterfaces';
|
|
2
|
-
export declare const COMMA_SEPARATOR = ", ";
|
|
3
|
-
export interface ILanguageInternal {
|
|
4
|
-
autonym: string;
|
|
5
|
-
exonym: string;
|
|
6
|
-
iso639_3_code: string;
|
|
7
|
-
languageSubtag: string;
|
|
8
|
-
regionNames: Set<string>;
|
|
9
|
-
names: Set<string>;
|
|
10
|
-
scripts: {
|
|
11
|
-
[key: string]: IScript;
|
|
12
|
-
};
|
|
13
|
-
alternativeTags: Set<string>;
|
|
14
|
-
isRepresentativeForMacrolanguage: boolean;
|
|
15
|
-
isMacrolanguage: boolean;
|
|
16
|
-
parentMacrolanguage?: ILanguage;
|
|
17
|
-
languageType: LanguageType;
|
|
18
|
-
}
|
|
19
|
-
export interface ILangtagsJsonEntryInternal {
|
|
20
|
-
full: string;
|
|
21
|
-
iso639_3: string;
|
|
22
|
-
iana: string[];
|
|
23
|
-
latnnames: string[];
|
|
24
|
-
localname: string;
|
|
25
|
-
localnames: string[];
|
|
26
|
-
macrolang: string;
|
|
27
|
-
name: string;
|
|
28
|
-
names: string[];
|
|
29
|
-
nophonvars: boolean;
|
|
30
|
-
obsolete: boolean;
|
|
31
|
-
region: string;
|
|
32
|
-
regions: string[];
|
|
33
|
-
regionname: string;
|
|
34
|
-
rod: string;
|
|
35
|
-
script: string;
|
|
36
|
-
sldr: string;
|
|
37
|
-
supress: boolean;
|
|
38
|
-
tag: string;
|
|
39
|
-
tags: string[];
|
|
40
|
-
unwritten: boolean;
|
|
41
|
-
variants: string[];
|
|
42
|
-
windows: string;
|
|
43
|
-
isRepresentativeForMacrolanguage: boolean;
|
|
44
|
-
}
|
|
45
|
-
interface IIsoCodeDetailsInternal {
|
|
46
|
-
isMacrolanguage: boolean;
|
|
47
|
-
languageType: LanguageType;
|
|
48
|
-
iso639_3Code: string;
|
|
49
|
-
iso639_1Code: string;
|
|
50
|
-
name: string;
|
|
51
|
-
}
|
|
52
|
-
export declare const scriptNames: {
|
|
53
|
-
[key: string]: string;
|
|
54
|
-
};
|
|
55
|
-
export declare const isoCodesDetails: {
|
|
56
|
-
[key: string]: IIsoCodeDetailsInternal;
|
|
57
|
-
};
|
|
58
|
-
export declare const iso639_1To639_3: {
|
|
59
|
-
[key: string]: string;
|
|
60
|
-
};
|
|
61
|
-
export declare const indivlangsToMacrolangs: {
|
|
62
|
-
[key: string]: string;
|
|
63
|
-
};
|
|
64
|
-
export declare const macrolangsToRepresentativeLangs: {
|
|
65
|
-
[key: string]: string;
|
|
66
|
-
};
|
|
67
|
-
export declare const macrolanguagesByCode: {
|
|
68
|
-
[key: string]: ILanguage;
|
|
69
|
-
};
|
|
70
|
-
export declare function getLanguageType(iso639_3: string): LanguageType;
|
|
71
|
-
export declare function isMacrolanguage(iso639_3: string): boolean;
|
|
72
|
-
export declare function defaultScriptForLanguage(languageTag: string, language?: ILanguage): IScript | undefined;
|
|
73
|
-
export declare function getAllPossibleNames(entry: ILangtagsJsonEntryInternal): Set<string>;
|
|
74
|
-
export declare function uncomma(str: string | undefined): string | undefined;
|
|
75
|
-
export declare function uncommaAll(strs: Set<string>): Set<string>;
|
|
76
|
-
export declare function stripMacrolanguageParenthetical(languageName: string): string;
|
|
77
|
-
export declare function stripMacrolanguageParentheticalFromAll(names: Set<string>): Set<string>;
|
|
78
|
-
export {};
|