Skip to content

Commit

Permalink
GO-733 fixed Czech language geocoding flag
Browse files Browse the repository at this point in the history
  • Loading branch information
zdila committed Nov 6, 2024
1 parent 4d5269a commit 1557aef
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# MapTiler Client Changelog

## 2.0.1
### Bug Fixes
- Fixed Czech language geocoding flag

## 2.0.0
### New Features
- Added `matching_text` and `matching_place_name` properties to geocoding feature response
Expand Down
14 changes: 7 additions & 7 deletions src/language.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ export const Language = {
name: "Czech",
latin: true,
isMode: false,
geocoding: false,
geocoding: true,
} as LanguageInfo,

/**
Expand Down Expand Up @@ -1021,7 +1021,7 @@ export const Language = {
*/
export function getLanguageInfoFromKey(
languageKey: string,
languageDictionnary: { [k: string]: LanguageInfo } = Language,
languageDictionnary: { [k: string]: LanguageInfo } = Language
): LanguageInfo | null {
if (languageKey in languageDictionnary) {
return languageKey[languageKey];
Expand All @@ -1036,7 +1036,7 @@ export function getLanguageInfoFromKey(
*/
export function getLanguageInfoFromCode(
languageCode: string,
languageDictionnary: { [k: string]: LanguageInfo } = Language,
languageDictionnary: { [k: string]: LanguageInfo } = Language
): LanguageInfo | null {
for (const lang of Object.values(languageDictionnary)) {
if (lang.code === languageCode) {
Expand All @@ -1054,7 +1054,7 @@ export function getLanguageInfoFromCode(
*/
export function getLanguageInfoFromFlag(
languageFlag: string,
languageDictionnary: { [k: string]: LanguageInfo } = Language,
languageDictionnary: { [k: string]: LanguageInfo } = Language
): LanguageInfo | null {
for (const lang of Object.values(languageDictionnary)) {
if (lang.flag === languageFlag) {
Expand All @@ -1075,7 +1075,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 @@ -1107,7 +1107,7 @@ export function isLanguageInfo(obj: unknown): obj is LanguageInfo {
*/
export function toLanguageInfo(
lang: LanguageInfo | string,
languageDictionnary: { [k: string]: LanguageInfo } = Language,
languageDictionnary: { [k: string]: LanguageInfo } = Language
): LanguageInfo | null {
// Could be directly an object of type LanguageInfo
if (isLanguageInfo(lang)) {
Expand Down Expand Up @@ -1136,7 +1136,7 @@ export function toLanguageInfo(
export function areSameLanguages(
langA: string | LanguageInfo,
langB: string | LanguageInfo,
languageDictionnary: { [k: string]: LanguageInfo } = Language,
languageDictionnary: { [k: string]: LanguageInfo } = Language
): boolean {
const langAObj = toLanguageInfo(langA, languageDictionnary);
const langBObj = toLanguageInfo(langB, languageDictionnary);
Expand Down

0 comments on commit 1557aef

Please sign in to comment.