Files
TREK/client/src/hooks/usePlaceLanguage.ts
T
Maurice 8fd46c4c18 feat: quality of life sweep from the feature discussions
Small requests from the discussions, each built end to end: planner and
map (cycling mode, date first headings, clear a day, stay times per day,
off-route stops, map lock, compact unplanned markers, pending stays,
cable car, transit quick picks), places (location filter, category from
OSM, open in maps, geo: link, image from an attachment, enrichment on
file import, places near a pin, place name language, Amap first in
China), lists and costs (packed counter, inherited sharing, Markdown
to-dos, payment notes, bookings CSV, my plan PDF), sharing (unplanned
places, travel only, without photos), journey (photo zoom, drafts,
photo order, trip suggestion, day jump), atlas (region counter, region
bucket list, places per country), vacay half company holidays, studio
copy and paste plus the book's own layouts, and RESTORE_FROM_BACKUP for
a first start restore.
2026-09-30 23:00:12 +02:00

19 lines
748 B
TypeScript

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)
}