mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2026-06-10 01:10:25 +00:00
localization of OpenMapTiles styles
This commit is contained in:
@@ -225,8 +225,8 @@ export class StyleManager {
|
|||||||
}
|
}
|
||||||
if (layer.type === 'symbol' && layer.layout && layer.layout['text-field']) {
|
if (layer.type === 'symbol' && layer.layout && layer.layout['text-field']) {
|
||||||
const textField = layer.layout['text-field'];
|
const textField = layer.layout['text-field'];
|
||||||
|
if (Array.isArray(textField)) {
|
||||||
if (
|
if (
|
||||||
Array.isArray(textField) &&
|
|
||||||
textField.length == 4 &&
|
textField.length == 4 &&
|
||||||
Array.isArray(textField[3]) &&
|
Array.isArray(textField[3]) &&
|
||||||
textField[3][0] === 'coalesce' &&
|
textField[3][0] === 'coalesce' &&
|
||||||
@@ -235,12 +235,29 @@ export class StyleManager {
|
|||||||
typeof textField[3][1][1] === 'string' &&
|
typeof textField[3][1][1] === 'string' &&
|
||||||
textField[3][1][1].startsWith('name')
|
textField[3][1][1].startsWith('name')
|
||||||
) {
|
) {
|
||||||
|
// OpenFreeMap styles
|
||||||
layer.layout['text-field'] = [
|
layer.layout['text-field'] = [
|
||||||
'coalesce',
|
'coalesce',
|
||||||
['get', `name:${i18n.lang}`],
|
['get', `name:${i18n.lang}`],
|
||||||
['get', 'name'],
|
['get', 'name'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
if (
|
||||||
|
textField.length == 3 &&
|
||||||
|
textField[0] === 'coalesce' &&
|
||||||
|
Array.isArray(textField[1]) &&
|
||||||
|
textField[1][0] === 'get' &&
|
||||||
|
typeof textField[1][1] === 'string' &&
|
||||||
|
textField[1][1].startsWith('name')
|
||||||
|
) {
|
||||||
|
// OpenMapTiles styles
|
||||||
|
layer.layout['text-field'] = [
|
||||||
|
'coalesce',
|
||||||
|
['get', `name:${i18n.lang}`],
|
||||||
|
['get', 'name'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
style.layers.push(layer);
|
style.layers.push(layer);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user