-
Notifications
You must be signed in to change notification settings - Fork 63
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
Implement language switching in URL querystring #20
Comments
The following library may be of use: |
This script predates expressions and uses the deprecated string interpolation syntax, so it’s incompatible with this project. It also isn’t distributed as an NPM package. There is a compatible Mapbox GL JS library for localizing labels. However, I don’t think a library is necessary at all. Unlike most styles that are distributed in static JSON format, Americana is built at runtime in JavaScript, giving us the ability to inject environment variables like the language as we build each layer. #578 implements this approach without needing to hard-code a single #578 relies on user preferences, but I agree that it would be handy to be able to set the language inside the URL. There are two typical approaches to implementing a URL-based language switch:
|
Can also switch to esbuild's |
Depends on #19
A key feature of vector tiles is the ability to switch languages for name labels. OpenMapTiles provides
name:xx
tags wherever aname
tag is available. Proposed is that the following parameters can be parsed from the querystring:*
lang0=xx
- usename:xx
tag for name features*
langN=xx
- usename:xx
as a fallback language if thelang0
language is not available. N is numbered from 1 and counting upIf none of the specified languages or fallback languages are set, this will default to one of the standard name values (one of
name
,name_int
, orname_latin
).In javascript, a JSON fragment will need to be generated which creates a case statement to switch the specified language names, which is then inserted into the appropriate locations in the style JSON variables.
The text was updated successfully, but these errors were encountered: