From 27617bdc199beee31d371cea176358fe734bc33f Mon Sep 17 00:00:00 2001 From: Darcy Wong Date: Mon, 3 Nov 2025 14:23:08 +0700 Subject: [PATCH 01/11] start localizing install page --- .../locale/strings/keyboards-install/en.php | 71 +++++++++++++ .../locale/strings/keyboards-install/es.php | 70 +++++++++++++ .../locale/strings/keyboards-install/fr.php | 70 +++++++++++++ keyboards/install.php | 99 +++++++++++++------ 4 files changed, 280 insertions(+), 30 deletions(-) create mode 100644 _includes/locale/strings/keyboards-install/en.php create mode 100644 _includes/locale/strings/keyboards-install/es.php create mode 100644 _includes/locale/strings/keyboards-install/fr.php diff --git a/_includes/locale/strings/keyboards-install/en.php b/_includes/locale/strings/keyboards-install/en.php new file mode 100644 index 00000000..a55aff7d --- /dev/null +++ b/_includes/locale/strings/keyboards-install/en.php @@ -0,0 +1,71 @@ + + "Your %1\$s keyboard download should start shortly. + If it does not,click the button below to start the download.", + + # Help on installing keyboard + "help_on_installing_keyboard" => "Help on installing a keyboard", + + # Help on installing Keyman + "help_on_installing_keyman" => "Help on installing Keyman", + + # Download keyboard + "download_keyboard" => "Download keyboard", + + # Download just this keyboard... + "download_just_keyboard" => "Download just this keyboard", + + # ... and then install in the app + "and_then_install_in_the_app" => "and then install in the app.", + + # Install keyboard button + "install_keyboard" => "Install keyboard", + + # {keyboard} home + "keyboard_home" => "%1\$s keyboard home", + + # Keyman for {platform} not installed + "platform_not_installed" => + "If you have not yet installed %1\$s, please install it first before installing the keyboard.", + + # Download and install Keyman title + "download_keyman_title" => "Download and install Keyman", + + # Install Keyman for {platform} + "install_keyman" => "Install %1\$s", + + # Keyman for Android + "with_play_store" => + "Install Keyman together with %1\$s keyboard through the Google Play Store:", + + # Install from Play Store + "install_from_play_store" => + "Install from Play Store", + + # Installs Keyman and {keyboard} for {platform} + "keyman_and_keyboard_for_platform" => + "Installs Keyman and %1\$s keyboard for %2\$s", + + # Keyman already installed? + "already_installed" => "Keyman already installed?", + + # Downloads {keyboard} for {platform} + "downloads_keyboard_for_platform" => + "Downloads %1\$s for %2\$s", + + # {Keyboard} not found + "keyboard_not_found" => "Keyboard %1\$s not found." + +]; diff --git a/_includes/locale/strings/keyboards-install/es.php b/_includes/locale/strings/keyboards-install/es.php new file mode 100644 index 00000000..318b62af --- /dev/null +++ b/_includes/locale/strings/keyboards-install/es.php @@ -0,0 +1,70 @@ + + "La descarga de tu teclado %1\$s debería comenzar en breve. + Si no comienza, haz clic en el botón de abajo para iniciar la descarga.", + + # Help on installing keyboard + "help_on_installing_keyboard" => "Ayuda para instalar un teclado", + + # Help on installing Keyman + "help_on_installing_keyman" => "Ayuda para instalar Keyman", + + # Download keyboard + "download_keyboard" => "Descargar teclado", + + # Download just this keyboard... + "download_just_keyboard" => "Descarga solo este teclado", + + # ... and then install in the app + "and_then_install_in_the_app" => "y luego instálala en la aplicación.", + + # Install keyboard button + "install_keyboard" => "Instalar teclado", + + # {keyboard} home + "keyboard_home" => "Inicio del teclado %1\$s", + + # Keyman for {platform} not installed + "platform_not_installed" => + "Si aún no ha instalado %1\$s, instálelo primero antes de instalar el teclado.", + + # Download and install Keyman title + "download_keyman_title" => "Descarga e instala Keyman", + + # Install Keyman for {platform} + "install_keyman" => "Instalar %1\$s", + + # Keyman for Android + "with_play_store" => + "Instala Keyman junto con el teclado %1\$s a través de Google Play Store:", + + # Install from Play Store + "install_from_play_store" => + "Instalar desde Play Store", + + # Installs Keyman and {keyboard} for {platform} + "keyman_and_keyboard_for_platform" => + "Instala Keyman y el teclado %1\$s para %2\$s", + + # Keyman already installed? + "already_installed" => "¿Keyman ya instalada?", + + # Downloads {keyboard} for {platform} + "downloads_keyboard_for_platform" => + "Descargas %1\$s para %2\$s", + + # {Keyboard} not found + "keyboard_not_found" => "No se encontró el teclado %1\$s." + +]; diff --git a/_includes/locale/strings/keyboards-install/fr.php b/_includes/locale/strings/keyboards-install/fr.php new file mode 100644 index 00000000..b299048b --- /dev/null +++ b/_includes/locale/strings/keyboards-install/fr.php @@ -0,0 +1,70 @@ + + "Le téléchargement de votre clavier %1\$s devrait démarrer sous peu. + Si ce n'est pas le cas, cliquez sur le bouton ci-dessous pour lancer le téléchargement.", + + # Help on installing keyboard + "help_on_installing_keyboard" => "Aide pour l'installation du clavier", + + # Help on installing Keyman + "help_on_installing_keyman" => "Aide à l'installation de Keyman", + + # Download keyboard + "download_keyboard" => "Télécharger le clavier", + + # Download just this keyboard... + "download_just_keyboard" => "Téléchargez uniquement ce clavier", + + # ... and then install in the app + "and_then_install_in_the_app" => "puis installez-le dans l'application.", + + # Install keyboard button + "install_keyboard" => "Installer le clavier", + + # {keyboard} home + "keyboard_home" => "%1\$s clavier Accueil", + + # Keyman for {platform} not installed + "platform_not_installed" => + "Si vous n'avez pas encore installé %1\$s, veuillez l'installer avant d'installer le clavier.", + + # Download and install Keyman title + "download_keyman_title" => "Téléchargez et installez Keyman", + + # Install Keyman for {platform} + "install_keyman" => "Installer %1\$s", + + # Keyman for Android + "with_play_store" => + "Installez Keyman ainsi que le clavier %1\$s via le Google Play Store:", + + # Install from Play Store + "install_from_play_store" => + "Installer depuis le Play Store", + + # Installs Keyman and {keyboard} for {platform} + "keyman_and_keyboard_for_platform" => + "Installe Keyman et le clavier %1\$s pour %2\$s", + + # Keyman already installed? + "already_installed" => "Keyman est-il déjà installé?", + + # Downloads {keyboard} for {platform} + "downloads_keyboard_for_platform" => + "Téléchargements %1\$s pour %2\$s", + + # {Keyboard} not found + "keyboard_not_found" => "Clavier %1\$s introuvable." + +]; diff --git a/keyboards/install.php b/keyboards/install.php index 756b3b8b..2b44f6ac 100644 --- a/keyboards/install.php +++ b/keyboards/install.php @@ -4,6 +4,7 @@ namespace Keyman\Site\com\keyman; require __DIR__ . '/../_includes/autoload.php'; + require_once('./session.php'); use Keyman\Site\com\keyman\templates\Head; use Keyman\Site\com\keyman\templates\Menu; @@ -15,6 +16,11 @@ use Keyman\Site\Common\KeymanVersion; use Keyman\Site\com\keyman\Validation; use Keyman\Site\com\keyman\Util; + use Keyman\Site\com\keyman\Locale; + + function _m($id, ...$args) { + return Locale::m('keyboards-install', $id, $args); + } // Bundled downloads will make use of Keyman tier, which the site visitor // can override with tier=[alpha|beta|stable]. If no override has been @@ -117,22 +123,25 @@ protected static function WriteWindowsBoxes() { ".exe"; $helpLink = KeymanHosts::Instance()->help_keyman_com . "/products/windows/current-version/start/download-and-install-keyman"; + $helpInstallingKeyman = _m("help_on_installing_keyman"); + $keyboardHome = _m("keyboard_home", $h['name']); $keyboardHomeUrl = "/keyboards/{$hu['id']}" . (empty($hu['bcp47']) ? "" : "?bcp47=" . $hu['bcp47']); + $keyboardDownloadShortly = _m("download_start_shortly", $h['name']); + $downloadKeyboard = _m("download_keyboard"); $result = << -

