diff --git a/astro.config.mjs b/astro.config.mjs
index c060e789..88d664e2 100644
--- a/astro.config.mjs
+++ b/astro.config.mjs
@@ -1,11 +1,21 @@
import { defineConfig } from 'astro/config';
+import { availableLangs, defaultLang } from './src/i18n/ui';
+
import vue from "@astrojs/vue";
import sitemap from "@astrojs/sitemap";
+
// https://astro.build/config
export default defineConfig({
integrations: [vue(), sitemap()],
output: 'static',
- site: 'https://maps.alexcreates.fr'
+ site: 'https://maps.alexcreates.fr',
+ i18n: {
+ locales: availableLangs,
+ defaultLocale: defaultLang,
+ routing: {
+ prefixDefaultLocale: true,
+ }
+ }
});
diff --git a/src/components/maps/Map.astro b/src/components/maps/Map.astro
index 9adbf8ec..78642d75 100644
--- a/src/components/maps/Map.astro
+++ b/src/components/maps/Map.astro
@@ -22,7 +22,7 @@ const {
@@ -89,95 +99,37 @@ const extraMenuitems: MenuItem[] = [
-
+
+
-
-
-
-
-
-
-
-
-
+
+ {{ item.name }}
+
+
+
+
+
+
diff --git a/src/components/maps/overlay/SearchMarkers.vue b/src/components/maps/overlay/SearchMarkers.vue
index e9b9ef3c..7ecd3507 100644
--- a/src/components/maps/overlay/SearchMarkers.vue
+++ b/src/components/maps/overlay/SearchMarkers.vue
@@ -7,13 +7,11 @@ import type { MapMarker, MapMarkerGroup, PlayerMarker } from '@/types/Leaflet';
import type { SearchConfig } from '@/types/Map';
import type { SearchMode } from '@/types/Search';
-import { currentLang } from '@/i18n/store';
+import { t } from '@/i18n/store';
import SearchMapSwitch from './SearchMapSwitch.vue';
import SearchMarkersTags from './SearchMarkersTags.vue';
-const $currentLang = useStore(currentLang);
-
const props = defineProps<{
markers: MapMarker[],
players: PlayerMarker,
@@ -215,13 +213,21 @@ function resetAllFields(actionAfter?: "focusAfter") {
@@ -233,7 +239,7 @@ function resetAllFields(actionAfter?: "focusAfter") {
:class="`group-${m.group}`"
:data-to-marker="m.title"
tabindex="0"
- :title="m.group === 'quests' ? 'Voir la quête' : 'Visiter ce lieu'"
+ :title="m.group === 'quests' ? t('maps.seeQuest') : t('maps.seePlace')"
>
@@ -245,7 +251,7 @@ function resetAllFields(actionAfter?: "focusAfter") {
- Voir la carte détaillée
+ {{ t('maps.go-to-map') }}
@@ -601,4 +607,22 @@ function resetAllFields(actionAfter?: "focusAfter") {
}
}
}
-
\ No newline at end of file
+
+// Animations on load
+@media screen and (prefers-reduced-motion: no-preference) {
+ .toolbar {
+ animation: fadeIn .2s cubic-bezier(0.785, 0.135, 0.15, 0.86);
+ }
+
+ @keyframes fadeIn {
+ from {
+ opacity: 0;
+ transform: translateY(-1rem);
+ }
+ to {
+ opacity: 1;
+ transform: translateY(0);
+ }
+ }
+}
+
diff --git a/src/components/maps/overlay/SearchMarkersTags.vue b/src/components/maps/overlay/SearchMarkersTags.vue
index ae3587aa..d79654dc 100644
--- a/src/components/maps/overlay/SearchMarkersTags.vue
+++ b/src/components/maps/overlay/SearchMarkersTags.vue
@@ -3,6 +3,8 @@ import type { MapMarker, MapMarkerGroup } from '@/types/Leaflet';
import type { SearchConfig } from '@/types/Map';
import type { SearchMode } from '@/types/Search';
+import { t } from '@/i18n/store';
+
defineProps<{
currentSearchMode: SearchMode,
customMarkers: MapMarker[],
@@ -32,7 +34,7 @@ function emitCategorySwitch(newCategory: MapMarkerGroup) {
- Quêtes
+ {{ t('quests') }}
@@ -49,7 +51,7 @@ function emitCategorySwitch(newCategory: MapMarkerGroup) {
- Capitales
+ {{ t('capitals') }}
@@ -66,7 +68,7 @@ function emitCategorySwitch(newCategory: MapMarkerGroup) {
- Points d'intérêt
+ {{ t('points-of-interest') }}
@@ -83,7 +85,7 @@ function emitCategorySwitch(newCategory: MapMarkerGroup) {
- Personnels
+ {{ t('personals') }}
diff --git a/src/i18n/store.ts b/src/i18n/store.ts
index 8b99bba6..6a82c56f 100644
--- a/src/i18n/store.ts
+++ b/src/i18n/store.ts
@@ -1,4 +1,4 @@
-import { type Language } from './ui';
+import { translations, type Language } from './ui';
import { persistentAtom } from '@nanostores/persistent';
export const currentLang = persistentAtom('lang', "fr");
@@ -6,3 +6,7 @@ export const currentLang = persistentAtom('lang', "fr");
export function setLang(lang: Language) {
currentLang.set(lang);
}
+
+export function t(key: string): string {
+ return translations[currentLang.get()][key]
+}
\ No newline at end of file
diff --git a/src/i18n/ui.ts b/src/i18n/ui.ts
index 4fcdebb7..03e5ff21 100644
--- a/src/i18n/ui.ts
+++ b/src/i18n/ui.ts
@@ -1,4 +1,52 @@
export const availableLangs = ['en', 'fr'] as const;
export type Language = typeof availableLangs[number];
+export type LanguageDict = Record;
-export const defaultLang: Language = 'fr';
\ No newline at end of file
+export const defaultLang: Language = 'fr';
+
+export const translations: LanguageDict = {
+ 'fr': {
+ 'common.title': 'Titre',
+ 'common.create': 'Créer',
+ 'continents': 'Continents',
+ 'cities': 'Villes',
+ 'others': 'Autres',
+ 'new': 'Nouveau',
+ 'quests': 'Quêtes',
+ 'capitals': 'Capitales',
+ 'points-of-interest': 'Points d\'intérêt',
+ 'personals': 'Personnels',
+ 'maps.go-to-map': 'Voir la carte détaillée',
+ 'maps.go-to-player': 'Aller à la position actuelle des joueurs',
+ 'maps.seeQuest': 'Voir la quête',
+ 'maps.seePlace': 'Voir sur la carte',
+ 'maps.search': 'Rechercher la carte',
+ 'maps.searchPlaceholder': "Ville, point d'intérêt…",
+ 'maps.closeSearch': 'Enlever le filtre',
+ 'maps.markers.new': 'Nouveau marqueur',
+ 'maps.markers.addPersonal': 'Ajouter un marqueur personnel',
+ 'maps.markers.newNotice': "Le marqueur sera sauvegardé mais n'apparaîtra que sur votre carte !"
+ },
+ 'en': {
+ 'common.title': 'Title',
+ 'common.create': 'Create',
+ 'continents': 'Continents',
+ 'cities': 'Cities',
+ 'others': 'Others',
+ 'new': 'New',
+ 'quests': 'Quests',
+ 'capitals': 'Capitals',
+ 'points-of-interest': 'Points of interest',
+ 'personals': 'Personals',
+ 'maps.go-to-map': 'See detailed map',
+ 'maps.go-to-player': 'Go to current players position',
+ 'maps.seeQuest': 'See the quest',
+ 'maps.seePlace': 'See on the map',
+ 'maps.search': 'Search the map',
+ 'maps.searchPlaceholder': "City, point of interest…",
+ 'maps.closeSearch': 'Remove filter',
+ 'maps.markers.new': 'New marker',
+ 'maps.markers.addPersonal': 'Add a personal marker',
+ 'maps.markers.newNotice': "The marker will be saved but will only appear on your map!"
+ }
+} as const;
diff --git a/src/i18n/utils.ts b/src/i18n/utils.ts
index a251a258..7de62d40 100644
--- a/src/i18n/utils.ts
+++ b/src/i18n/utils.ts
@@ -1,4 +1,4 @@
-import { defaultLang, availableLangs, type Language } from './ui';
+import { defaultLang, availableLangs, type Language, type LanguageDict } from './ui';
export function getLangFromUrl(url: URL): Language {
const [, lang] = url.pathname.split('/');