fix: fix L.locale no more set
This commit is contained in:
parent
cf61495815
commit
5d88e0e270
4 changed files with 12 additions and 3 deletions
|
@ -17,6 +17,13 @@ export function registerLocale(code, locale) {
|
||||||
export function setLocale(code) {
|
export function setLocale(code) {
|
||||||
locale = code
|
locale = code
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Until we have a proper way to load `locale` directly from this module,
|
||||||
|
// without copying to window.L we need to have a getter
|
||||||
|
export function getLocale() {
|
||||||
|
return locale
|
||||||
|
}
|
||||||
|
|
||||||
// @function translate(string: String, data?: Object): String
|
// @function translate(string: String, data?: Object): String
|
||||||
// Actually try to translate the `string`, with optionnal variable passed in `data`.
|
// Actually try to translate the `string`, with optionnal variable passed in `data`.
|
||||||
export function translate(string, data = {}) {
|
export function translate(string, data = {}) {
|
||||||
|
|
|
@ -533,7 +533,8 @@ U.FeatureMixin = {
|
||||||
extendedProperties: function () {
|
extendedProperties: function () {
|
||||||
// Include context properties
|
// Include context properties
|
||||||
properties = this.map.getGeoContext()
|
properties = this.map.getGeoContext()
|
||||||
if (L.locale) properties.locale = L.locale
|
const locale = L.getLocale()
|
||||||
|
if (locale) properties.locale = locale
|
||||||
if (L.lang) properties.lang = L.lang
|
if (L.lang) properties.lang = L.lang
|
||||||
properties.rank = this.getRank() + 1
|
properties.rank = this.getRank() + 1
|
||||||
if (this.hasGeom()) {
|
if (this.hasGeom()) {
|
||||||
|
|
|
@ -1767,7 +1767,7 @@ U.Map = L.Map.extend({
|
||||||
const url = this.urls.get('routing', {
|
const url = this.urls.get('routing', {
|
||||||
lat: e.latlng.lat,
|
lat: e.latlng.lat,
|
||||||
lng: e.latlng.lng,
|
lng: e.latlng.lng,
|
||||||
locale: L.locale,
|
locale: L.getLocale(),
|
||||||
zoom: this.getZoom(),
|
zoom: this.getZoom(),
|
||||||
})
|
})
|
||||||
if (url) window.open(url)
|
if (url) window.open(url)
|
||||||
|
|
|
@ -263,7 +263,8 @@ U.PopupTemplate.OSM = U.PopupTemplate.Default.extend({
|
||||||
|
|
||||||
getName: function () {
|
getName: function () {
|
||||||
const props = this.feature.properties
|
const props = this.feature.properties
|
||||||
if (L.locale && props[`name:${L.locale}`]) return props[`name:${L.locale}`]
|
const locale = L.getLocale()
|
||||||
|
if (locale && props[`name:${locale}`]) return props[`name:${locale}`]
|
||||||
return props.name
|
return props.name
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue