Files
web-alterflixhub/app/lib/i18n/messages.ts
T
Bkk1234 1932098a1d feat(home): ชั้นกรองที่ 1 — ประเภทโรงหนัง (ท้องถิ่น / อินดี้ / กลุ่มคนฉายหนัง)
- แถบกรองสองชั้นในแถวเดียว: ทั้งหมด → 3 ประเภท │ ยอดนิยม → หมวดภาพยนตร์เดิม
- เก็บประเภทที่ฟิลด์เดี่ยว cinema.venue_type (ค่าเดียว) + hasVenue()/filterCinemas({ venue })
- ย้าย "กลุ่มคนฉายหนัง" จาก categories ขึ้นชั้น 1 (ไม่ให้ปุ่มซ้ำ) · tag ยังอยู่และยังค้นหาเจอ
- เลือกได้ทีละชั้น: กดประเภทล้างหมวด / กดหมวดล้างประเภท / ทั้งหมดล้างทั้งคู่
- ปิด popularity path เมื่อกรองด้วยประเภท (กันจัดอันดับข้ามประเภท)
- หลังบ้าน: ช่อง "ประเภทโรงหนัง" ในหมวดข้อมูลหลัก + sanitize เฉพาะค่าใน VENUE_TYPES
- i18n: messages.venues (TH/EN) · override ได้ผ่าน site.terms
- scripts/set-venue-types.mjs จัดประเภท 29 โรง (15 ท้องถิ่น / 11 อินดี้ / 3 กลุ่มคนฉายหนัง) พร้อมสำรอง content.json
- tests: hasVenue + filterCinemas (165 ผ่าน) · sw v2.0.5 · DESIGN/AGENTS/README/admin-guide/api อัปเดต
2026-11-16 01:46:59 +07:00

511 lines
26 KiB
TypeScript

