Skip to content

Commit 543d6d2

Browse files
committed
add localizations to world map
1 parent 7f5e090 commit 543d6d2

37 files changed

+385
-19
lines changed

src/controls/worldMap/MapNavigation.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313

1414
import { MapRef } from 'react-map-gl/maplibre';
1515
import { css } from '@emotion/css';
16+
import strings from 'ControlStrings';
1617

1718
export interface MapNavigationProps {
1819
mapRef: React.RefObject<MapRef>;
@@ -64,11 +65,11 @@ export const MapNavigation: React.FC<MapNavigationProps> = ({
6465

6566
return (
6667
<div className={vertical ? `${navStyle} ${navStyleVertical}` : navStyle}>
67-
<Tooltip content="Zoom in" relationship="label">
68+
<Tooltip content={strings.worldMapZoomContent} relationship="label">
6869
<Button
6970
appearance="subtle"
7071
icon={<ZoomIn24Regular />}
71-
aria-label="Zoom in"
72+
aria-label={strings.worldMapZoomIn}
7273
className={buttonStyle}
7374
onClick={handleZoomIn}
7475
/>
@@ -77,7 +78,7 @@ export const MapNavigation: React.FC<MapNavigationProps> = ({
7778
<Button
7879
appearance="subtle"
7980
icon={<ZoomOut24Regular />}
80-
aria-label="Zoom out"
81+
aria-label={strings.worldMapZoomOut}
8182
className={buttonStyle}
8283
onClick={handleZoomOut}
8384
/>
@@ -86,7 +87,7 @@ export const MapNavigation: React.FC<MapNavigationProps> = ({
8687
<Button
8788
appearance="subtle"
8889
icon={<ArrowReset24Regular />}
89-
aria-label="Reset"
90+
aria-label={strings.worldMapReset}
9091
className={buttonStyle}
9192
onClick={handleReset}
9293
/>

src/controls/worldMap/Marker.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Marker as MapMarker } from 'react-map-gl/maplibre';
77
import TooltipContent from './TooltipContent';
88
import { css } from '@emotion/css';
99

10-
const useStyles = () => {
10+
const useStyles = (): { flag: string; tooltipContent: string } => {
1111
return {
1212
flag: css`
1313
width: 22px;

src/controls/worldMap/TooltipContent.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77

88
import { IData } from "./IData";
99
import { css } from "@emotion/css";
10+
import strings from "ControlStrings";
1011

1112
export interface CountryTooltipContentProps {
1213
data: IData;
@@ -62,9 +63,9 @@ export const TooltipContent: React.FC<CountryTooltipContentProps> = ({
6263
<Text className={titleStyles}>{data.name}</Text>
6364
</div>
6465
<div className={rowStyles}>
65-
<Text className={subTitleStyles}>Coord:</Text>
66-
<Text>{data.coordinates[1].toFixed(2)}° N</Text>
67-
<Text>{data.coordinates[0].toFixed(2)}° E</Text>
66+
<Text className={subTitleStyles}>{strings.worldMapCoord}</Text>
67+
<Text>{data.coordinates[1].toFixed(2)}{strings.worldMapN}</Text>
68+
<Text>{data.coordinates[0].toFixed(2)}{strings.worldMapE}</Text>
6869
</div>
6970
</div>
7071
);

src/controls/worldMap/WorldMapControl.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { IMaplibreWorldMapProps } from './IMaplibreWorldMapProps';
1111
import MapNavigation from './MapNavigation';
1212
import Marker from './Marker';
1313
import { css } from '@emotion/css';
14+
import strings from 'ControlStrings';
1415
import { useCleanMapStyle } from './useCleanMapStyle';
1516

1617
const MULTI_STYLE_URLS = {
@@ -97,8 +98,8 @@ export const MaplibreWorldMap: React.FC<IMaplibreWorldMapProps> = ({
9798
// Search configuration with defaults
9899
const searchConfig = useMemo(() => ({
99100
enabled: search?.enabled ?? true,
100-
placeholder: search?.placeholder ?? 'Search locations...',
101-
searchField: search?.searchField ?? 'name',
101+
placeholder: search?.placeholder ?? strings.worldMapSearchLocations,
102+
searchField: search?.searchField ?? strings.worldMapSearchField,
102103
zoomLevel: search?.zoomLevel ?? 8,
103104
position: {
104105
top: '10px',
@@ -209,12 +210,12 @@ export const MaplibreWorldMap: React.FC<IMaplibreWorldMapProps> = ({
209210
}, [filteredData, fitPadding]);
210211

211212
if (!cleanStyle) {
212-
return <Text>Loading map style…</Text>;
213+
return <Text>{strings.worldMapLoadintText}</Text>;
213214
}
214215

215216
return (
216217
<div className={styles.container}>
217-
<Subtitle1>{title ?? 'World Map'}</Subtitle1>
218+
<Subtitle1>{title ?? strings.worldMapTitle}</Subtitle1>
218219
<div className={styles.mapContainer}>
219220
<Map
220221
ref={mapRef}
@@ -259,8 +260,8 @@ export const MaplibreWorldMap: React.FC<IMaplibreWorldMapProps> = ({
259260
/>
260261
{searchTerm && (
261262
<div className={styles.searchResults}>
262-
{filteredData.length} ___location
263-
{filteredData.length !== 1 ? 's' : ''} found
263+
{filteredData.length} {strings.worldMapLocationLabel}
264+
{filteredData.length !== 1 ? 's' : ''} {strings.worldMapFoundLabel}
264265
</div>
265266
)}
266267
</div>

src/controls/worldMap/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
export * from './IData';
22
export * from './IWorldMapProps';
33
export * from './IMaplibreWorldMapProps';
4-
54
export * from './WorldMap';
65
export * from './WorldMapControl';
76

src/loc/bg-bg.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ define([], () => {
55
CalendarControlDayOfWeekSunday: "Sunday",
66
TermSertNaviagtionErrorMessage: "TermSet not found",
77
TermSetNavigationNoTerms: "No terms defined",
8+
worldMapCoord: "Coord:",
9+
worldMapE: "° E",
10+
worldMapFoundLabel: "found",
11+
worldMapLoadintText: "Loading map style…",
12+
worldMapLocationLabel: "___location",
13+
worldMapN: "° N",
14+
worldMapSearchField: "name",
15+
worldMapSearchLocations: "Search locations...",
16+
worldMapTitle: "World Map",
17+
worldMapZoomContent: "Zoom in",
18+
worldMapZoomIn: "Zoom in",
819
"Save": "Спасявам",
920
"Cancel": "Задрасквам",
1021
"SiteBreadcrumbLabel": "Сайт за хляб",

src/loc/ca-es.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ define([], () => {
55
CalendarControlDayOfWeekSunday: "Sunday",
66
TermSertNaviagtionErrorMessage: "TermSet not found",
77
TermSetNavigationNoTerms: "No terms defined",
8+
worldMapCoord: "Coord:",
9+
worldMapE: "° E",
10+
worldMapFoundLabel: "found",
11+
worldMapLoadintText: "Loading map style…",
12+
worldMapLocationLabel: "___location",
13+
worldMapN: "° N",
14+
worldMapSearchField: "name",
15+
worldMapSearchLocations: "Search locations...",
16+
worldMapTitle: "World Map",
17+
worldMapZoomContent: "Zoom in",
18+
worldMapZoomIn: "Zoom in",
819
"Save": "Salvar",
920
"Cancel": "Cancel·lar",
1021
"SiteBreadcrumbLabel": "Lloc web d'engruna",

src/loc/cs-cz.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,5 +478,16 @@ define([], () => {
478478
ImagePickerUploadLocationSharePointLabel: "Aktuální web",
479479
ImagePickerRetryButtonLabel: "Zkusit znovu",
480480
ImagePickerDeleteLabel: "Odstranit",
481+
worldMapCoord: "Coord:",
482+
worldMapE: "° E",
483+
worldMapFoundLabel: "found",
484+
worldMapLoadintText: "Loading map style…",
485+
worldMapLocationLabel: "___location",
486+
worldMapN: "° N",
487+
worldMapSearchField: "name",
488+
worldMapSearchLocations: "Search locations...",
489+
worldMapTitle: "World Map",
490+
worldMapZoomContent: "Zoom in",
491+
worldMapZoomIn: "Zoom in",
481492
};
482493
});

src/loc/da-dk.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ define([], () => {
55
CalendarControlDayOfWeekSunday: "Sunday",
66
TermSertNaviagtionErrorMessage: "TermSet not found",
77
TermSetNavigationNoTerms: "No terms defined",
8+
worldMapCoord: "Coord:",
9+
worldMapE: "° E",
10+
worldMapFoundLabel: "found",
11+
worldMapLoadintText: "Loading map style…",
12+
worldMapLocationLabel: "___location",
13+
worldMapN: "° N",
14+
worldMapSearchField: "name",
15+
worldMapSearchLocations: "Search locations...",
16+
worldMapTitle: "World Map",
17+
worldMapZoomContent: "Zoom in",
18+
worldMapZoomIn: "Zoom in",
819
"Save": "Spare",
920
"Cancel": "Aflyse",
1021
"SiteBreadcrumbLabel": "Hjemmeside breadcrumb",

src/loc/de-de.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ define([], () => {
55
CalendarControlDayOfWeekSunday: "Sunday",
66
TermSertNaviagtionErrorMessage: "TermSet not found",
77
TermSetNavigationNoTerms: "No terms defined",
8+
worldMapCoord: "Coord:",
9+
worldMapE: "° E",
10+
worldMapFoundLabel: "found",
11+
worldMapLoadintText: "Loading map style…",
12+
worldMapLocationLabel: "___location",
13+
worldMapN: "° N",
14+
worldMapSearchField: "name",
15+
worldMapSearchLocations: "Search locations...",
16+
worldMapTitle: "World Map",
17+
worldMapZoomContent: "Zoom in",
18+
worldMapZoomIn: "Zoom in",
819
"Save": "Speichern",
920
"Cancel": "Abbrechen",
1021
"SiteBreadcrumbLabel": "Website Brotkrume",

0 commit comments

Comments
 (0)