Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RD-294: Move the list of map languages to maptiler-client #42

Merged
merged 13 commits into from
Sep 6, 2024

Conversation

jonathanlurie
Copy link
Contributor

@jonathanlurie jonathanlurie commented Sep 4, 2024

RD-294

The goal is to centralize the list of languages so that it can be used by multiple JS/TS tools and libraries.

Copy link
Contributor

@zdila zdila left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For addLanguageGeocodingOptions we should probably not auto-detect it on client-side but on server-side, which is already implemented. That implementation uses Accept-Language parameter and takes q value into the account together with support of every provided language. Current implementation of addLanguageGeocodingOptions which uses getAutoLanguageGeocoding may pass also unsupported language if navigator is undefined.

Actually if language is not specified in options, this server-side detection applies as the language url parameter is not added.

Also we should add support for no language preference which would result in searchParams.set("language", "") call. I think that Language.LOCAL could be used for this althought it is not 100% the same thing, as you will find London also when you type Londýn even you did not specify Slovak language.

src/language.ts Show resolved Hide resolved
src/language.ts Outdated Show resolved Hide resolved
src/language.ts Outdated Show resolved Hide resolved
src/language.ts Outdated Show resolved Hide resolved
@zdila
Copy link
Contributor

zdila commented Sep 4, 2024

I also prefer to use ternaries to multiple if (condA) return A; if (condB) return B; ... return X; - so rather return condA ? A : condB ? B : X;.

Also I prefer not using temporary variables, like let foo = bar(); return foo; but rather use return bar(); directly.

But it is only my subjective preference.

@jonathanlurie jonathanlurie merged commit 4d5269a into main Sep 6, 2024
1 check passed
@jonathanlurie jonathanlurie deleted the RD-294 branch September 6, 2024 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants