diff options
| author | Dennis Fink | 2026-07-23 00:18:21 +0200 |
|---|---|---|
| committer | Dennis Fink | 2026-07-23 00:18:21 +0200 |
| commit | 1fe1d13c600b7dfe421b3b99b833b7d5d1232724 (patch) | |
| tree | 2e8636160cc1719c907be56f5ef8cbc7e0f10a53 /assets/static/vendor/leaflet-i18n | |
| parent | ca77de06be474dfd712402c327dc436864d233a3 (diff) | |
| download | dennisfink.me-1fe1d13c600b7dfe421b3b99b833b7d5d1232724.tar.gz dennisfink.me-1fe1d13c600b7dfe421b3b99b833b7d5d1232724.zip | |
Add GPX trail maps to blog posts
This adds a trail flow block so posts can include attached GPX files as
interactive maps with route display, elevation charts, activity
summaries, and start/finish markers.
The trail assets are loaded only when needed, keeping the shared
templates clean while vendoring the Leaflet dependencies required for
offline, self-hosted map rendering.
Diffstat (limited to 'assets/static/vendor/leaflet-i18n')
| -rw-r--r-- | assets/static/vendor/leaflet-i18n/leaflet-i18n.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/assets/static/vendor/leaflet-i18n/leaflet-i18n.js b/assets/static/vendor/leaflet-i18n/leaflet-i18n.js new file mode 100644 index 0000000..9456214 --- /dev/null +++ b/assets/static/vendor/leaflet-i18n/leaflet-i18n.js @@ -0,0 +1,41 @@ +// Following https://github.com/Leaflet/Leaflet/blob/master/PLUGIN-GUIDE.md +(function (factory, window) { + + // define an AMD module that relies on 'leaflet' + if (typeof define === 'function' && define.amd) { + define(['leaflet'], factory); + + // define a Common JS module that relies on 'leaflet' + } else if (typeof exports === 'object') { + module.exports = factory(require('leaflet')); + } + + // attach your plugin to the global 'L' variable + if (typeof window !== 'undefined' && window.L) { + factory(window.L); + + } +}(function (L) { + L.locales = {}; + L.locale = null; + L.registerLocale = function registerLocale(code, locale) { + L.locales[code] = L.Util.extend({}, L.locales[code], locale); + }; + L.setLocale = function setLocale(code) { + L.locale = code; + }; + return L.i18n = L._ = function translate(string, data) { + if (L.locale && L.locales[L.locale] && typeof L.locales[L.locale][string] !== "undefined") { + string = L.locales[L.locale][string]; + } + try { + // Do not fail if some data is missing + // a bad translation should not break the app + string = L.Util.template(string, data); + } + catch (err) {/*pass*/ + } + + return string; + }; +}, window)); |
