diff --git a/library/maps/localize-labels.js b/library/maps/localize-labels.js index 2df2f1b9d..25a72e733 100644 --- a/library/maps/localize-labels.js +++ b/library/maps/localize-labels.js @@ -30,7 +30,7 @@ function isMaplibreMap(map) { } /** - * Point the basemap's place-name labels at `lang` ('en' = the style's own labels). + * Point the basemap's place-name labels at `lang` (every language, English included). * Call after style.load, and again whenever the reader's language changes. * @returns {number} how many label layers were localized (0 on Mapbox, which localizes internally) */ @@ -58,9 +58,10 @@ export function localizeBasemapLabels(map, lang) { if (!OSM_NAME_FIELD.test(json)) continue // a plugin's own label: leave it saved.set(layer.id, current) } else if (!saved.has(layer.id)) continue - const next = code === 'en' - ? saved.get(layer.id) - : ['coalesce', ['get', 'name:' + code], ['get', 'name:latin'], ['get', 'name']] + // English too, not the style's own bilingual labels ("Россия" under "Russia"): those drew every + // native script at world view, so an English page fetched 13 extra glyph ranges (~600 KB, rega: + // Prayer Progress 18 requests / 777 KB in en against 5 / 185 KB in ar). One language per label. + const next = ['coalesce', ['get', 'name:' + code], ['get', 'name:latin'], ['get', 'name']] map.setLayoutProperty(layer.id, 'text-field', next) n++ }