@1ec5 commented on this pull request.
> @@ -9,6 +14,43 @@ L.extend(L.LatLngBounds.prototype, {
}
});
+if (OSM.MAPTILER_KEY) {
+ maplibregl.setRTLTextPlugin(
+
"https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js",
To avoid this external dependency on a Mapbox API, install the
`@mapbox/mapbox-gl-rtl-text` package and have a build script copy
node_modules/@mapbox/mapbox-gl-rtl-text/dist/mapbox-gl-rtl-text.js into
app/assets/javascripts/. Then this becomes just `mapbox-gl-rtl-text.js`.
> + var mainLocale = I18n.locale.slice(0, 2);
+ var localeIndex = supportedLanguages.findIndex(function (locale) {
+ return locale === mainLocale;
+ });
This website and maplibre-gl-omt-language both support some locales that have
three-character-long language codes, such as [Western
Punjabi](https://github.com/openstreetmap/openstreetmap-website/blob/e206dd527ef7c6d1829f131533d722e536e4bfb5/config/locales/pnb.yml)
(pnb). I don’t think this code will match such locales. If I’m not mistaken,
the intention is to match on only the language code and ignore any script or
country code. If so, this would be more robust:
```suggestion
var mainLocale = I18n.locale.split('-')[0];
var localeIndex = supportedLanguages.findIndex(function (locale) {
return locale === mainLocale;
});
```
Note that this is still quite a rudimentary locale matching heuristic. It won’t
match `zh-Hans` or `zh-Hant`, which the plugin also supports.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/4042#pullrequestreview-2603380276
You are receiving this because you are subscribed to this thread.
Message ID:
<openstreetmap/openstreetmap-website/pull/4042/review/2603380...@github.com>
_______________________________________________
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev