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

Gloss city names in the local language #592

Merged
merged 10 commits into from
Dec 5, 2022
128 changes: 128 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"open": "^8.4.0"
},
"devDependencies": {
"@maplibre/maplibre-gl-style-spec": "^17.0.1",
"chai": "^4.3.7",
"create-serve": "^1.0.1",
"esbuild": "^0.15.15",
Expand Down
18 changes: 2 additions & 16 deletions src/americana.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,22 +255,7 @@ function buildLayers() {
lyrPlace.continent
);

// Resolve localized name placeholders.
let localizedNameExpression = Label.getLocalizedNameExpression(false);
let legacyLocalizedNameExpression = Label.getLocalizedNameExpression(true);
for (let layer of layers) {
if (
"metadata" in layer &&
"layout" in layer &&
layer.metadata["americana:text-field-localized"] === true
) {
// https://github.com/openmaptiles/openmaptiles/issues/769
layer.layout["text-field"] =
layer["source-layer"] === "transportation_name"
? legacyLocalizedNameExpression
: localizedNameExpression;
}
}
Label.localizeLayers(layers, Label.getLocales());

return layers;
}
Expand Down Expand Up @@ -316,6 +301,7 @@ maplibregl.setRTLTextPlugin(
true
);

window.maplibregl = maplibregl;
export const map = (window.map = new maplibregl.Map({
container: "map", // container id
hash: "map",
Expand Down
Loading