- @trails-cool/types: Route, Activity, Waypoint, RouteVersion, RouteMetadata - @trails-cool/gpx: GPX parser (XML→waypoints/tracks/elevation) and generator with round-trip test, haversine distance, elevation gain/loss computation - @trails-cool/map: MapView (Leaflet + OSM/OpenTopoMap/CyclOSM layer switcher), RouteLayer (GeoJSON polyline rendering) - @trails-cool/ui: Button (primary/secondary/ghost), Input (with label/error), Card components with Tailwind styling - @trails-cool/i18n: react-i18next config with English + German translations, browser language detection, fallback to English All 13 unit tests pass. Both apps build successfully. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
29 lines
715 B
TypeScript
29 lines
715 B
TypeScript
import i18n from "i18next";
|
|
import { initReactI18next } from "react-i18next";
|
|
import LanguageDetector from "i18next-browser-languagedetector";
|
|
import en from "./locales/en";
|
|
import de from "./locales/de";
|
|
|
|
export const defaultNS = "common";
|
|
|
|
export const resources = {
|
|
en: { common: en.common, planner: en.planner, journal: en.journal },
|
|
de: { common: de.common, planner: de.planner, journal: de.journal },
|
|
} as const;
|
|
|
|
export function initI18n() {
|
|
return i18n
|
|
.use(LanguageDetector)
|
|
.use(initReactI18next)
|
|
.init({
|
|
resources,
|
|
defaultNS,
|
|
fallbackLng: "en",
|
|
supportedLngs: ["en", "de"],
|
|
interpolation: {
|
|
escapeValue: false,
|
|
},
|
|
});
|
|
}
|
|
|
|
export { i18n };
|