From 31301ae83e8947251386f79c0e750d3010db4ebc Mon Sep 17 00:00:00 2001 From: Darcy Wong Date: Tue, 24 Feb 2026 10:37:13 +0700 Subject: [PATCH 1/4] refactor: Use render_globe_dropdown for phone and desktop layouts --- _includes/2020/templates/Menu.php | 62 +++++++++++++++++++++++++------ 1 file changed, 50 insertions(+), 12 deletions(-) diff --git a/_includes/2020/templates/Menu.php b/_includes/2020/templates/Menu.php index 8002d3a5..f944fa4d 100644 --- a/_includes/2020/templates/Menu.php +++ b/_includes/2020/templates/Menu.php @@ -52,19 +52,59 @@ private static function change_ui_language($language): string { } /** - * Render the globe dropdown for changing the UI language + * Generate links that correspond to the UI options * As UI languages get added, we'll need to update this. + */ + private static function render_ui_list() { + $link = [ + 'en' => Menu::change_ui_language('en'), + 'de' => Menu::change_ui_language('de'), + 'es' => Menu::change_ui_language('es'), + 'fr' => Menu::change_ui_language('fr'), + 'km' => Menu::change_ui_language('km') + ]; + +echo << + +
  • English
  • +
  • Deutsch
  • +
  • Español
  • +
  • Français
  • +
  • ខ្មែរ
  • + +END; + } + + /** + * Render the globe dropdown for changing the UI language * Limitation: Currently only visible on pages that use localized strings - * @param number - Div number, default 0. + * @param divClass - Div class, default 0, or 1 (for desktop); or "phone". */ - private static function render_globe_dropdown($number = 0): void { + private static function render_globe_dropdown($divClass = 0): void { global $page_is_using_locale; if (!isset($page_is_using_locale) || !$page_is_using_locale) { // only render on pages that use localized strings return; } - $divID = ($number == 1) ? "ui-language1" : "ui-language"; + // Phone layout + if ($divClass === "phone") { +echo << +END; +?> +

    " alt="UI globe dropdown" /> Keyboard Search UI

    + + + @@ -100,6 +135,9 @@ private static function render_phone_menu(object $fields): void { " alt="search button" value="Search" onclick="if(document.getElementById('language-search2').value==''){return false;}"> +

    Products

      From 77c39a0e4da51a2d834088b3933293748bc6e817 Mon Sep 17 00:00:00 2001 From: Darcy Wong Date: Tue, 24 Feb 2026 14:29:22 +0700 Subject: [PATCH 2/4] refactor id array --- _includes/2020/templates/Menu.php | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/_includes/2020/templates/Menu.php b/_includes/2020/templates/Menu.php index f944fa4d..821e14a8 100644 --- a/_includes/2020/templates/Menu.php +++ b/_includes/2020/templates/Menu.php @@ -56,24 +56,23 @@ private static function change_ui_language($language): string { * As UI languages get added, we'll need to update this. */ private static function render_ui_list() { - $link = [ - 'en' => Menu::change_ui_language('en'), - 'de' => Menu::change_ui_language('de'), - 'es' => Menu::change_ui_language('es'), - 'fr' => Menu::change_ui_language('fr'), - 'km' => Menu::change_ui_language('km') - ]; - echo << -
    • English
    • -
    • Deutsch
    • -
    • Español
    • -
    • Français
    • -
    • ខ្មែរ
    • -
    END; + $linkArray = array( + 'en' => array(Menu::change_ui_language('en'), 'English'), + 'de' => array(Menu::change_ui_language('de'), 'Deutsch'), + 'es' => array(Menu::change_ui_language('es'), 'Español'), + 'fr' => array(Menu::change_ui_language('fr'), 'Français'), + 'km' => array(Menu::change_ui_language('km'), 'ខ្មែរ') + ); + + foreach($linkArray as $id) { +echo <<{$id[1]} +END; + } } /** From ba7318f27440fb702a837e1c4c83f5f410af6c99 Mon Sep 17 00:00:00 2001 From: Darcy Wong Date: Wed, 25 Feb 2026 08:52:42 +0700 Subject: [PATCH 3/4] cleanup to address review comments --- _includes/2020/templates/Menu.php | 40 +++++++++++++------------------ 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/_includes/2020/templates/Menu.php b/_includes/2020/templates/Menu.php index 821e14a8..1707be6d 100644 --- a/_includes/2020/templates/Menu.php +++ b/_includes/2020/templates/Menu.php @@ -56,10 +56,7 @@ private static function change_ui_language($language): string { * As UI languages get added, we'll need to update this. */ private static function render_ui_list() { -echo << - -END; + echo "
      \n \n"; $linkArray = array( 'en' => array(Menu::change_ui_language('en'), 'English'), 'de' => array(Menu::change_ui_language('de'), 'Deutsch'), @@ -70,17 +67,23 @@ private static function render_ui_list() { foreach($linkArray as $id) { echo <<{$id[1]} +
    • {$id[1]}
    • \n END; } +?> +
    + ID to handle 3 cases: + * ui-language (default) Desktop globe hover + * ui-language1 - Desktop globe hover + * phone - Mobile list */ - private static function render_globe_dropdown($divClass = 0): void { + private static function render_globe_dropdown($divID = "ui-language"): void { global $page_is_using_locale; if (!isset($page_is_using_locale) || !$page_is_using_locale) { // only render on pages that use localized strings @@ -88,22 +91,17 @@ private static function render_globe_dropdown($divClass = 0): void { } // Phone layout - if ($divClass === "phone") { -echo << -END; + if ($divID === "phone") { ?> -

    " alt="UI globe dropdown" /> Keyboard Search UI

    - +
    +

    " alt="UI globe dropdown" /> Keyboard Search UI

    +
    @@ -134,10 +130,8 @@ private static function render_phone_menu(object $fields): void { " alt="search button" value="Search" onclick="if(document.getElementById('language-search2').value==''){return false;}">
    - -
    + +

    Products

    • Keyman stable_version?> for Windows
    • From bb84a0747ecf85bb828c7a524404040e4194b0e0 Mon Sep 17 00:00:00 2001 From: Darcy Wong Date: Wed, 25 Feb 2026 09:11:21 +0700 Subject: [PATCH 4/4] more cleanup --- _includes/2020/templates/Menu.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/_includes/2020/templates/Menu.php b/_includes/2020/templates/Menu.php index 1707be6d..bf491486 100644 --- a/_includes/2020/templates/Menu.php +++ b/_includes/2020/templates/Menu.php @@ -70,9 +70,7 @@ private static function render_ui_list() {
    • {$id[1]}
    • \n END; } -?> -
    -"; } /**