import type { CinemaCategory, VenueType } from "@/lib/cinemas";
export type Locale = "th" | "en";
export const LOCALES: readonly Locale[] = ["th", "en"] as const;
export const DEFAULT_LOCALE: Locale = "th";
export const LOCALE_OPTIONS: ReadonlyArray<{
locale: Locale;
code: string;
name: string;
}> = [
{ locale: "th", code: "TH", name: "ไทย" },
{ locale: "en", code: "EN", name: "English" },
];
export type FacilityKey =
| "seating"
| "ticket"
| "restaurant"
| "cafe"
| "garden"
| "bookstore"
| "colearning"
| "other";
/** ลำดับคีย์สิ่งอำนวยความสะดวกที่ใช้แสดงผลและให้เลือกในหลังบ้าน */
export const FACILITY_KEYS: FacilityKey[] = [
"seating",
"ticket",
"restaurant",
"cafe",
"garden",
"bookstore",
"colearning",
"other",
];
export type TransportKey = "private_car" | "metro" | "bus";
/**
* ข้อความของหน้า "บทความ" ที่ใช้ร่วมกันสองหน้า
* (สำหรับคนทำโรงหนัง / สำหรับคนรักหนัง) — แก้โครงครั้งเดียวมีผลทั้งคู่
*/
export type ArticleMessages = {
title: string;
lead: string;
paragraphs: string[];
contactHeading: string;
contactNote: string;
};
export type Messages = {
meta: {
homeDescription: string;
cinemaNotFoundTitle: string;
};
hero: {
titlePrefix: string;
titleHighlight: string;
titleSuffix: string;
subtitle: string;
};
search: {
placeholder: string;
nearMe: string;
submit: string;
locating: string;
denied: string;
unsupported: string;
error: string;
sortedByDistance: string;
};
nav: {
home: string;
about: string;
forCinemas: string;
forFilmLovers: string;
menu: string;
language: string;
};
about: {
title: string;
lead: string;
sections: Array<{ heading: string; body: string }>;
contactHeading: string;
contactNote: string;
};
forCinemas: ArticleMessages;
forFilmLovers: ArticleMessages;
/** ข้อความปุ่ม/สถานะการแชร์ */
share: {
label: string;
pageLabel: string;
copied: string;
failed: string;
};
list: {
title: string;
showMore: string;
showLess: string;
empty: string;
};
card: {
seeDetail: string;
distanceFallback: string;
locationFallback: string;
categoryFallback: string;
};
detail: {
back: string;
openMap: string;
contactTitle: string;
paymentMethods: string;
showtimes: string;
facilities: string;
location: string;
otherCinemas: string;
contactsFallback: string;
paymentsFallback: string;
addressFallback: string;
/** ใช้เมื่อไม่มีทั้งแผนที่และพิกัด */
noData: string;
};
gallery: {
main: string;
second: string;
third: string;
previous: string;
next: string;
more: (remaining: number) => string;
};
notFound: {
title: string;
text: string;
cta: string;
};
/** ป้ายของหมวดหมู่ — คีย์ยังเป็นไทยเพื่อใช้กรองข้อมูล */
categories: Record<CinemaCategory, string>;
/** ชั้นกรองที่ 1 — ประเภทโรงหนัง (คีย์ไทย ใช้กรองข้อมูล) */
venues: Record<VenueType, string>;
/** ป้ายของ tag ในข้อมูลโรงหนัง */
tags: Record<string, string>;
facilities: Record<FacilityKey, { title: string; sub: string }>;
transport: Record<TransportKey, string>;
/** ชื่อช่องทางชำระเงิน (คีย์คือค่าที่เก็บในข้อมูล) */
payments: Record<string, string>;
};
const TH: Messages = {
meta: {
homeDescription: "ค้นหาโรงภาพยนตร์อิสระ ทางเลือกในการดูหนัง",
cinemaNotFoundTitle: "ไม่พบโรงหนัง",
},
hero: {
titlePrefix: "ค้นพบ",
titleHighlight: "โรงหนังใหม่ๆ",
titleSuffix: "ใกล้คุณ",
subtitle:
"ค้นหาโรงภาพยนตร์ท้องถิ่น โรงภาพยนตร์อินดี้และกลุ่มคนฉายหนัง ทางเลือกในการดูหนัง",
},
search: {
placeholder: "ค้นหาชื่อโรงหนังหรือสถานที่ / จังหวัด / ประเภทหนัง",
nearMe: "ใกล้ฉัน",
submit: "ค้นหา",
locating: "กำลังหาตำแหน่ง…",
denied: "ไม่ได้รับอนุญาตให้ใช้ตำแหน่ง",
unsupported: "อุปกรณ์นี้ไม่รองรับการหาตำแหน่ง",
error: "หาตำแหน่งไม่สำเร็จ ลองอีกครั้ง",
sortedByDistance: "เรียงจากใกล้สุดไปไกลสุดแล้ว",
},
nav: {
home: "หน้าแรก",
about: "เกี่ยวกับเรา",
forCinemas: "สำหรับคนทำโรงหนัง",
forFilmLovers: "สำหรับคนรักหนัง",
menu: "เมนู",
language: "ภาษา",
},
about: {
title: "เกี่ยวกับเรา",
lead: "AlterFlixHub รวมโรงหนังอิสระและอาร์ตเฮาส์ในประเทศไทยไว้ที่เดียว เพื่อให้คนรักหนังหาโรงที่ตรงใจและไปถึงได้ง่ายขึ้น",
sections: [
{
heading: "เราทำอะไร",
body: "รวมรายชื่อโรงหนังอิสระพร้อมรายละเอียดที่จำเป็น — ประเภทหนัง สิ่งอำนวยความสะดวก การเดินทาง และช่องทางติดต่อ พร้อมปุ่ม “ใกล้ฉัน” ที่เรียงโรงจากใกล้สุดไปไกลสุดด้วยระยะทางตามถนนจริง",
},
{
heading: "ข้อมูลมาจากไหน",
body: "ทีมงานกรอกและแก้ไขข้อมูลผ่านระบบหลังบ้าน พิกัดอ้างอิงจาก OpenStreetMap และคำนวณระยะทางด้วย OSRM หากข้อมูลใดคลาดเคลื่อน แจ้งเราได้ทุกช่องทาง",
},
{
heading: "ความเป็นส่วนตัว",
body: "เราไม่ใช้คุกกี้เพื่อการโฆษณา และไม่เก็บ IP หรือ User-Agent ของคุณ สถิติการค้นหาถูกเก็บแบบไม่ระบุตัวตนเพื่อปรับปรุงการค้นหาเท่านั้น",
},
{
heading: "หลายภาษา",
body: "เว็บรองรับภาษาไทยและอังกฤษ สลับได้ที่มุมขวาบนของทุกหน้า และจดจำภาษาที่คุณเลือกไว้ให้อัตโนมัติ",
},
],
contactHeading: "ติดต่อและแจ้งข้อมูล",
contactNote:
"พบข้อมูลโรงหนังผิด ต้องการเพิ่มโรงใหม่ หรืออยากให้เราช่วยประชาสัมพันธ์กิจกรรม ใช้ช่องทางโซเชียลในส่วนท้ายของหน้าเว็บได้เลย",
},
forCinemas: {
title: "สำหรับคนทำโรงหนัง",
lead: "AlterFlixHub เปิดพื้นที่ให้โรงหนังอิสระ กลุ่มคนฉายหนัง และโรงหนังท้องถิ่นได้เล่าเรื่องของตัวเอง พร้อมรายละเอียดที่คนดูอยากรู้ก่อนออกจากบ้าน",
paragraphs: [
"โรงหนังเล็ก ๆ ในประเทศไทยมีเรื่องเล่าที่น่าสนใจไม่แพ้โรงใหญ่ แต่หลายโรงยังไม่มีพื้นที่สื่อสารกับคนดูอย่างเป็นระบบ ข้อมูลกระจัดกระจาย และคนดูก็หาไม่เจอ",
"เราจึงเปิดพื้นที่ให้ทุกโรงสร้างหน้ารายละเอียดของตัวเองบน AlterFlixHub ระบุที่ตั้ง วิธีเดินทาง สิ่งอำนวยความสะดวก พร้อมภาพบรรยากาศจริง เพื่อให้คนดูตัดสินใจได้ก่อนเดินทาง",
"ถ้าคุณดูแลโรงหนัง กลุ่มคนฉายหนัง หรือพื้นที่ฉายหนังชุมชน แล้วอยากมีหน้ารายละเอียดบน AlterFlixHub ส่งข้อมูลมาให้ทีมงานได้เลย เราช่วยตรวจข้อมูลและจัดหน้าให้ในช่วงเริ่มต้น",
],
contactHeading: "สนใจลงโรงหนังกับเรา",
contactNote:
"ส่งชื่อโรง ที่ตั้ง และภาพบรรยากาศมาให้ทีมงานผ่านช่องทางโซเชียลในส่วนท้ายของหน้าเว็บ เราจะติดต่อกลับภายใน 2 วันทำการ",
},
forFilmLovers: {
title: "สำหรับคนรักหนัง",
lead: "รวมทางเลือกสำหรับคนที่อยากดูหนังมากกว่าหนังกระแสหลัก — โรงอาร์ตเฮาส์ กลุ่มคนฉายหนัง และรอบฉายพิเศษที่คัดมาแล้ว",
paragraphs: [
"ถ้าคุณตามหาหนังที่ไม่ได้อยู่ในโรงใหญ่ AlterFlixHub ช่วยให้เจอโรงที่ฉายหนังนอกกระแส สารคดี หนังคลาสสิก และรอบฉายพิเศษได้ในไม่กี่คลิก",
"ทุกโรงในเว็บมีข้อมูลที่คนดูอยากรู้ก่อนตัดสินใจ — ประเภทหนังที่ฉาย สิ่งอำนวยความสะดวก วิธีเดินทาง และภาพบรรยากาศจริง พร้อมปุ่ม “ใกล้ฉัน” ที่เรียงโรงจากใกล้สุดไปไกลสุดตามระยะทางถนนจริง",
"อยากแนะนำโรงใหม่ กลุ่มฉายหนัง หรือกิจกรรมที่ควรอยู่ในหน้านี้ ส่งมาให้ทีมงานได้เลย เราตรวจข้อมูลและเพิ่มให้ทุกสัปดาห์",
],
contactHeading: "มีโรงหรือรอบฉายที่อยากแนะนำ",
contactNote:
"ส่งชื่อโรงหรือกิจกรรมพร้อมลิงก์มาให้ทีมงานผ่านช่องทางโซเชียลในส่วนท้ายของหน้าเว็บ เราจะตรวจและเพิ่มให้ทุกสัปดาห์",
},
share: {
label: "แชร์",
pageLabel: "แชร์หน้านี้",
copied: "คัดลอกลิงก์แล้ว",
failed: "แชร์ไม่สำเร็จ",
},
list: {
title: "รายชื่อโรงหนังทุกประเภทและกลุ่มคนฉายหนัง",
showMore: "แสดงโรงหนังเพิ่มเติม",
showLess: "แสดงโรงหนังน้อยลง",
empty: "ไม่พบโรงหนังที่ตรงกับคำค้น ลองเปลี่ยนคำหรือหมวดหมู่ดู",
},
card: {
seeDetail: "ดูรายละเอียด",
distanceFallback: "— km.",
locationFallback: "ยังไม่ระบุสถานที่",
categoryFallback: "ยังไม่ระบุประเภท",
},
detail: {
back: "ย้อนกลับ",
openMap: "เปิด Google map",
contactTitle: "สอบถามข้อมูลและจองตั๋ว",
paymentMethods: "ช่องทางชำระเงิน",
showtimes: "ดูรอบฉาย",
facilities: "สิ่งอำนวยความสะดวก",
location: "ที่ตั้ง",
otherCinemas: "โรงหนังอิสระอื่นๆ",
contactsFallback: "ยังไม่ระบุช่องทางติดต่อ",
paymentsFallback: "ยังไม่ระบุ",
addressFallback: "ยังไม่ระบุที่อยู่",
noData: "ไม่มีข้อมูล",
},
gallery: {
main: "ภาพบรรยากาศโรงหนัง",
second: "ภาพที่ 2",
third: "ภาพที่ 3",
previous: "ก่อนหน้า",
next: "ถัดไป",
more: (remaining) => `${remaining}+`,
},
notFound: {
title: "ไม่พบโรงหนังที่ค้นหา",
text: "ลิงก์อาจเปลี่ยนแล้ว กลับไปเลือกจากรายชื่อโรงหนังอิสระได้เลย",
cta: "กลับหน้าแรก",
},
categories: {
ทั้งหมด: "ทั้งหมด",
ยอดนิยม: "ยอดนิยม",
อาร์ตเฮาส์: "อาร์ตเฮาส์",
สารคดี: "สารคดี",
หนังสั้น: "หนังสั้น",
หนังคลาสสิก: "หนังคลาสสิก",
หนังนานาชาติ: "หนังนานาชาติ",
หนังนอกกระแส: "หนังนอกกระแส",
หนังในกระแส: "หนังในกระแส",
หนังฝรั่งเศส: "หนังฝรั่งเศส",
หนังไทย: "หนังไทย",
},
venues: {
โรงภาพยนตร์ท้องถิ่น: "โรงภาพยนตร์ท้องถิ่น",
โรงภาพยนตร์อินดี้: "โรงภาพยนตร์อินดี้",
กลุ่มคนฉายหนัง: "กลุ่มคนฉายหนัง",
},
tags: {
ยอดนิยม: "ยอดนิยม",
อาร์ตเฮาส์: "อาร์ตเฮาส์",
หนังคลาสสิก: "หนังคลาสสิก",
หนังนอกกระแส: "หนังนอกกระแส",
หนังในกระแส: "หนังในกระแส",
กลุ่มคนฉายหนัง: "กลุ่มคนฉายหนัง",
หนังไทย: "หนังไทย",
},
facilities: {
seating: { title: "โซนนั่งรอ", sub: "บริเวณโถงโรงภาพยนตร์" },
ticket: { title: "จุดจำหน่ายตั๋ว", sub: "Box Office ชั้น 5" },
restaurant: { title: "ร้านอาหาร", sub: "ภายในศูนย์การค้า" },
cafe: { title: "ร้านคาเฟ่", sub: "บริเวณโถงโรงภาพยนตร์" },
garden: { title: "สวนหย่อม", sub: "ลานกลางแจ้ง" },
bookstore: { title: "ร้านหนังสือ", sub: "ภายในศูนย์การค้า" },
colearning: { title: "Co-Learning Space", sub: "บริเวณโถงโรงภาพยนตร์" },
other: { title: "อื่นๆ", sub: "ร้านทำผม ร้านทำเล็บ" },
},
transport: {
private_car: "รถยนต์ส่วนตัว",
metro: "รถไฟฟ้า",
bus: "รถประจำทาง",
},
payments: {
เงินสด: "เงินสด",
บัตรเครดิต: "บัตรเครดิต",
สแกนจ่าย: "สแกนจ่าย",
},
};
const EN: Messages = {
meta: {
homeDescription:
"Find independent cinemas — an alternative way to watch films",
cinemaNotFoundTitle: "Cinema not found",
},
hero: {
titlePrefix: "Discover ",
titleHighlight: "new cinemas",
titleSuffix: " near you",
subtitle:
"Find local cinemas, indie screens and film-screening collectives — an alternative way to watch films",
},
search: {
placeholder: "Search by cinema, place / province / film genre",
nearMe: "Near me",
submit: "Search",
locating: "Locating…",
denied: "Location permission denied",
unsupported: "This device cannot share its location",
error: "Could not get your location. Try again.",
sortedByDistance: "Sorted nearest first",
},
nav: {
home: "Home",
about: "About us",
forCinemas: "For cinemas",
forFilmLovers: "For film lovers",
menu: "Menu",
language: "Language",
},
about: {
title: "About us",
lead: "AlterFlixHub brings Thailand's independent and arthouse cinemas together in one place, so film lovers can find the right screen and get there easily.",
sections: [
{
heading: "What we do",
body: "We list independent cinemas with the details that matter — genres, facilities, how to get there and how to reach them — plus a “Near me” button that sorts every cinema by real road distance.",
},
{
heading: "Where the data comes from",
body: "Our team maintains the listings through the admin panel. Coordinates come from OpenStreetMap and distances are calculated with OSRM. If something looks wrong, tell us on any channel.",
},
{
heading: "Privacy",
body: "No advertising cookies, and we never store your IP address or user agent. Search statistics are recorded anonymously, only to improve search results.",
},
{
heading: "Two languages",
body: "The site works in Thai and English. Switch language at the top right of any page — your choice is remembered automatically.",
},
],
contactHeading: "Contact and corrections",
contactNote:
"Spotted wrong information, want to add a cinema, or need help promoting a screening? Use the social links in the footer of any page.",
},
forCinemas: {
title: "For cinemas",
lead: "AlterFlixHub gives independent cinemas, screening collectives and local theatres a place to tell their own story — with the details filmgoers need before leaving home.",
paragraphs: [
"Small cinemas in Thailand have stories as compelling as the big chains, yet many still have no structured way to reach their audience: information is scattered and viewers cannot find them.",
"This page opens a dedicated detail page for any cinema on AlterFlixHub — location, how to get there, facilities and real photos — so people can decide before they travel.",
"If you run a cinema, a screening collective or a community screening space and want to be listed, send your information to our team. We verify the details and set the page up for you during the launch period.",
],
contactHeading: "Want your cinema listed?",
contactNote:
"Send your cinema name, address and a few photos through the social links in the footer — we reply within two business days.",
},
forFilmLovers: {
title: "For film lovers",
lead: "A curated path for anyone who wants more than the mainstream — arthouse screens, screening collectives and special programmes, all in one place.",
paragraphs: [
"If you are looking for films that never reach the multiplex, AlterFlixHub helps you find the cinemas showing independent titles, documentaries, classics and special programmes in a few clicks.",
"Every cinema listed comes with the details that matter before you leave home — genres, facilities, how to get there and real photos — plus a “Near me” button that sorts everything by real road distance.",
"Know a cinema, a screening collective or an event that belongs here? Send it to our team and we will review it — new listings are added every week.",
],
contactHeading: "Know a cinema or a screening we should add?",
contactNote:
"Send the name and a link through the social channels in the footer — we review new listings every week.",
},
share: {
label: "Share",
pageLabel: "Share this page",
copied: "Link copied",
failed: "Couldn't share",
},
list: {
title: "Local cinemas, indie screens and film collectives",
showMore: "Show more cinemas",
showLess: "Show fewer cinemas",
empty: "No cinema matches that search. Try another word or category.",
},
card: {
seeDetail: "View details",
distanceFallback: "— km.",
locationFallback: "Location not specified",
categoryFallback: "Genre not specified",
},
detail: {
back: "Back",
openMap: "Open Google map",
contactTitle: "Enquiries and tickets",
paymentMethods: "Payment methods",
showtimes: "See showtimes",
facilities: "Facilities",
location: "Location",
otherCinemas: "Other independent cinemas",
contactsFallback: "No contact channel yet",
paymentsFallback: "Not specified",
addressFallback: "Address not specified",
noData: "No data",
},
gallery: {
main: "Cinema photo",
second: "Photo 2",
third: "Photo 3",
previous: "Previous",
next: "Next",
more: (remaining) => `${remaining}+`,
},
notFound: {
title: "Cinema not found",
text: "The link may have changed. Pick a cinema from the list instead.",
cta: "Back to home",
},
categories: {
ทั้งหมด: "All",
ยอดนิยม: "Popular",
อาร์ตเฮาส์: "Arthouse",
สารคดี: "Documentary",
หนังสั้น: "Short films",
หนังคลาสสิก: "Classics",
หนังนานาชาติ: "International",
หนังนอกกระแส: "Independent",
หนังในกระแส: "Mainstream",
หนังฝรั่งเศส: "French films",
หนังไทย: "Thai films",
},
venues: {
โรงภาพยนตร์ท้องถิ่น: "Local cinemas",
โรงภาพยนตร์อินดี้: "Indie cinemas",
กลุ่มคนฉายหนัง: "Film collectives",
},
tags: {
ยอดนิยม: "Popular",
อาร์ตเฮาส์: "Arthouse",
หนังคลาสสิก: "Classics",
หนังนอกกระแส: "Independent",
หนังในกระแส: "Mainstream",
กลุ่มคนฉายหนัง: "Film collectives",
หนังไทย: "Thai films",
},
facilities: {
seating: { title: "Seating area", sub: "Cinema lobby" },
ticket: { title: "Ticket counter", sub: "Box office, 5th floor" },
restaurant: { title: "Restaurants", sub: "Inside the mall" },
cafe: { title: "Cafés", sub: "Cinema lobby" },
garden: { title: "Garden", sub: "Outdoor plaza" },
bookstore: { title: "Bookstore", sub: "Inside the mall" },
colearning: { title: "Co-learning space", sub: "Cinema lobby" },
other: { title: "Others", sub: "Hair and nail salons" },
},
transport: {
private_car: "Private car",
metro: "Metro",
bus: "Bus",
},
payments: {
เงินสด: "Cash",
บัตรเครดิต: "Credit card",
สแกนจ่าย: "QR payment",
},
};
export const MESSAGES: Record<Locale, Messages> = { th: TH, en: EN };
/** แปลค่าจาก dictionary — ค่าที่ไม่รู้จักถูกส่งกลับไปตามเดิมเพื่อไม่ให้ข้อความหาย */
export function translate(
dictionary: Record<string, string>,
key: string,
): string {
return dictionary[key] ?? key;
}
export function isLocale(value: string | undefined | null): value is Locale {
return value === "th" || value === "en";
}