Your {$h['name']} keyboard download should start shortly. If it does not, - click the button below to start the download.

- +

$keyboardDownloadShortly

+ END; @@ -164,26 +173,33 @@ protected static function WritemacOSBoxes() { (empty($hu['bcp47']) ? "" : "&bcp47={$hu['bcp47']}"); $helpLink = KeymanHosts::Instance()->help_keyman_com . "/products/mac/current-version/start/install-keyboard"; + $helpInstallingKeyboard = _m("help_on_installing_keyboard"); + $keyboardHome = _m("keyboard_home", $h['name']); $keyboardHomeUrl = "/keyboards/{$hu['id']}" . (empty($hu['bcp47']) ? "" : "?bcp47=" . $hu['bcp47']); + $platformNotInstalled = _m("platform_not_installed", "Keyman for macOS"); $downloadKeymanUrl = KeymanHosts::Instance()->keyman_com . '/mac/download'; + $downloadKeymanTitle = _m("download_keyman_title"); + $installKeyman = _m("install_keyman", "Keyman for macOS"); + $installKeyboard = _m("install_keyboard"); + $downloadsKeyboardForPlatform = _m("downloads_keyboard_for_platform", $h['name'], "macOS"); $result = <<
-

If you have not yet installed Keyman for macOS, please install it first before installing the keyboard.

+

$platformNotInstalled

    -
  1. Install Keyman for macOS
  2. +
  3. $installKeyman
  4. - Install keyboard -
    Downloads {$h['name']} for macOS.
    + $installKeyboard +
    $downloadsKeyboardForPlatform
@@ -216,11 +232,18 @@ protected static function WriteLinuxBoxes() { (empty($hu['bcp47']) ? "" : "&bcp47={$hu['bcp47']}"); $helpLink = KeymanHosts::Instance()->help_keyman_com . "/products/linux/current-version/start/installing-keyboard"; + $helpInstallingKeyboard = _m("help_on_installing_keyboard"); + $keyboardHome = _m("keyboard_home", $h['name']); $keyboardHomeUrl = "/keyboards/{$hu['id']}" . (empty($hu['bcp47']) ? "" : "?bcp47=" . $hu['bcp47']); + $platformNotInstalled = _m("platform_not_installed", "Keyman for Linux"); $downloadKeymanUrl = KeymanHosts::Instance()->keyman_com . '/linux/download'; + $downloadKeymanTitle = _m("download_keyman_title"); + $installKeyman = _m("install_keyman", "Keyman for Linux"); + $installKeyboard = _m("install_keyboard"); + $downloadsKeyboardForPlatform = _m("downloads_keyboard_for_platform", $h['name'], "Linux"); $result = << @@ -228,18 +251,19 @@ protected static function WriteLinuxBoxes() { startAfterPageLoad_Linux(document.currentScript.dataset);
-

If you have not yet installed Keyman for Linux, please install it first before installing the keyboard.

+

$platformNotInstalled

    -
  1. Install Keyman for Linux
  2. +
  3. $installKeyman
  4. - Install keyboard + $installKeyboard +
    $downloadsKeyboardForPlatform

@@ -272,6 +296,8 @@ protected static function WriteAndroidBoxes() { (empty($hu['bcp47']) ? "" : "&bcp47={$hu['bcp47']}"); $helpLink = KeymanHosts::Instance()->help_keyman_com . "/products/android/current-version/start/installing-keyboards"; + $helpInstallingKeyboard = _m("help_on_installing_keyboard"); + $keyboardHome = _m("keyboard_home", $h['name']); $keyboardHomeUrl = "/keyboards/{$hu['id']}" . (empty($hu['bcp47']) ? "" : "?bcp47=" . $hu['bcp47']); @@ -281,21 +307,27 @@ protected static function WriteAndroidBoxes() { $referrer = "source=keyman&package={$u['id']}"; if(!empty($u['bcp47'])) $referrer .= "&bcp47={$u['bcp47']}"; + $downloadKeymanTitle = _m("download_keyman_title"); + $withPlayStore = _m("with_play_store", $h['name']); + $installFromPlayStore = _m("install_from_play_store"); + $installKeymanAndKeyboard = _m("keyman_and_keyboard_for_platform", $h['name'], "Android"); + $alreadyInstalled = _m("already_installed"); + $downloadJustKeyboard = _m("download_just_keyboard"); $downloadKeymanUrl = PlayStore::url . "&referrer=" . rawurlencode($referrer); + $andThenInstallInApp = _m("and_then_install_in_the_app"); $result = <<

-

Install Keyman together with {$h['name']} keyboard through the Google Play Store:

- Install from Play Store -
Installs Keyman and {$h['name']} keyboard for Android
+

$withPlayStore

+ $installFromPlayStore +
$installKeymanAndKeyboard

-

Keyman already installed? Download just this keyboard and then install in the app. -

+

$alreadyInstalled $downloadJustKeyboard $andThenInstallInApp

@@ -329,26 +361,33 @@ protected static function WriteiOSBoxes() { (empty($hu['bcp47']) ? "" : "&bcp47={$hu['bcp47']}"); $helpLink = KeymanHosts::Instance()->help_keyman_com . "/products/iphone-and-ipad/current-version/start/searching-for-keyboards"; + $helpInstallingKeyboard = _m("help_on_installing_keyboard"); + $keyboardHome = _m("keyboard_home", $h['name']); $keyboardHomeUrl = "/keyboards/{$hu['id']}" . (empty($hu['bcp47']) ? "" : "?bcp47=" . $hu['bcp47']); + $platformNotInstalled = _m("platform_not_installed", "Keyman for iPhone and iPad"); $downloadKeymanUrl = AppStore::url; + $downloadKeymanTitle = _m("download_keyman_title"); + $installKeyman = _m("install_keyman", "Keyman for iPhone and iPad"); + $installKeyboard = _m("install_keyboard"); + $downloadsKeyboardForPlatform = _m("downloads_keyboard_for_platform", $h['name'], "iPhone and iPad"); $result = <<
-

If you have not yet installed Keyman for iPhone and iPad, please install it first before installing the keyboard.

+

$platformNotInstalled

    -
  1. Install Keyman for iPhone and iPad
  2. +
  3. $installKeyman
  4. - Install keyboard -
    Downloads {$h['name']} for iPhone and iPad.
    + $installKeyboard +
    $downloadsKeyboardForPlatform
@@ -409,7 +448,7 @@ protected static function WriteTitle() { // If parameters are missing ... ?>

-

Keyboard not found.

+

Tier() == KeymanHosts::TIER_DEVELOPMENT && (ini_get('display_errors') !== '0')) { From e844b13d72c38bc2c877d5aacd822f75e010f3ab Mon Sep 17 00:00:00 2001 From: Darcy Wong Date: Wed, 5 Nov 2025 13:13:09 +0700 Subject: [PATCH 02/11] feat: Localize share keyboard page --- .../locale/strings/keyboards-share/en.php | 41 +++++++++++++++++++ .../locale/strings/keyboards-share/es.php | 41 +++++++++++++++++++ .../locale/strings/keyboards-share/fr.php | 41 +++++++++++++++++++ keyboards/share.php | 26 ++++++------ 4 files changed, 135 insertions(+), 14 deletions(-) create mode 100644 _includes/locale/strings/keyboards-share/en.php create mode 100644 _includes/locale/strings/keyboards-share/es.php create mode 100644 _includes/locale/strings/keyboards-share/fr.php diff --git a/_includes/locale/strings/keyboards-share/en.php b/_includes/locale/strings/keyboards-share/en.php new file mode 100644 index 00000000..c60042d9 --- /dev/null +++ b/_includes/locale/strings/keyboards-share/en.php @@ -0,0 +1,41 @@ + "Share Keyboard %1\$s", + + # Page title - Sharing {keyboard} + "h1_sharing_keyboard" => "Sharing keyboard %1\$s", + + "line1" => "You probably arrived here by scanning a QRCode or opening a link + to share a keyboard from the Keyman app.", + + "line2" => "We are sorry, but unfortunately, the keyboard you are interested in, called ", + + "line3" => "is not currently available from the Keyman keyboards repository.", + + "h2_how_to_get" => "How you can get this keyboard", + + "how_to_get_1" => "This keyboard has been distributed peer-to-peer rather than through + the Keyman keyboards repository, so the best way to access the keyboard + is to ask the person who shared this link or QRCode with you.", + + "how_to_get_2" => "If you cannot locate the person who shared the keyboard with you, + please do feel free to ask on the ", + + # link to the Keyman forum + "keyman_forum" => "Keyman Community Forum", + + "how_to_get_3" => "for assistance in locating the keyboard or a suitable alternative." + + +]; diff --git a/_includes/locale/strings/keyboards-share/es.php b/_includes/locale/strings/keyboards-share/es.php new file mode 100644 index 00000000..2ea9a128 --- /dev/null +++ b/_includes/locale/strings/keyboards-share/es.php @@ -0,0 +1,41 @@ + "Compartir teclado %1\$s", + + # Page title - Sharing {keyboard} + "h1_sharing_keyboard" => "Compartir teclado %1\$s", + + "line1" => "Probablemente llegaste aquí escaneando un código QR o abriendo un enlace + para compartir un teclado desde la aplicación Keyman.", + + "line2" => "Lo sentimos, pero desafortunadamente, el teclado que le interesa se llama", + + "line3" => "actualmente no está disponible en el repositorio de teclados Keyman.", + + "h2_how_to_get" => "Cómo puedes conseguir este teclado", + + "how_to_get_1" => "Este teclado se ha distribuido de forma peer-to-peer en lugar de a través de + el repositorio de teclados Keyman, por lo que la mejor manera de acceder al teclado + es preguntarle a la persona que compartió este enlace o código QR contigo.", + + "how_to_get_2" => "Si no logras encontrar a la persona con la que compartiste el teclado, + no dudes en preguntar en el foro.", + + # link to the Keyman forum + "keyman_forum" => "Foro de la comunidad Keyman", + + "how_to_get_3" => "para obtener ayuda para localizar el teclado o una alternativa adecuada." + + +]; diff --git a/_includes/locale/strings/keyboards-share/fr.php b/_includes/locale/strings/keyboards-share/fr.php new file mode 100644 index 00000000..c928fbc7 --- /dev/null +++ b/_includes/locale/strings/keyboards-share/fr.php @@ -0,0 +1,41 @@ + "Partager le clavier %1\$s", + + # Page title - Sharing {keyboard} + "h1_sharing_keyboard" => "Partage de clavier %1\$s", + + "line1" => "Vous êtes probablement arrivé ici en scannant un QR Code ou en ouvrant un lien + pour partager un clavier depuis l'application Keyman.", + + "line2" => "Nous sommes désolés, mais malheureusement, le clavier qui vous intéresse, appelé", + + "line3" => "n'est actuellement pas disponible dans le dépôt de claviers Keyman.", + + "h2_how_to_get" => "Comment vous pouvez vous procurer ce clavier", + + "how_to_get_1" => "Ce clavier a été distribué de pair à pair plutôt que par l'intermédiaire du + référentiel de claviers Keyman. + La meilleure façon d'y accéder est donc de demander à la personne qui vous a partagé ce lien ou ce code QR.", + + "how_to_get_2" => "Si vous ne parvenez pas à retrouver la personne avec qui vous avez partagé le clavier, + n'hésitez pas à poser votre question sur", + + # link to the Keyman forum + "keyman_forum" => "Forum communautaire Keyman", + + "how_to_get_3" => "pour obtenir de l'aide afin de trouver le clavier ou une alternative appropriée." + + +]; diff --git a/keyboards/share.php b/keyboards/share.php index ee254543..657b303a 100644 --- a/keyboards/share.php +++ b/keyboards/share.php @@ -4,6 +4,11 @@ require_once('./session.php'); require_once __DIR__ . '/../_includes/autoload.php'; use Keyman\Site\Common\KeymanHosts; + use Keyman\Site\com\keyman\Locale; + + function _m($id, ...$args) { + return Locale::m('keyboards-share', $id, $args); + } if(!isset($_REQUEST['id'])) { header('Location: /keyboards'); @@ -38,26 +43,19 @@ function find_keyboard($id) { // Keyboard not found, so let's explain. $head_options = [ - 'title' => "Share Keyboard: $id" + 'title' => _m("head_title", $id) ]; head($head_options); ?> -

Sharing keyboard

+

-

You probably arrived here by scanning a QRCode or opening a link -to share a keyboard from the Keyman app. We are sorry, but unfortunately, -the keyboard you are interested in, called , is not currently available from the -Keyman keyboards repository.

+

,

-

How you can get this keyboard

+

-

This keyboard has been distributed peer-to-peer rather than through -the Keyman keyboards repository, so the best way to access the keyboard -is to ask the person who shared this link or QRCode with you.

+

-

If you cannot locate the person who shared the keyboard with you, -please do feel free to ask on the -Keyman Community Forum for assistance in locating the keyboard or -a suitable alternative.

\ No newline at end of file +

+

\ No newline at end of file From 6850a23b3b51e06f9db833f670ccb3e3012de4c7 Mon Sep 17 00:00:00 2001 From: Darcy Wong Date: Mon, 17 Nov 2025 15:23:16 +0700 Subject: [PATCH 03/11] fix: append query string for share --- .htaccess | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.htaccess b/.htaccess index d5c9ef4c..ace60cd6 100644 --- a/.htaccess +++ b/.htaccess @@ -93,7 +93,7 @@ RewriteRule "^keyboards/download/([^/]+)$" "/keyboards/keyboard.php?id=$1" [END, # /keyboards/share/[id] to /keyboards/share.php # if the keyboard exists in the repo, then share.php will redirect to /keyboards/ -RewriteRule "^keyboards/share/([^/]+)$" "/keyboards/share.php?id=$1" [END] +RewriteRule "^keyboards/share/([^/]+)$" "/keyboards/share.php?id=$1" [END,QSA] # /keyboards/{id}.json to /keyboards/keyboard.json.php RewriteRule "^keyboards/(?!keyboard.json)(.*)\.json$" "/keyboards/keyboard.json.php?id=$1" [END] From b4e1e1984775edf7c03df311a22c6a45194b68b0 Mon Sep 17 00:00:00 2001 From: Darcy Wong Date: Thu, 20 Nov 2025 06:12:50 +0700 Subject: [PATCH 04/11] move share/install into keyboards/ --- .../strings/{keyboards-install => keyboards/install}/en.php | 0 .../strings/{keyboards-install => keyboards/install}/es.php | 0 .../strings/{keyboards-install => keyboards/install}/fr.php | 0 .../locale/strings/{keyboards-share => keyboards/share}/en.php | 0 .../locale/strings/{keyboards-share => keyboards/share}/es.php | 0 .../locale/strings/{keyboards-share => keyboards/share}/fr.php | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename _includes/locale/strings/{keyboards-install => keyboards/install}/en.php (100%) rename _includes/locale/strings/{keyboards-install => keyboards/install}/es.php (100%) rename _includes/locale/strings/{keyboards-install => keyboards/install}/fr.php (100%) rename _includes/locale/strings/{keyboards-share => keyboards/share}/en.php (100%) rename _includes/locale/strings/{keyboards-share => keyboards/share}/es.php (100%) rename _includes/locale/strings/{keyboards-share => keyboards/share}/fr.php (100%) diff --git a/_includes/locale/strings/keyboards-install/en.php b/_includes/locale/strings/keyboards/install/en.php similarity index 100% rename from _includes/locale/strings/keyboards-install/en.php rename to _includes/locale/strings/keyboards/install/en.php diff --git a/_includes/locale/strings/keyboards-install/es.php b/_includes/locale/strings/keyboards/install/es.php similarity index 100% rename from _includes/locale/strings/keyboards-install/es.php rename to _includes/locale/strings/keyboards/install/es.php diff --git a/_includes/locale/strings/keyboards-install/fr.php b/_includes/locale/strings/keyboards/install/fr.php similarity index 100% rename from _includes/locale/strings/keyboards-install/fr.php rename to _includes/locale/strings/keyboards/install/fr.php diff --git a/_includes/locale/strings/keyboards-share/en.php b/_includes/locale/strings/keyboards/share/en.php similarity index 100% rename from _includes/locale/strings/keyboards-share/en.php rename to _includes/locale/strings/keyboards/share/en.php diff --git a/_includes/locale/strings/keyboards-share/es.php b/_includes/locale/strings/keyboards/share/es.php similarity index 100% rename from _includes/locale/strings/keyboards-share/es.php rename to _includes/locale/strings/keyboards/share/es.php diff --git a/_includes/locale/strings/keyboards-share/fr.php b/_includes/locale/strings/keyboards/share/fr.php similarity index 100% rename from _includes/locale/strings/keyboards-share/fr.php rename to _includes/locale/strings/keyboards/share/fr.php From 216c8208bc51698b56f92ac66f7a577c58e047c2 Mon Sep 17 00:00:00 2001 From: Darcy Wong Date: Thu, 20 Nov 2025 06:51:48 +0700 Subject: [PATCH 05/11] Refactor install page --- keyboards/install.php | 109 +++++++++++++++++------------------------- 1 file changed, 44 insertions(+), 65 deletions(-) diff --git a/keyboards/install.php b/keyboards/install.php index 2b44f6ac..50e87c75 100644 --- a/keyboards/install.php +++ b/keyboards/install.php @@ -18,8 +18,12 @@ use Keyman\Site\com\keyman\Util; use Keyman\Site\com\keyman\Locale; - function _m($id, ...$args) { - return Locale::m('keyboards-install', $id, $args); + define('LOCALE_KEYBOARD_INSTALL', 'keyboards/install'); + $_m_KeyboardInstall = function($id, ...$args) { + return Locale::m(LOCALE_KEYBOARD_INSTALL, $id, ...$args); + }; + function _m_KeyboardInstall($id, ...$args) { + return Locale::m(LOCALE_KEYBOARD_INSTALL, $id, ...$args); } // Bundled downloads will make use of Keyman tier, which the site visitor @@ -94,6 +98,8 @@ public static function render_keyboard_details($id, $tier, $bcp47) { } protected static function WriteWindowsBoxes() { + global $_m_KeyboardInstall; + $keyboard = self::$keyboard; $tier = self::$tier; $version = self::$versions->windows->$tier; @@ -123,25 +129,21 @@ protected static function WriteWindowsBoxes() { ".exe"; $helpLink = KeymanHosts::Instance()->help_keyman_com . "/products/windows/current-version/start/download-and-install-keyman"; - $helpInstallingKeyman = _m("help_on_installing_keyman"); - $keyboardHome = _m("keyboard_home", $h['name']); $keyboardHomeUrl = "/keyboards/{$hu['id']}" . (empty($hu['bcp47']) ? "" : "?bcp47=" . $hu['bcp47']); - $keyboardDownloadShortly = _m("download_start_shortly", $h['name']); - $downloadKeyboard = _m("download_keyboard"); $result = << -

$keyboardDownloadShortly

- +

{$_m_KeyboardInstall('download_start_shortly', $h['name'])}

+ END; @@ -149,6 +151,8 @@ protected static function WriteWindowsBoxes() { } protected static function WritemacOSBoxes() { + global $_m_KeyboardInstall; + $keyboard = self::$keyboard; $tier = self::$tier; @@ -173,33 +177,26 @@ protected static function WritemacOSBoxes() { (empty($hu['bcp47']) ? "" : "&bcp47={$hu['bcp47']}"); $helpLink = KeymanHosts::Instance()->help_keyman_com . "/products/mac/current-version/start/install-keyboard"; - $helpInstallingKeyboard = _m("help_on_installing_keyboard"); - $keyboardHome = _m("keyboard_home", $h['name']); $keyboardHomeUrl = "/keyboards/{$hu['id']}" . (empty($hu['bcp47']) ? "" : "?bcp47=" . $hu['bcp47']); - $platformNotInstalled = _m("platform_not_installed", "Keyman for macOS"); $downloadKeymanUrl = KeymanHosts::Instance()->keyman_com . '/mac/download'; - $downloadKeymanTitle = _m("download_keyman_title"); - $installKeyman = _m("install_keyman", "Keyman for macOS"); - $installKeyboard = _m("install_keyboard"); - $downloadsKeyboardForPlatform = _m("downloads_keyboard_for_platform", $h['name'], "macOS"); $result = <<
-

$platformNotInstalled

+

{$_m_KeyboardInstall('platform_not_installed', 'Keyman for macOS')}

    -
  1. $installKeyman
  2. +
  3. {$_m_KeyboardInstall('install_keyman', 'Keyman for macOS')}
  4. - $installKeyboard -
    $downloadsKeyboardForPlatform
    + {$_m_KeyboardInstall('install_keyboard')} +
    {$_m_KeyboardInstall('downloads_keyboard_for_platform', $h['name'], 'macOS')}
@@ -208,6 +205,8 @@ protected static function WritemacOSBoxes() { } protected static function WriteLinuxBoxes() { + global $_m_KeyboardInstall; + $keyboard = self::$keyboard; $tier = self::$tier; @@ -232,18 +231,11 @@ protected static function WriteLinuxBoxes() { (empty($hu['bcp47']) ? "" : "&bcp47={$hu['bcp47']}"); $helpLink = KeymanHosts::Instance()->help_keyman_com . "/products/linux/current-version/start/installing-keyboard"; - $helpInstallingKeyboard = _m("help_on_installing_keyboard"); - $keyboardHome = _m("keyboard_home", $h['name']); $keyboardHomeUrl = "/keyboards/{$hu['id']}" . (empty($hu['bcp47']) ? "" : "?bcp47=" . $hu['bcp47']); - $platformNotInstalled = _m("platform_not_installed", "Keyman for Linux"); $downloadKeymanUrl = KeymanHosts::Instance()->keyman_com . '/linux/download'; - $downloadKeymanTitle = _m("download_keyman_title"); - $installKeyman = _m("install_keyman", "Keyman for Linux"); - $installKeyboard = _m("install_keyboard"); - $downloadsKeyboardForPlatform = _m("downloads_keyboard_for_platform", $h['name'], "Linux"); $result = << @@ -251,19 +243,19 @@ protected static function WriteLinuxBoxes() { startAfterPageLoad_Linux(document.currentScript.dataset);
-

$platformNotInstalled

+

{$_m_KeyboardInstall('platform_not_installed', 'Keyman for Linux')}

    -
  1. $installKeyman
  2. +
  3. {$_m_KeyboardInstall('install_keyman', 'Keyman for Linux')}
  4. - $installKeyboard -
    $downloadsKeyboardForPlatform
    + {$_m_KeyboardInstall('install_keyboard')} +
    {$_m_KeyboardInstall('downloads_keyboard_for_platform', $h['name'], 'Linux')}

@@ -272,6 +264,8 @@ protected static function WriteLinuxBoxes() { } protected static function WriteAndroidBoxes() { + global $_m_KeyboardInstall; + $keyboard = self::$keyboard; $tier = self::$tier; @@ -296,8 +290,6 @@ protected static function WriteAndroidBoxes() { (empty($hu['bcp47']) ? "" : "&bcp47={$hu['bcp47']}"); $helpLink = KeymanHosts::Instance()->help_keyman_com . "/products/android/current-version/start/installing-keyboards"; - $helpInstallingKeyboard = _m("help_on_installing_keyboard"); - $keyboardHome = _m("keyboard_home", $h['name']); $keyboardHomeUrl = "/keyboards/{$hu['id']}" . (empty($hu['bcp47']) ? "" : "?bcp47=" . $hu['bcp47']); @@ -307,27 +299,20 @@ protected static function WriteAndroidBoxes() { $referrer = "source=keyman&package={$u['id']}"; if(!empty($u['bcp47'])) $referrer .= "&bcp47={$u['bcp47']}"; - $downloadKeymanTitle = _m("download_keyman_title"); - $withPlayStore = _m("with_play_store", $h['name']); - $installFromPlayStore = _m("install_from_play_store"); - $installKeymanAndKeyboard = _m("keyman_and_keyboard_for_platform", $h['name'], "Android"); - $alreadyInstalled = _m("already_installed"); - $downloadJustKeyboard = _m("download_just_keyboard"); $downloadKeymanUrl = PlayStore::url . "&referrer=" . rawurlencode($referrer); - $andThenInstallInApp = _m("and_then_install_in_the_app"); $result = <<

-

$withPlayStore

- $installFromPlayStore -
$installKeymanAndKeyboard
+

{$_m_KeyboardInstall('with_play_store', $h['name'])}

+ {$_m_KeyboardInstall('install_from_play_store')} +
{$_m_KeyboardInstall('keyman_and_keyboard_for_platform', $h['name'], 'Android')}

-

$alreadyInstalled $downloadJustKeyboard $andThenInstallInApp

+

{$_m_KeyboardInstall('already_installed')} {$_m_KeyboardInstall('download_just_keyboard')} {$_m_KeyboardInstall('and_then_install_in_the_app')}

@@ -336,6 +321,7 @@ protected static function WriteAndroidBoxes() { } protected static function WriteiOSBoxes() { + global $_m_KeyboardInstall; $keyboard = self::$keyboard; $tier = self::$tier; @@ -361,33 +347,26 @@ protected static function WriteiOSBoxes() { (empty($hu['bcp47']) ? "" : "&bcp47={$hu['bcp47']}"); $helpLink = KeymanHosts::Instance()->help_keyman_com . "/products/iphone-and-ipad/current-version/start/searching-for-keyboards"; - $helpInstallingKeyboard = _m("help_on_installing_keyboard"); - $keyboardHome = _m("keyboard_home", $h['name']); $keyboardHomeUrl = "/keyboards/{$hu['id']}" . (empty($hu['bcp47']) ? "" : "?bcp47=" . $hu['bcp47']); - $platformNotInstalled = _m("platform_not_installed", "Keyman for iPhone and iPad"); $downloadKeymanUrl = AppStore::url; - $downloadKeymanTitle = _m("download_keyman_title"); - $installKeyman = _m("install_keyman", "Keyman for iPhone and iPad"); - $installKeyboard = _m("install_keyboard"); - $downloadsKeyboardForPlatform = _m("downloads_keyboard_for_platform", $h['name'], "iPhone and iPad"); $result = <<
-

$platformNotInstalled

+

{$_m_KeyboardInstall('platform_not_installed', 'Keyman for iPhone and iPad')}

    -
  1. $installKeyman
  2. +
  3. {$_m_KeyboardInstall('install_keyman', 'Keyman for iPhone and iPad')}
  4. - $installKeyboard -
    $downloadsKeyboardForPlatform
    + {$_m_KeyboardInstall('install_keyboard')} +
    {$_m_KeyboardInstall('downloads_keyboard_for_platform', $h['name'], 'iPhone and iPad')}
@@ -448,7 +427,7 @@ protected static function WriteTitle() { // If parameters are missing ... ?>

-

+

Tier() == KeymanHosts::TIER_DEVELOPMENT && (ini_get('display_errors') !== '0')) { From 60a6abb1212a40b5841be821c6bdecd38298bf47 Mon Sep 17 00:00:00 2001 From: Darcy Wong Date: Thu, 20 Nov 2025 07:02:37 +0700 Subject: [PATCH 06/11] Refactor share --- keyboards/share.php | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/keyboards/share.php b/keyboards/share.php index 657b303a..2873a89c 100644 --- a/keyboards/share.php +++ b/keyboards/share.php @@ -6,8 +6,12 @@ use Keyman\Site\Common\KeymanHosts; use Keyman\Site\com\keyman\Locale; - function _m($id, ...$args) { - return Locale::m('keyboards-share', $id, $args); + define('LOCALE_KEYBOARD_SHARE', 'keyboards/share'); + $_m_KeyboardShare = function($id, ...$args) { + return Locale::m(LOCALE_KEYBOARD_SHARE, $id, ...$args); + }; + function _m_KeyboardShare($id, ...$args) { + return Locale::m(LOCALE_KEYBOARD_SHARE, $id, ...$args); } if(!isset($_REQUEST['id'])) { @@ -43,19 +47,19 @@ function find_keyboard($id) { // Keyboard not found, so let's explain. $head_options = [ - 'title' => _m("head_title", $id) + 'title' => $_m_KeyboardShare('head_title', $id) ]; head($head_options); ?> -

+

-

,

+

,

-

+

-

+

-

-

\ No newline at end of file +

+

\ No newline at end of file From 29db0fab3af36c9eea4e9686aa91b62a024094d7 Mon Sep 17 00:00:00 2001 From: Darcy Wong Date: Wed, 3 Dec 2025 18:42:22 +0700 Subject: [PATCH 07/11] Apply suggestions from code review Co-authored-by: Marc Durdin --- keyboards/install.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/keyboards/install.php b/keyboards/install.php index 50e87c75..04779647 100644 --- a/keyboards/install.php +++ b/keyboards/install.php @@ -19,10 +19,10 @@ use Keyman\Site\com\keyman\Locale; define('LOCALE_KEYBOARD_INSTALL', 'keyboards/install'); - $_m_KeyboardInstall = function($id, ...$args) { + $_m = function($id, ...$args) { return Locale::m(LOCALE_KEYBOARD_INSTALL, $id, ...$args); }; - function _m_KeyboardInstall($id, ...$args) { + function _m($id, ...$args) { return Locale::m(LOCALE_KEYBOARD_INSTALL, $id, ...$args); } From dd1f51d75993a731863b6fc19d64e3a90df04cea Mon Sep 17 00:00:00 2001 From: Darcy Wong Date: Wed, 3 Dec 2025 20:21:50 +0700 Subject: [PATCH 08/11] chore: rename constant --- _includes/includes/ui/keyboard-details.php | 6 +++--- keyboards/install.php | 6 +++--- keyboards/share.php | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/_includes/includes/ui/keyboard-details.php b/_includes/includes/ui/keyboard-details.php index 2dfbd073..8b41b37a 100644 --- a/_includes/includes/ui/keyboard-details.php +++ b/_includes/includes/ui/keyboard-details.php @@ -11,12 +11,12 @@ use \Keyman\Site\com\keyman\Locale; use \Keyman\Site\com\keyman; - define('LOCALE_KEYBOARD_DETAILS', 'keyboards/details'); + define('LOCALE_KEYBOARDS_DETAILS', 'keyboards/details'); $_m_KeyboardDetails = function($id, ...$args) { - return Locale::m(LOCALE_KEYBOARD_DETAILS, $id, ...$args); + return Locale::m(LOCALE_KEYBOARDS_DETAILS, $id, ...$args); }; function _m_KeyboardDetails($id, ...$args) { - return Locale::m(LOCALE_KEYBOARD_DETAILS, $id, ...$args); + return Locale::m(LOCALE_KEYBOARDS_DETAILS, $id, ...$args); } define('GITHUB_ROOT', 'https://github.com/keymanapp/keyboards/tree/master/'); diff --git a/keyboards/install.php b/keyboards/install.php index 04779647..ff235f4d 100644 --- a/keyboards/install.php +++ b/keyboards/install.php @@ -18,12 +18,12 @@ use Keyman\Site\com\keyman\Util; use Keyman\Site\com\keyman\Locale; - define('LOCALE_KEYBOARD_INSTALL', 'keyboards/install'); + define('LOCALE_KEYBOARDS_INSTALL', 'keyboards/install'); $_m = function($id, ...$args) { - return Locale::m(LOCALE_KEYBOARD_INSTALL, $id, ...$args); + return Locale::m(LOCALE_KEYBOARDS_INSTALL, $id, ...$args); }; function _m($id, ...$args) { - return Locale::m(LOCALE_KEYBOARD_INSTALL, $id, ...$args); + return Locale::m(LOCALE_KEYBOARDS_INSTALL, $id, ...$args); } // Bundled downloads will make use of Keyman tier, which the site visitor diff --git a/keyboards/share.php b/keyboards/share.php index 2873a89c..5980211c 100644 --- a/keyboards/share.php +++ b/keyboards/share.php @@ -6,12 +6,12 @@ use Keyman\Site\Common\KeymanHosts; use Keyman\Site\com\keyman\Locale; - define('LOCALE_KEYBOARD_SHARE', 'keyboards/share'); + define('LOCALE_KEYBOARDS_SHARE', 'keyboards/share'); $_m_KeyboardShare = function($id, ...$args) { - return Locale::m(LOCALE_KEYBOARD_SHARE, $id, ...$args); + return Locale::m(LOCALE_KEYBOARDS_SHARE, $id, ...$args); }; function _m_KeyboardShare($id, ...$args) { - return Locale::m(LOCALE_KEYBOARD_SHARE, $id, ...$args); + return Locale::m(LOCALE_KEYBOARDS_SHARE, $id, ...$args); } if(!isset($_REQUEST['id'])) { From f67458b812ac9830944e8c3b18bb33bba4297f01 Mon Sep 17 00:00:00 2001 From: Darcy Wong Date: Thu, 4 Dec 2025 09:12:39 +0700 Subject: [PATCH 09/11] Use _m rename --- keyboards/install.php | 68 +++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/keyboards/install.php b/keyboards/install.php index ff235f4d..d13c3c2a 100644 --- a/keyboards/install.php +++ b/keyboards/install.php @@ -98,7 +98,7 @@ public static function render_keyboard_details($id, $tier, $bcp47) { } protected static function WriteWindowsBoxes() { - global $_m_KeyboardInstall; + global $_m; $keyboard = self::$keyboard; $tier = self::$tier; @@ -135,15 +135,15 @@ protected static function WriteWindowsBoxes() { $result = << -

{$_m_KeyboardInstall('download_start_shortly', $h['name'])}

- +

{$_m('download_start_shortly', $h['name'])}

+ END; @@ -151,7 +151,7 @@ protected static function WriteWindowsBoxes() { } protected static function WritemacOSBoxes() { - global $_m_KeyboardInstall; + global $_m; $keyboard = self::$keyboard; $tier = self::$tier; @@ -186,17 +186,17 @@ protected static function WritemacOSBoxes() { $result = <<
-

{$_m_KeyboardInstall('platform_not_installed', 'Keyman for macOS')}

+

{$_m('platform_not_installed', 'Keyman for macOS')}

    -
  1. {$_m_KeyboardInstall('install_keyman', 'Keyman for macOS')}
  2. +
  3. {$_m('install_keyman', 'Keyman for macOS')}
  4. - {$_m_KeyboardInstall('install_keyboard')} -
    {$_m_KeyboardInstall('downloads_keyboard_for_platform', $h['name'], 'macOS')}
    + {$_m('install_keyboard')} +
    {$_m('downloads_keyboard_for_platform', $h['name'], 'macOS')}
@@ -205,7 +205,7 @@ protected static function WritemacOSBoxes() { } protected static function WriteLinuxBoxes() { - global $_m_KeyboardInstall; + global $_m; $keyboard = self::$keyboard; $tier = self::$tier; @@ -243,19 +243,19 @@ protected static function WriteLinuxBoxes() { startAfterPageLoad_Linux(document.currentScript.dataset);
-

{$_m_KeyboardInstall('platform_not_installed', 'Keyman for Linux')}

+

{$_m('platform_not_installed', 'Keyman for Linux')}

    -
  1. {$_m_KeyboardInstall('install_keyman', 'Keyman for Linux')}
  2. +
  3. {$_m('install_keyman', 'Keyman for Linux')}
  4. - {$_m_KeyboardInstall('install_keyboard')} -
    {$_m_KeyboardInstall('downloads_keyboard_for_platform', $h['name'], 'Linux')}
    + {$_m('install_keyboard')} +
    {$_m('downloads_keyboard_for_platform', $h['name'], 'Linux')}

@@ -264,7 +264,7 @@ protected static function WriteLinuxBoxes() { } protected static function WriteAndroidBoxes() { - global $_m_KeyboardInstall; + global $_m; $keyboard = self::$keyboard; $tier = self::$tier; @@ -305,14 +305,14 @@ protected static function WriteAndroidBoxes() {

-

{$_m_KeyboardInstall('with_play_store', $h['name'])}

- {$_m_KeyboardInstall('install_from_play_store')} -
{$_m_KeyboardInstall('keyman_and_keyboard_for_platform', $h['name'], 'Android')}
+

{$_m('with_play_store', $h['name'])}

+ {$_m('install_from_play_store')} +
{$_m('keyman_and_keyboard_for_platform', $h['name'], 'Android')}

-

{$_m_KeyboardInstall('already_installed')} {$_m_KeyboardInstall('download_just_keyboard')} {$_m_KeyboardInstall('and_then_install_in_the_app')}

+

{$_m('already_installed')} {$_m('download_just_keyboard')} {$_m('and_then_install_in_the_app')}

@@ -321,7 +321,7 @@ protected static function WriteAndroidBoxes() { } protected static function WriteiOSBoxes() { - global $_m_KeyboardInstall; + global $_m; $keyboard = self::$keyboard; $tier = self::$tier; @@ -356,17 +356,17 @@ protected static function WriteiOSBoxes() { $result = <<
-

{$_m_KeyboardInstall('platform_not_installed', 'Keyman for iPhone and iPad')}

+

{$_m('platform_not_installed', 'Keyman for iPhone and iPad')}

    -
  1. {$_m_KeyboardInstall('install_keyman', 'Keyman for iPhone and iPad')}
  2. +
  3. {$_m('install_keyman', 'Keyman for iPhone and iPad')}
  4. - {$_m_KeyboardInstall('install_keyboard')} -
    {$_m_KeyboardInstall('downloads_keyboard_for_platform', $h['name'], 'iPhone and iPad')}
    + {$_m('install_keyboard')} +
    {$_m('downloads_keyboard_for_platform', $h['name'], 'iPhone and iPad')}
@@ -427,7 +427,7 @@ protected static function WriteTitle() { // If parameters are missing ... ?>

-

+

Tier() == KeymanHosts::TIER_DEVELOPMENT && (ini_get('display_errors') !== '0')) { From a0da12effe83a51ea1138cf280e187f63a0beff5 Mon Sep 17 00:00:00 2001 From: Darcy Wong Date: Thu, 4 Dec 2025 09:22:13 +0700 Subject: [PATCH 10/11] Also use _m in share.php --- keyboards/share.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/keyboards/share.php b/keyboards/share.php index 5980211c..5a7c46e9 100644 --- a/keyboards/share.php +++ b/keyboards/share.php @@ -7,10 +7,10 @@ use Keyman\Site\com\keyman\Locale; define('LOCALE_KEYBOARDS_SHARE', 'keyboards/share'); - $_m_KeyboardShare = function($id, ...$args) { + $_m = function($id, ...$args) { return Locale::m(LOCALE_KEYBOARDS_SHARE, $id, ...$args); }; - function _m_KeyboardShare($id, ...$args) { + function _m($id, ...$args) { return Locale::m(LOCALE_KEYBOARDS_SHARE, $id, ...$args); } @@ -47,19 +47,19 @@ function find_keyboard($id) { // Keyboard not found, so let's explain. $head_options = [ - 'title' => $_m_KeyboardShare('head_title', $id) + 'title' => $_m('head_title', $id) ]; head($head_options); ?> -

+

-

,

+

,

-

+

-

+

-

-

\ No newline at end of file +

+

\ No newline at end of file From 814466dd690faf17aaf1067c81cc91095e503d99 Mon Sep 17 00:00:00 2001 From: Darcy Wong Date: Thu, 4 Dec 2025 13:38:42 +0700 Subject: [PATCH 11/11] use `Locale::definePageLocale()` on install and share pages --- keyboards/install.php | 2 +- keyboards/share.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/keyboards/install.php b/keyboards/install.php index d13c3c2a..8a69b2ca 100644 --- a/keyboards/install.php +++ b/keyboards/install.php @@ -18,7 +18,7 @@ use Keyman\Site\com\keyman\Util; use Keyman\Site\com\keyman\Locale; - define('LOCALE_KEYBOARDS_INSTALL', 'keyboards/install'); + Locale::definePageLocale('LOCALE_KEYBOARDS_INSTALL', 'keyboards/install'); $_m = function($id, ...$args) { return Locale::m(LOCALE_KEYBOARDS_INSTALL, $id, ...$args); }; diff --git a/keyboards/share.php b/keyboards/share.php index 5a7c46e9..4f9ac19b 100644 --- a/keyboards/share.php +++ b/keyboards/share.php @@ -6,7 +6,7 @@ use Keyman\Site\Common\KeymanHosts; use Keyman\Site\com\keyman\Locale; - define('LOCALE_KEYBOARDS_SHARE', 'keyboards/share'); + Locale::definePageLocale('LOCALE_KEYBOARDS_SHARE', 'keyboards/share'); $_m = function($id, ...$args) { return Locale::m(LOCALE_KEYBOARDS_SHARE, $id, ...$args); };