di PHP, atau data-i18n="key" di HTML. // ============================================================ declare(strict_types=1); // 1. Simpan preferensi (dari ?lang=...) if (isset($_GET['lang']) && in_array($_GET['lang'], ['id', 'en'], true)) { setcookie('nfis_lang', $_GET['lang'], [ 'expires' => time() + 365 * 86400, 'path' => '/', 'secure' => (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || (($_SERVER['SERVER_PORT'] ?? '') === 443), 'httponly'=> true, 'samesite'=> 'Lax', ]); // redirect bersih: balik ke URL yg sama tanpa query lang (biar gak di-retry) $clean = strtok($_SERVER['REQUEST_URI'] ?? '/', '?'); header('Location: ' . $clean); exit; } // 2. Tentukan bahasa aktif function nfis_lang(): string { static $l = null; if ($l !== null) return $l; $l = 'id'; if (!empty($_COOKIE['nfis_lang']) && in_array($_COOKIE['nfis_lang'], ['id', 'en'], true)) { $l = $_COOKIE['nfis_lang']; } return $l; } // 3. KAMUS (key => [id, en]) function nfis_dict(): array { return [ // nav / menu 'nav.home' => ['Beranda', 'Home'], 'nav.movies' => ['Film', 'Movies'], 'nav.series' => ['Series', 'TV Series'], 'nav.genre' => ['Genre', 'Genre'], 'nav.collections' => ['Collections', 'Collections'], 'nav.country' => ['Country', 'Country'], 'nav.year' => ['Tahun', 'Year'], 'nav.network' => ['Network', 'Network'], 'nav.watch_party' => ['Watch Party', 'Watch Party'], 'nav.all_genre' => ['Semua Genre', 'All Genres'], // home sections 'home.trending' => ['Trending Now', 'Trending Now'], 'home.tab_all' => ['Semua', 'All'], 'home.tab_movie' => ['Film', 'Movie'], 'home.tab_series' => ['Series', 'Series'], 'home.net_originals'=> ['Network Originals', 'Network Originals'], 'home.recent_movies'=> ['Recently Added Movies', 'Recently Added Movies'], 'home.recent_series'=> ['Recently Added Series', 'Recently Added Series'], 'home.recent_eps' => ['Recently Added Episode', 'Recently Added Episode'], 'home.see_all' => ['Lihat Semua', 'See All'], // detail 'detail.watch_now' => ['Watch Now', 'Watch Now'], 'detail.more_info' => ['More Info', 'More Info'], 'detail.top_cast' => ['Top Cast', 'Top Cast'], 'detail.more_like' => ['More Like This', 'More Like This'], 'detail.synopsis' => ['Sinopsis', 'Synopsis'], 'detail.trailer' => ['Trailer', 'Trailer'], 'detail.share' => ['Share', 'Share'], 'detail.watchlist' => ['Watchlist', 'Watchlist'], 'detail.favourite' => ['Favourite', 'Favourite'], 'detail.collection' => ['Add Collection', 'Add to Collection'], 'detail.party' => ['Start Watch Party', 'Start Watch Party'], 'detail.pick_season'=> ['Pilih Season & Episode', 'Select Season & Episode'], 'detail.episodes' => ['Daftar Episode', 'Episodes'], 'detail.no_ep' => ['Episode belum tersedia untuk serial ini.', 'No episodes available for this series.'], 'detail.no_stream' => ['Sumber streaming belum tersedia untuk film ini.', 'No streaming source available for this title.'], 'detail.wait_load' => ['Tunggu 30 Detik Sampai Video Terload.', 'Wait 30 seconds for the video to load.'], 'detail.loading' => ['Memuat pemutar...', 'Loading player...'], // misc 'misc.load_more' => ['Load More', 'Load More'], 'misc.all_shown' => ['Semua item sudah ditampilkan.', 'All items shown.'], 'misc.no_poster' => ['No Poster', 'No Poster'], 'misc.search_ph' => ['Cari film atau serial', 'Search movies or series'], 'misc.empty_genre' => ['Belum ada film untuk genre ini.', 'No titles for this genre yet.'], ]; } /** Ambil teks sesuai bahasa aktif */ function t(string $key): string { static $map = null; if ($map === null) $map = nfis_dict(); if (!isset($map[$key])) return $key; return $map[$key][nfis_lang() === 'en' ? 1 : 0]; } Dunkirk (2017) - NFIS