Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

748 B
Raw Blame
import { useTranslation } from '../i18n'
import { useSettingsStore } from '../store/settingsStore'

/**
 * The language place names and addresses are asked for (#1799): the user's own
 * choice when there is one, the app's language otherwise. A German interface
 * with English names, or local names under any interface, is a real way to
 * travel; tying the two together forced one or the other.
 */
export function placeLanguage(appLanguage: string, chosen: string | undefined | null): string {
  return chosen?.trim() ? chosen.trim() : appLanguage
}

export function usePlaceLanguage(): string {
  const { language } = useTranslation()
  const chosen = useSettingsStore(s => s.settings.place_language)
  return placeLanguage(language, chosen)
}