diff --git a/src/App.tsx b/src/App.tsx index 185fca3..e7f9d60 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -58,6 +58,21 @@ const topSidebarItems: SidebarItem[] = [ { route: 'wishlist', label: 'Wishlist', short: 'W', icon: 'wishlist' }, ] +// Only English is translated today; more can be added here and show up in Settings. +const LANGUAGE_OPTIONS: SelectOption[] = [{ id: 'en-US', label: 'English (en-US)' }] + +const REGION_CODES = [ + 'US', 'GB', 'CA', 'AU', 'NZ', 'IE', 'ES', 'MX', 'AR', 'CL', 'CO', 'PE', 'FR', 'DE', 'IT', 'PT', 'BR', + 'NL', 'BE', 'SE', 'NO', 'DK', 'FI', 'PL', 'JP', 'KR', 'CN', 'TW', 'IN', +] +const regionNames = new Intl.DisplayNames(['en'], { type: 'region' }) +const REGION_OPTIONS: SelectOption[] = REGION_CODES.map((code) => ({ id: code, label: `${regionNames.of(code) ?? code} (${code})` })) + +// A value saved earlier that is not in the list stays selectable instead of being lost. +function withCurrentOption(options: SelectOption[], current: string): SelectOption[] { + return current && !options.some((option) => option.id === current) ? [{ id: current, label: current }, ...options] : options +} + const sidebarItems: SidebarItem[] = [ { route: 'home', label: 'Home', short: 'H', icon: 'home' }, { route: 'dorama', label: 'K-Drama', short: '아' }, @@ -4244,7 +4259,7 @@ function SettingsView(props: { return (