Skip to content

Commit

Permalink
GO-810 flagged more languages for geocoding
Browse files Browse the repository at this point in the history
  • Loading branch information
zdila committed Nov 25, 2024
1 parent 09757b0 commit 1127a63
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
### Others
- fixing typos
- languages are now ordered alphabetically

### Bug Fixes
- Fixed incorrect `geocoding: false` for some more languages

## 2.1.0
### New Features
Expand Down
40 changes: 20 additions & 20 deletions src/language.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export const ISOLanguage = {
name: "Amharic",
latin: false,
isMode: false,
geocoding: false,
geocoding: true,
} as LanguageInfo,

/**
Expand Down Expand Up @@ -163,7 +163,7 @@ export const ISOLanguage = {
name: "Basque",
latin: true,
isMode: false,
geocoding: false,
geocoding: true,
} as LanguageInfo,

/**
Expand All @@ -187,7 +187,7 @@ export const ISOLanguage = {
name: "Bengali",
latin: true,
isMode: false,
geocoding: false,
geocoding: true,
} as LanguageInfo,

/**
Expand Down Expand Up @@ -283,7 +283,7 @@ export const ISOLanguage = {
name: "Corsican",
latin: true,
isMode: false,
geocoding: false,
geocoding: true,
} as LanguageInfo,

/**
Expand Down Expand Up @@ -463,7 +463,7 @@ export const ISOLanguage = {
name: "Hindi",
latin: false,
isMode: false,
geocoding: false,
geocoding: true,
} as LanguageInfo,

/**
Expand Down Expand Up @@ -499,7 +499,7 @@ export const ISOLanguage = {
name: "Indonesian",
latin: true,
isMode: false,
geocoding: false,
geocoding: true,
} as LanguageInfo,

/**
Expand Down Expand Up @@ -643,7 +643,7 @@ export const ISOLanguage = {
name: "Kurdish",
latin: true,
isMode: false,
geocoding: false,
geocoding: true,
} as LanguageInfo,

/**
Expand Down Expand Up @@ -715,7 +715,7 @@ export const ISOLanguage = {
name: "Malayalam",
latin: false,
isMode: false,
geocoding: false,
geocoding: true,
} as LanguageInfo,

/**
Expand Down Expand Up @@ -751,7 +751,7 @@ export const ISOLanguage = {
name: "Occitan",
latin: true,
isMode: false,
geocoding: false,
geocoding: true,
} as LanguageInfo,

/**
Expand All @@ -763,7 +763,7 @@ export const ISOLanguage = {
name: "Persian",
latin: false,
isMode: false,
geocoding: false,
geocoding: true,
} as LanguageInfo,

/**
Expand Down Expand Up @@ -799,7 +799,7 @@ export const ISOLanguage = {
name: "Punjabi",
latin: false,
isMode: false,
geocoding: false,
geocoding: true,
} as LanguageInfo,

/**
Expand Down Expand Up @@ -943,7 +943,7 @@ export const ISOLanguage = {
name: "Tamil",
latin: false,
isMode: false,
geocoding: false,
geocoding: true,
} as LanguageInfo,

/**
Expand All @@ -955,7 +955,7 @@ export const ISOLanguage = {
name: "Telugu",
latin: false,
isMode: false,
geocoding: false,
geocoding: true,
} as LanguageInfo,

/**
Expand Down Expand Up @@ -1003,7 +1003,7 @@ export const ISOLanguage = {
name: "Vietnamese (Latin script)",
latin: true,
isMode: false,
geocoding: false,
geocoding: true,
} as LanguageInfo,

/**
Expand Down Expand Up @@ -1034,7 +1034,7 @@ export const Language = {
*/
export function getLanguageInfoFromKey(
languageKey: string,
languageDictionary: { [k: string]: LanguageInfo } = Language,
languageDictionary: { [k: string]: LanguageInfo } = Language
): LanguageInfo | null {
if (languageKey in languageDictionary) {
return languageKey[languageKey];
Expand All @@ -1049,7 +1049,7 @@ export function getLanguageInfoFromKey(
*/
export function getLanguageInfoFromCode(
languageCode: string,
languageDictionary: { [k: string]: LanguageInfo } = Language,
languageDictionary: { [k: string]: LanguageInfo } = Language
): LanguageInfo | null {
for (const lang of Object.values(languageDictionary)) {
if (lang.code === languageCode) {
Expand All @@ -1067,7 +1067,7 @@ export function getLanguageInfoFromCode(
*/
export function getLanguageInfoFromFlag(
languageFlag: string,
languageDictionary: { [k: string]: LanguageInfo } = Language,
languageDictionary: { [k: string]: LanguageInfo } = Language
): LanguageInfo | null {
for (const lang of Object.values(languageDictionary)) {
if (lang.flag === languageFlag) {
Expand All @@ -1088,7 +1088,7 @@ export function getAutoLanguage(): LanguageInfo {
}

const canditatelangs = Array.from(
new Set(navigator.languages.map((l) => l.split("-")[0])),
new Set(navigator.languages.map((l) => l.split("-")[0]))
)
.map((code) => getLanguageInfoFromCode(code))
.filter((li) => li);
Expand Down Expand Up @@ -1120,7 +1120,7 @@ export function isLanguageInfo(obj: unknown): obj is LanguageInfo {
*/
export function toLanguageInfo(
lang: LanguageInfo | string,
languageDictionary: { [k: string]: LanguageInfo } = Language,
languageDictionary: { [k: string]: LanguageInfo } = Language
): LanguageInfo | null {
// Could be directly an object of type LanguageInfo
if (isLanguageInfo(lang)) {
Expand Down Expand Up @@ -1149,7 +1149,7 @@ export function toLanguageInfo(
export function areSameLanguages(
langA: string | LanguageInfo,
langB: string | LanguageInfo,
languageDictionary: { [k: string]: LanguageInfo } = Language,
languageDictionary: { [k: string]: LanguageInfo } = Language
): boolean {
const langAObj = toLanguageInfo(langA, languageDictionary);
const langBObj = toLanguageInfo(langB, languageDictionary);
Expand Down

0 comments on commit 1127a63

Please sign in to comment.