'https://aumcreate.com/manual/aumreserva', 'zh-hans' => 'https://aumcreate.com/zh-hans/manual/aumreserva', 'zh-hant' => 'https://aumcreate.com/zh-hant/manual/aumreserva', 'ja' => 'https://aumcreate.com/ja/manual/aumreserva', ]; /** * WordPress admin language → which of those four to send them to. * * **The language of the prose and the language of the screenshots are two different * things.** This plugin ships one translation, `zh_CN` (there is no `zh_TW` and no `ja` in * `languages/`, and WordPress does not fall `zh_TW` back to `zh_CN`). So a Traditional * Chinese or Japanese administrator is reading an English admin screen, and the manual's * zh-hant and ja pages are translations of the prose carrying the English screenshots — * which is what matches what is on their screen. */ private const WP_TO_SITE = [ 'zh_CN' => 'zh-hans', 'zh_TW' => 'zh-hant', 'zh_HK' => 'zh-hant', 'ja' => 'ja', ]; private const FALLBACK = 'en'; /** * `get_user_locale()` rather than `get_locale()`: the Plugins screen is read in whatever * language that administrator set for themselves, which can differ from the site's. */ private static function locale(): string { return self::WP_TO_SITE[get_user_locale()] ?? self::FALLBACK; } /** The URL for this administrator, or '' when the page is not published in their language. */ public static function url(): string { return self::URLS[self::locale()] ?? ''; } }