Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/geolibre-desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"maplibre-gl-raster": "^0.6.3",
"maplibre-gl-splat": "^0.2.8",
"maplibre-gl-streetview": "^0.7.0",
"maplibre-gl-swipe": "^0.10.0",
"maplibre-gl-swipe": "^0.10.1",
"maplibre-gl-time-slider": "^1.1.0",
"maplibre-gl-usgs-lidar": "^0.11.0",
"maplibre-gl-vector": "^0.8.0",
Expand Down
9 changes: 7 additions & 2 deletions apps/geolibre-desktop/src/lib/swipe-style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,11 @@ const enhanceSwipeSelects = () => {

let swipeEnhanceFrame: number | null = null;

// Matches the label used by the main layer manager for the grouped base layer.
const SWIPE_BASEMAP_LABEL = "Background";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i18n gap (medium confidence). The main layer manager renders this label through t("layers.background") (LayerPanel.tsx:2075). Because swipe-style.ts runs outside the React tree it can't call t(), so the string is hardcoded in English. In a non-English locale the swipe panel will always show "Background" while the sidebar shows the translated label.

The existing __GEOLIBRE_LAYER_LABELS__ / geolibre-layer-labels-change bridge (populated by map-controller.ts) is the natural extension point: the publisher could include a __basemap__ entry keyed to the already-translated string, letting this file stay DOM-only while picking up the correct locale. That is out of scope here, but a follow-up issue would keep the two surfaces in sync across locales.

No code change required for this PR; leaving as a note.


const getSwipeLayerLabel = (layerId: string): string => {
if (layerId === "__basemap__") return "Basemap";
if (layerId === "__basemap__") return SWIPE_BASEMAP_LABEL;
return (
(window as GeoLibreLayerLabelWindow).__GEOLIBRE_LAYER_LABELS__?.[layerId] ??
layerId
Expand All @@ -283,7 +286,9 @@ const syncSwipeLayerLabels = () => {

const displayName = getSwipeLayerLabel(layerId);
const title =
layerId === "__basemap__" ? "Basemap" : `${displayName} (${layerId})`;
layerId === "__basemap__"
? SWIPE_BASEMAP_LABEL
: `${displayName} (${layerId})`;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit – tooltip is now identical to the label for the basemap

For every other layer the tooltip is "displayName (layerId)", giving a hover hint with the raw layer ID. For __basemap__ the tooltip becomes "Background" – the same text as the visible label – so hovering adds no information.

Exposing the internal sentinel __basemap__ directly would be confusing, but a short disambiguating phrase would make the tooltip meaningful without leaking internals:

Suggested change
: `${displayName} (${layerId})`;
? `${SWIPE_BASEMAP_LABEL} (base layer)`

Low urgency – the pre-existing code had the same pattern (just with "Basemap" for both label and tooltip) – but worth fixing while this line is in motion.

if (label.textContent !== displayName) {
label.textContent = displayName;
}
Expand Down
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/plugins/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"maplibre-gl-planetary-computer": "^0.3.0",
"maplibre-gl-raster": "^0.6.3",
"maplibre-gl-streetview": "^0.7.0",
"maplibre-gl-swipe": "^0.10.0",
"maplibre-gl-swipe": "^0.10.1",
"maplibre-gl-time-slider": "^1.1.0",
"maplibre-gl-usgs-lidar": "^0.11.0",
"maplibre-gl-vector": "^0.8.0",
Expand Down
Loading