Skip to content

Commit

Permalink
Includes work RD-225
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanlurie committed Mar 13, 2024
1 parent 7521ebe commit 46366f7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -994,25 +994,25 @@ export class Map extends maplibregl.Map {
}

const layer = genericLayer as SymbolLayerSpecification;
const source = this.getSource(layer.source)
const source = this.getSource(layer.source);

// Only a layer that is bound to a valid source is considered for language switching
if (!source) {
continue;
}

// Only source with a url are considered
if (!("url" in source && typeof source.url === "string") ) {
if (!("url" in source && typeof source.url === "string")) {
continue;
}

const sourceURL = new URL(source.url);

// Only layers managed by MapTiler are considered for language switch
if (sourceURL.host !== defaults.maptilerApiHost) {
continue;
}

const { id, layout } = layer;

if (!layout) {
Expand All @@ -1022,15 +1022,15 @@ export class Map extends maplibregl.Map {
if (!("text-field" in layout)) {
continue;
}

const textFieldLayoutProp = this.getLayoutProperty(id, "text-field");

// If the label is not about a name, then we don't translate it
if (
typeof textFieldLayoutProp === "string" &&
(textFieldLayoutProp.toLowerCase().includes("ref") ||
textFieldLayoutProp.toLowerCase().includes("housenumber"))
) {
) {
continue;
}

Expand Down

0 comments on commit 46366f7

Please sign in to comment.