diff --git a/umap/static/umap/js/modules/i18n.js b/umap/static/umap/js/modules/i18n.js index d2b6b429..02c90997 100644 --- a/umap/static/umap/js/modules/i18n.js +++ b/umap/static/umap/js/modules/i18n.js @@ -1,7 +1,7 @@ // Comes from https://github.com/Leaflet/Leaflet/pull/9281 import { Util } from '../../vendors/leaflet/leaflet-src.esm.js' -const locales = {} +export const locales = {} // @property locale: String // The current locale code, that will be used when translating strings. @@ -19,7 +19,7 @@ export function setLocale(code) { } // @function translate(string: String, data?: Object): String // Actually try to translate the `string`, with optionnal variable passed in `data`. -export function translate(string, data) { +export function translate(string, data = {}) { if (locale && locales[locale] && locales[locale][string] !== undefined) { string = locales[locale][string] } diff --git a/umap/static/umap/js/modules/leaflet-configure.js b/umap/static/umap/js/modules/leaflet-configure.js index 9679f3f4..b7b502ff 100644 --- a/umap/static/umap/js/modules/leaflet-configure.js +++ b/umap/static/umap/js/modules/leaflet-configure.js @@ -4,3 +4,4 @@ import * as L from '../../vendors/leaflet/leaflet-src.esm.js' import * as i18n from './i18n.js' window.L = { ...L, ...i18n } +window.L._ = i18n.translate diff --git a/umap/static/umap/test/index.html b/umap/static/umap/test/index.html index 9d6da7d4..e01794a3 100644 --- a/umap/static/umap/test/index.html +++ b/umap/static/umap/test/index.html @@ -8,7 +8,6 @@ - diff --git a/umap/templates/umap/js.html b/umap/templates/umap/js.html index bcc700f0..86ea502e 100644 --- a/umap/templates/umap/js.html +++ b/umap/templates/umap/js.html @@ -12,7 +12,6 @@ -