From 230c71927a7b7c5b626ca2b6a61a2d1861a27b4b Mon Sep 17 00:00:00 2001 From: Niklas080208 Date: Thu, 16 Jul 2026 00:49:39 +0200 Subject: [PATCH 1/2] Add JSON language support for sysmodule notifications. Load Ultrahand locale translations from /config/horizon-oc/lang so user-facing hoc-clk alerts match the overlay language. --- Source/hoc-clk/overlay/lang/de.json | 16 +- Source/hoc-clk/overlay/lang/en.json | 16 +- Source/hoc-clk/overlay/lang/es.json | 16 +- Source/hoc-clk/overlay/lang/fr.json | 16 +- Source/hoc-clk/overlay/lang/it.json | 16 +- Source/hoc-clk/overlay/lang/ja.json | 16 +- Source/hoc-clk/overlay/lang/jp.json | 16 +- Source/hoc-clk/overlay/lang/ko.json | 16 +- Source/hoc-clk/overlay/lang/nl.json | 16 +- Source/hoc-clk/overlay/lang/pl.json | 16 +- Source/hoc-clk/overlay/lang/pt.json | 16 +- Source/hoc-clk/overlay/lang/ru.json | 16 +- Source/hoc-clk/overlay/lang/template.json | 14 ++ Source/hoc-clk/overlay/lang/uk.json | 16 +- Source/hoc-clk/overlay/lang/zh-cn.json | 16 +- Source/hoc-clk/overlay/lang/zh-tw.json | 16 +- Source/hoc-clk/sysmodule/src/hos/lang.cpp | 141 ++++++++++++++++++ Source/hoc-clk/sysmodule/src/hos/lang.hpp | 29 ++++ .../sysmodule/src/hos/notification.cpp | 5 +- 19 files changed, 413 insertions(+), 16 deletions(-) create mode 100644 Source/hoc-clk/sysmodule/src/hos/lang.cpp create mode 100644 Source/hoc-clk/sysmodule/src/hos/lang.hpp diff --git a/Source/hoc-clk/overlay/lang/de.json b/Source/hoc-clk/overlay/lang/de.json index 00e05a56..c06d9277 100644 --- a/Source/hoc-clk/overlay/lang/de.json +++ b/Source/hoc-clk/overlay/lang/de.json @@ -211,5 +211,19 @@ "X: %u Y: %u": "X: %u Y: %u", "%u.%u%u mV": "%u.%u%u mV", "Compiling with minimal features": "Kompilieren mit minimalen Funktionen", - "THE BEER-WARE LICENSE": "DIE BIERWAREN-LIZENZ" + "THE BEER-WARE LICENSE": "DIE BIERWAREN-LIZENZ", + "Horizon OC\nKip opening failed": "Horizon OC\nKIP konnte nicht geöffnet werden", + "Horizon OC\nKip read failed": "Horizon OC\nKIP konnte nicht gelesen werden", + "Horizon OC\nOutdated kip detected!\nPlease update Horizon OC": "Horizon OC\nVeraltetes KIP erkannt!\nBitte Horizon OC aktualisieren", + "Horizon OC\nOutdated sysmodule detected!\nPlease update Horizon OC": "Horizon OC\nVeraltetes Sysmodule erkannt!\nBitte Horizon OC aktualisieren", + "Horizon OC\nKip write failed": "Horizon OC\nKIP-Schreiben fehlgeschlagen", + "Horizon OC\nKip config set failed": "Horizon OC\nKIP-Konfiguration fehlgeschlagen", + "Kip is not loaded!": "KIP ist nicht geladen!", + "Horizon OC\nKIP has been updated\nPlease reboot your console": "Horizon OC\nKIP wurde aktualisiert\nBitte starte die Konsole neu", + "Horizon OC has been installed": "Horizon OC wurde installiert", + "Horizon OC\nConfig Buffer Mismatch": "Horizon OC\nKonfigurationspuffer stimmt nicht überein", + "Horizon OC\nDeactivated frequency.\nReboot to apply.": "Horizon OC\nFrequenz deaktiviert.\nNeustart zum Anwenden.", + "Horizon OC\nSecmon read failed!\n This may be a hardware issue!": "Horizon OC\nSecmon-Lesen fehlgeschlagen!\n Dies kann ein Hardwareproblem sein!", + "Horizon OC\nFailed to write I2C\nwhile setting vddq": "Horizon OC\nI2C-Schreiben fehlgeschlagen\nbeim Setzen von VDDQ", + "Horizon OC\nKip version mismatch\nPlease reinstall Horizon OC": "Horizon OC\nKIP-Versionskonflikt\nBitte Horizon OC neu installieren" } diff --git a/Source/hoc-clk/overlay/lang/en.json b/Source/hoc-clk/overlay/lang/en.json index 727fab93..88121956 100644 --- a/Source/hoc-clk/overlay/lang/en.json +++ b/Source/hoc-clk/overlay/lang/en.json @@ -137,5 +137,19 @@ "or 1228MHz on HiOPT can cause ": "or 1228MHz on HiOPT can cause ", "permanent damage to your Switch!": "permanent damage to your Switch!", "921MHz without UV and 960MHz on": "921MHz without UV and 960MHz on", - "SLT or HiOPT can cause ": "SLT or HiOPT can cause " + "SLT or HiOPT can cause ": "SLT or HiOPT can cause ", + "Horizon OC\nKip opening failed": "Horizon OC\nKip opening failed", + "Horizon OC\nKip read failed": "Horizon OC\nKip read failed", + "Horizon OC\nOutdated kip detected!\nPlease update Horizon OC": "Horizon OC\nOutdated kip detected!\nPlease update Horizon OC", + "Horizon OC\nOutdated sysmodule detected!\nPlease update Horizon OC": "Horizon OC\nOutdated sysmodule detected!\nPlease update Horizon OC", + "Horizon OC\nKip write failed": "Horizon OC\nKip write failed", + "Horizon OC\nKip config set failed": "Horizon OC\nKip config set failed", + "Kip is not loaded!": "Kip is not loaded!", + "Horizon OC\nKIP has been updated\nPlease reboot your console": "Horizon OC\nKIP has been updated\nPlease reboot your console", + "Horizon OC has been installed": "Horizon OC has been installed", + "Horizon OC\nConfig Buffer Mismatch": "Horizon OC\nConfig Buffer Mismatch", + "Horizon OC\nDeactivated frequency.\nReboot to apply.": "Horizon OC\nDeactivated frequency.\nReboot to apply.", + "Horizon OC\nSecmon read failed!\n This may be a hardware issue!": "Horizon OC\nSecmon read failed!\n This may be a hardware issue!", + "Horizon OC\nFailed to write I2C\nwhile setting vddq": "Horizon OC\nFailed to write I2C\nwhile setting vddq", + "Horizon OC\nKip version mismatch\nPlease reinstall Horizon OC": "Horizon OC\nKip version mismatch\nPlease reinstall Horizon OC" } diff --git a/Source/hoc-clk/overlay/lang/es.json b/Source/hoc-clk/overlay/lang/es.json index 7743bef3..ff8e8aed 100644 --- a/Source/hoc-clk/overlay/lang/es.json +++ b/Source/hoc-clk/overlay/lang/es.json @@ -211,5 +211,19 @@ "X: %u Y: %u": "X: %u Y: %u", "%u.%u%u mV": "%u.%u%u mV", "Compiling with minimal features": "Compilado con funciones mínimas", - "THE BEER-WARE LICENSE": "LICENCIA BEER-WARE" + "THE BEER-WARE LICENSE": "LICENCIA BEER-WARE", + "Horizon OC\nKip opening failed": "Horizon OC\nError al abrir el KIP", + "Horizon OC\nKip read failed": "Horizon OC\nError al leer el KIP", + "Horizon OC\nOutdated kip detected!\nPlease update Horizon OC": "Horizon OC\n¡KIP desactualizado detectado!\nActualiza Horizon OC", + "Horizon OC\nOutdated sysmodule detected!\nPlease update Horizon OC": "Horizon OC\n¡Sysmodule desactualizado detectado!\nActualiza Horizon OC", + "Horizon OC\nKip write failed": "Horizon OC\nError al escribir el KIP", + "Horizon OC\nKip config set failed": "Horizon OC\nError al configurar el KIP", + "Kip is not loaded!": "¡El KIP no está cargado!", + "Horizon OC\nKIP has been updated\nPlease reboot your console": "Horizon OC\nEl KIP se ha actualizado\nReinicia la consola", + "Horizon OC has been installed": "Horizon OC se ha instalado", + "Horizon OC\nConfig Buffer Mismatch": "Horizon OC\nDesajuste del búfer de configuración", + "Horizon OC\nDeactivated frequency.\nReboot to apply.": "Horizon OC\nFrecuencia desactivada.\nReinicia para aplicar.", + "Horizon OC\nSecmon read failed!\n This may be a hardware issue!": "Horizon OC\n¡Error al leer Secmon!\n ¡Puede ser un problema de hardware!", + "Horizon OC\nFailed to write I2C\nwhile setting vddq": "Horizon OC\nError al escribir I2C\nal configurar VDDQ", + "Horizon OC\nKip version mismatch\nPlease reinstall Horizon OC": "Horizon OC\nVersión de KIP no coincide\nReinstala Horizon OC" } diff --git a/Source/hoc-clk/overlay/lang/fr.json b/Source/hoc-clk/overlay/lang/fr.json index c8f94ed2..7e193c0f 100644 --- a/Source/hoc-clk/overlay/lang/fr.json +++ b/Source/hoc-clk/overlay/lang/fr.json @@ -211,5 +211,19 @@ "X: %u Y: %u": "X : %u Y : %u", "%u.%u%u mV": "%u.%u%u mV", "Compiling with minimal features": "Compilation avec fonctionnalités minimales", - "THE BEER-WARE LICENSE": "LA LICENCE BEER-WARE" + "THE BEER-WARE LICENSE": "LA LICENCE BEER-WARE", + "Horizon OC\nKip opening failed": "Horizon OC\nÉchec d'ouverture du KIP", + "Horizon OC\nKip read failed": "Horizon OC\nÉchec de lecture du KIP", + "Horizon OC\nOutdated kip detected!\nPlease update Horizon OC": "Horizon OC\nKIP obsolète détecté !\nVeuillez mettre à jour Horizon OC", + "Horizon OC\nOutdated sysmodule detected!\nPlease update Horizon OC": "Horizon OC\nSysmodule obsolète détecté !\nVeuillez mettre à jour Horizon OC", + "Horizon OC\nKip write failed": "Horizon OC\nÉchec d'écriture du KIP", + "Horizon OC\nKip config set failed": "Horizon OC\nÉchec de configuration du KIP", + "Kip is not loaded!": "Le KIP n'est pas chargé !", + "Horizon OC\nKIP has been updated\nPlease reboot your console": "Horizon OC\nLe KIP a été mis à jour\nVeuillez redémarrer la console", + "Horizon OC has been installed": "Horizon OC a été installé", + "Horizon OC\nConfig Buffer Mismatch": "Horizon OC\nIncohérence du tampon de configuration", + "Horizon OC\nDeactivated frequency.\nReboot to apply.": "Horizon OC\nFréquence désactivée.\nRedémarrez pour appliquer.", + "Horizon OC\nSecmon read failed!\n This may be a hardware issue!": "Horizon OC\nÉchec de lecture Secmon !\n Cela peut être un problème matériel !", + "Horizon OC\nFailed to write I2C\nwhile setting vddq": "Horizon OC\nÉchec d'écriture I2C\nlors du réglage de VDDQ", + "Horizon OC\nKip version mismatch\nPlease reinstall Horizon OC": "Horizon OC\nVersion du KIP incompatible\nVeuillez réinstaller Horizon OC" } diff --git a/Source/hoc-clk/overlay/lang/it.json b/Source/hoc-clk/overlay/lang/it.json index 9706a9b2..2ab2629e 100644 --- a/Source/hoc-clk/overlay/lang/it.json +++ b/Source/hoc-clk/overlay/lang/it.json @@ -211,5 +211,19 @@ "X: %u Y: %u": "X: %u Y: %u", "%u.%u%u mV": "%u.%u%u mV", "Compiling with minimal features": "Compilazione con funzionalità minime", - "THE BEER-WARE LICENSE": "THE BEER-WARE LICENSE" + "THE BEER-WARE LICENSE": "THE BEER-WARE LICENSE", + "Horizon OC\nKip opening failed": "Horizon OC\nApertura del KIP non riuscita", + "Horizon OC\nKip read failed": "Horizon OC\nLettura del KIP non riuscita", + "Horizon OC\nOutdated kip detected!\nPlease update Horizon OC": "Horizon OC\nKIP obsoleto rilevato!\nAggiorna Horizon OC", + "Horizon OC\nOutdated sysmodule detected!\nPlease update Horizon OC": "Horizon OC\nSysmodule obsoleto rilevato!\nAggiorna Horizon OC", + "Horizon OC\nKip write failed": "Horizon OC\nScrittura del KIP non riuscita", + "Horizon OC\nKip config set failed": "Horizon OC\nConfigurazione del KIP non riuscita", + "Kip is not loaded!": "Il KIP non è caricato!", + "Horizon OC\nKIP has been updated\nPlease reboot your console": "Horizon OC\nIl KIP è stato aggiornato\nRiavvia la console", + "Horizon OC has been installed": "Horizon OC è stato installato", + "Horizon OC\nConfig Buffer Mismatch": "Horizon OC\nBuffer di configurazione non corrispondente", + "Horizon OC\nDeactivated frequency.\nReboot to apply.": "Horizon OC\nFrequenza disattivata.\nRiavvia per applicare.", + "Horizon OC\nSecmon read failed!\n This may be a hardware issue!": "Horizon OC\nLettura Secmon non riuscita!\n Potrebbe essere un problema hardware!", + "Horizon OC\nFailed to write I2C\nwhile setting vddq": "Horizon OC\nScrittura I2C non riuscita\ndurante l'impostazione di VDDQ", + "Horizon OC\nKip version mismatch\nPlease reinstall Horizon OC": "Horizon OC\nVersione KIP non corrispondente\nReinstalla Horizon OC" } diff --git a/Source/hoc-clk/overlay/lang/ja.json b/Source/hoc-clk/overlay/lang/ja.json index 8dd8a981..f2c9ce30 100644 --- a/Source/hoc-clk/overlay/lang/ja.json +++ b/Source/hoc-clk/overlay/lang/ja.json @@ -211,5 +211,19 @@ "X: %u Y: %u": "X: %u Y: %u", "%u.%u%u mV": "%u.%u%u mV", "Compiling with minimal features": "最小限の機能でコンパイルする", - "THE BEER-WARE LICENSE": "ビール製品ライセンス" + "THE BEER-WARE LICENSE": "ビール製品ライセンス", + "Horizon OC\nKip opening failed": "Horizon OC\nKIPを開けませんでした", + "Horizon OC\nKip read failed": "Horizon OC\nKIPの読み取りに失敗しました", + "Horizon OC\nOutdated kip detected!\nPlease update Horizon OC": "Horizon OC\n古いKIPを検出しました!\nHorizon OCを更新してください", + "Horizon OC\nOutdated sysmodule detected!\nPlease update Horizon OC": "Horizon OC\n古いsysmoduleを検出しました!\nHorizon OCを更新してください", + "Horizon OC\nKip write failed": "Horizon OC\nKIPの書き込みに失敗しました", + "Horizon OC\nKip config set failed": "Horizon OC\nKIP設定に失敗しました", + "Kip is not loaded!": "KIPが読み込まれていません!", + "Horizon OC\nKIP has been updated\nPlease reboot your console": "Horizon OC\nKIPが更新されました\n本体を再起動してください", + "Horizon OC has been installed": "Horizon OCがインストールされました", + "Horizon OC\nConfig Buffer Mismatch": "Horizon OC\n設定バッファが一致しません", + "Horizon OC\nDeactivated frequency.\nReboot to apply.": "Horizon OC\n周波数を無効化しました。\n再起動して適用してください。", + "Horizon OC\nSecmon read failed!\n This may be a hardware issue!": "Horizon OC\nSecmonの読み取りに失敗しました!\n ハードウェアの問題の可能性があります!", + "Horizon OC\nFailed to write I2C\nwhile setting vddq": "Horizon OC\nVDDQ設定中に\nI2C書き込みに失敗しました", + "Horizon OC\nKip version mismatch\nPlease reinstall Horizon OC": "Horizon OC\nKIPバージョンが一致しません\nHorizon OCを再インストールしてください" } diff --git a/Source/hoc-clk/overlay/lang/jp.json b/Source/hoc-clk/overlay/lang/jp.json index af92cbf7..ee430cb9 100644 --- a/Source/hoc-clk/overlay/lang/jp.json +++ b/Source/hoc-clk/overlay/lang/jp.json @@ -142,5 +142,19 @@ "or 1228MHz on HiOPT can cause ": "or 1228MHz on HiOPT can cause", "permanent damage to your Switch!": "permanent damage to your Switch!", "921MHz without UV and 960MHz on": "921MHz without UV and 960MHz on", - "SLT or HiOPT can cause ": "SLT or HiOPT can cause" + "SLT or HiOPT can cause ": "SLT or HiOPT can cause", + "Horizon OC\nKip opening failed": "Horizon OC\nKip opening failed", + "Horizon OC\nKip read failed": "Horizon OC\nKip read failed", + "Horizon OC\nOutdated kip detected!\nPlease update Horizon OC": "Horizon OC\nOutdated kip detected!\nPlease update Horizon OC", + "Horizon OC\nOutdated sysmodule detected!\nPlease update Horizon OC": "Horizon OC\nOutdated sysmodule detected!\nPlease update Horizon OC", + "Horizon OC\nKip write failed": "Horizon OC\nKip write failed", + "Horizon OC\nKip config set failed": "Horizon OC\nKip config set failed", + "Kip is not loaded!": "Kip is not loaded!", + "Horizon OC\nKIP has been updated\nPlease reboot your console": "Horizon OC\nKIP has been updated\nPlease reboot your console", + "Horizon OC has been installed": "Horizon OC has been installed", + "Horizon OC\nConfig Buffer Mismatch": "Horizon OC\nConfig Buffer Mismatch", + "Horizon OC\nDeactivated frequency.\nReboot to apply.": "Horizon OC\nDeactivated frequency.\nReboot to apply.", + "Horizon OC\nSecmon read failed!\n This may be a hardware issue!": "Horizon OC\nSecmon read failed!\n This may be a hardware issue!", + "Horizon OC\nFailed to write I2C\nwhile setting vddq": "Horizon OC\nFailed to write I2C\nwhile setting vddq", + "Horizon OC\nKip version mismatch\nPlease reinstall Horizon OC": "Horizon OC\nKip version mismatch\nPlease reinstall Horizon OC" } diff --git a/Source/hoc-clk/overlay/lang/ko.json b/Source/hoc-clk/overlay/lang/ko.json index 8865d37f..47e3a220 100644 --- a/Source/hoc-clk/overlay/lang/ko.json +++ b/Source/hoc-clk/overlay/lang/ko.json @@ -211,5 +211,19 @@ "X: %u Y: %u": "X: %u Y: %u", "%u.%u%u mV": "%u.%u%umV", "Compiling with minimal features": "최소한의 기능으로 컴파일하기", - "THE BEER-WARE LICENSE": "맥주 제품 라이센스" + "THE BEER-WARE LICENSE": "맥주 제품 라이센스", + "Horizon OC\nKip opening failed": "Horizon OC\nKIP을 열지 못했습니다", + "Horizon OC\nKip read failed": "Horizon OC\nKIP 읽기에 실패했습니다", + "Horizon OC\nOutdated kip detected!\nPlease update Horizon OC": "Horizon OC\n오래된 KIP이 감지되었습니다!\nHorizon OC를 업데이트하세요", + "Horizon OC\nOutdated sysmodule detected!\nPlease update Horizon OC": "Horizon OC\n오래된 sysmodule이 감지되었습니다!\nHorizon OC를 업데이트하세요", + "Horizon OC\nKip write failed": "Horizon OC\nKIP 쓰기에 실패했습니다", + "Horizon OC\nKip config set failed": "Horizon OC\nKIP 설정에 실패했습니다", + "Kip is not loaded!": "KIP이 로드되지 않았습니다!", + "Horizon OC\nKIP has been updated\nPlease reboot your console": "Horizon OC\nKIP이 업데이트되었습니다\n본체를 재부팅하세요", + "Horizon OC has been installed": "Horizon OC가 설치되었습니다", + "Horizon OC\nConfig Buffer Mismatch": "Horizon OC\n설정 버퍼가 일치하지 않습니다", + "Horizon OC\nDeactivated frequency.\nReboot to apply.": "Horizon OC\n주파수가 비활성화되었습니다.\n적용하려면 재부팅하세요.", + "Horizon OC\nSecmon read failed!\n This may be a hardware issue!": "Horizon OC\nSecmon 읽기에 실패했습니다!\n 하드웨어 문제일 수 있습니다!", + "Horizon OC\nFailed to write I2C\nwhile setting vddq": "Horizon OC\nVDDQ 설정 중\nI2C 쓰기에 실패했습니다", + "Horizon OC\nKip version mismatch\nPlease reinstall Horizon OC": "Horizon OC\nKIP 버전이 일치하지 않습니다\nHorizon OC를 다시 설치하세요" } diff --git a/Source/hoc-clk/overlay/lang/nl.json b/Source/hoc-clk/overlay/lang/nl.json index 5095d2be..7d447716 100644 --- a/Source/hoc-clk/overlay/lang/nl.json +++ b/Source/hoc-clk/overlay/lang/nl.json @@ -211,5 +211,19 @@ "X: %u Y: %u": "X: %u Y: %u", "%u.%u%u mV": "%u.%u%u mV", "Compiling with minimal features": "Compileren met minimale functies", - "THE BEER-WARE LICENSE": "DE LICENTIE VOOR BIERWAREN" + "THE BEER-WARE LICENSE": "DE LICENTIE VOOR BIERWAREN", + "Horizon OC\nKip opening failed": "Horizon OC\nKIP openen mislukt", + "Horizon OC\nKip read failed": "Horizon OC\nKIP lezen mislukt", + "Horizon OC\nOutdated kip detected!\nPlease update Horizon OC": "Horizon OC\nVerouderde KIP gedetecteerd!\nWerk Horizon OC bij", + "Horizon OC\nOutdated sysmodule detected!\nPlease update Horizon OC": "Horizon OC\nVerouderde sysmodule gedetecteerd!\nWerk Horizon OC bij", + "Horizon OC\nKip write failed": "Horizon OC\nKIP schrijven mislukt", + "Horizon OC\nKip config set failed": "Horizon OC\nKIP-configuratie mislukt", + "Kip is not loaded!": "KIP is niet geladen!", + "Horizon OC\nKIP has been updated\nPlease reboot your console": "Horizon OC\nKIP is bijgewerkt\nHerstart je console", + "Horizon OC has been installed": "Horizon OC is geïnstalleerd", + "Horizon OC\nConfig Buffer Mismatch": "Horizon OC\nConfiguratiebuffer komt niet overeen", + "Horizon OC\nDeactivated frequency.\nReboot to apply.": "Horizon OC\nFrequentie gedeactiveerd.\nHerstart om toe te passen.", + "Horizon OC\nSecmon read failed!\n This may be a hardware issue!": "Horizon OC\nSecmon lezen mislukt!\n Dit kan een hardwareprobleem zijn!", + "Horizon OC\nFailed to write I2C\nwhile setting vddq": "Horizon OC\nI2C schrijven mislukt\nbij het instellen van VDDQ", + "Horizon OC\nKip version mismatch\nPlease reinstall Horizon OC": "Horizon OC\nKIP-versie komt niet overeen\nInstalleer Horizon OC opnieuw" } diff --git a/Source/hoc-clk/overlay/lang/pl.json b/Source/hoc-clk/overlay/lang/pl.json index eecc5071..a320fe9b 100644 --- a/Source/hoc-clk/overlay/lang/pl.json +++ b/Source/hoc-clk/overlay/lang/pl.json @@ -211,5 +211,19 @@ "X: %u Y: %u": "X: %u Y: %u", "%u.%u%u mV": "%u.%u%u mV", "Compiling with minimal features": "Kompilacja z minimalnymi funkcjami", - "THE BEER-WARE LICENSE": "LICENCJA NA WYROBY PIWNE" + "THE BEER-WARE LICENSE": "LICENCJA NA WYROBY PIWNE", + "Horizon OC\nKip opening failed": "Horizon OC\nNie udało się otworzyć KIP", + "Horizon OC\nKip read failed": "Horizon OC\nNie udało się odczytać KIP", + "Horizon OC\nOutdated kip detected!\nPlease update Horizon OC": "Horizon OC\nWykryto przestarzały KIP!\nZaktualizuj Horizon OC", + "Horizon OC\nOutdated sysmodule detected!\nPlease update Horizon OC": "Horizon OC\nWykryto przestarzały sysmodule!\nZaktualizuj Horizon OC", + "Horizon OC\nKip write failed": "Horizon OC\nZapis KIP nie powiódł się", + "Horizon OC\nKip config set failed": "Horizon OC\nKonfiguracja KIP nie powiodła się", + "Kip is not loaded!": "KIP nie jest załadowany!", + "Horizon OC\nKIP has been updated\nPlease reboot your console": "Horizon OC\nKIP został zaktualizowany\nUruchom ponownie konsolę", + "Horizon OC has been installed": "Horizon OC został zainstalowany", + "Horizon OC\nConfig Buffer Mismatch": "Horizon OC\nNiezgodność bufora konfiguracji", + "Horizon OC\nDeactivated frequency.\nReboot to apply.": "Horizon OC\nCzęstotliwość wyłączona.\nZrestartuj, aby zastosować.", + "Horizon OC\nSecmon read failed!\n This may be a hardware issue!": "Horizon OC\nOdczyt Secmon nie powiódł się!\n To może być problem sprzętowy!", + "Horizon OC\nFailed to write I2C\nwhile setting vddq": "Horizon OC\nZapis I2C nie powiódł się\npodczas ustawiania VDDQ", + "Horizon OC\nKip version mismatch\nPlease reinstall Horizon OC": "Horizon OC\nNiezgodność wersji KIP\nZainstaluj ponownie Horizon OC" } diff --git a/Source/hoc-clk/overlay/lang/pt.json b/Source/hoc-clk/overlay/lang/pt.json index 906bab87..86b7dea1 100644 --- a/Source/hoc-clk/overlay/lang/pt.json +++ b/Source/hoc-clk/overlay/lang/pt.json @@ -211,5 +211,19 @@ "X: %u Y: %u": "X: %u Y: %u", "%u.%u%u mV": "%u.%u%u mV", "Compiling with minimal features": "Compilando com recursos mínimos", - "THE BEER-WARE LICENSE": "A LICENÇA DE CERVEJA" + "THE BEER-WARE LICENSE": "A LICENÇA DE CERVEJA", + "Horizon OC\nKip opening failed": "Horizon OC\nFalha ao abrir o KIP", + "Horizon OC\nKip read failed": "Horizon OC\nFalha ao ler o KIP", + "Horizon OC\nOutdated kip detected!\nPlease update Horizon OC": "Horizon OC\nKIP desatualizado detectado!\nAtualize o Horizon OC", + "Horizon OC\nOutdated sysmodule detected!\nPlease update Horizon OC": "Horizon OC\nSysmodule desatualizado detectado!\nAtualize o Horizon OC", + "Horizon OC\nKip write failed": "Horizon OC\nFalha ao gravar o KIP", + "Horizon OC\nKip config set failed": "Horizon OC\nFalha ao configurar o KIP", + "Kip is not loaded!": "O KIP não está carregado!", + "Horizon OC\nKIP has been updated\nPlease reboot your console": "Horizon OC\nO KIP foi atualizado\nReinicie o console", + "Horizon OC has been installed": "Horizon OC foi instalado", + "Horizon OC\nConfig Buffer Mismatch": "Horizon OC\nIncompatibilidade do buffer de configuração", + "Horizon OC\nDeactivated frequency.\nReboot to apply.": "Horizon OC\nFrequência desativada.\nReinicie para aplicar.", + "Horizon OC\nSecmon read failed!\n This may be a hardware issue!": "Horizon OC\nFalha na leitura do Secmon!\n Isso pode ser um problema de hardware!", + "Horizon OC\nFailed to write I2C\nwhile setting vddq": "Horizon OC\nFalha ao gravar I2C\nao definir VDDQ", + "Horizon OC\nKip version mismatch\nPlease reinstall Horizon OC": "Horizon OC\nVersão do KIP incompatível\nReinstale o Horizon OC" } diff --git a/Source/hoc-clk/overlay/lang/ru.json b/Source/hoc-clk/overlay/lang/ru.json index 5d9f5831..d3b36cb2 100644 --- a/Source/hoc-clk/overlay/lang/ru.json +++ b/Source/hoc-clk/overlay/lang/ru.json @@ -232,5 +232,19 @@ "%u.%u%u mV": "%u.%u%u мВ", "Compiling with minimal features": "Собрано с урезанием функций", "THE BEER-WARE LICENSE": "BEER-WARE LICENSE", - "Auto": "Авто" + "Auto": "Авто", + "Horizon OC\nKip opening failed": "Horizon OC\nНе удалось открыть KIP", + "Horizon OC\nKip read failed": "Horizon OC\nНе удалось прочитать KIP", + "Horizon OC\nOutdated kip detected!\nPlease update Horizon OC": "Horizon OC\nОбнаружен устаревший KIP!\nОбновите Horizon OC", + "Horizon OC\nOutdated sysmodule detected!\nPlease update Horizon OC": "Horizon OC\nОбнаружен устаревший sysmodule!\nОбновите Horizon OC", + "Horizon OC\nKip write failed": "Horizon OC\nОшибка записи KIP", + "Horizon OC\nKip config set failed": "Horizon OC\nОшибка настройки KIP", + "Kip is not loaded!": "KIP не загружен!", + "Horizon OC\nKIP has been updated\nPlease reboot your console": "Horizon OC\nKIP обновлён\nПерезагрузите консоль", + "Horizon OC has been installed": "Horizon OC установлен", + "Horizon OC\nConfig Buffer Mismatch": "Horizon OC\nНесоответствие буфера конфигурации", + "Horizon OC\nDeactivated frequency.\nReboot to apply.": "Horizon OC\nЧастота отключена.\nПерезагрузите для применения.", + "Horizon OC\nSecmon read failed!\n This may be a hardware issue!": "Horizon OC\nОшибка чтения Secmon!\n Возможно, проблема с оборудованием!", + "Horizon OC\nFailed to write I2C\nwhile setting vddq": "Horizon OC\nОшибка записи I2C\nпри установке VDDQ", + "Horizon OC\nKip version mismatch\nPlease reinstall Horizon OC": "Horizon OC\nНесовпадение версии KIP\nПереустановите Horizon OC" } diff --git a/Source/hoc-clk/overlay/lang/template.json b/Source/hoc-clk/overlay/lang/template.json index 51c51c1a..3d4e5610 100644 --- a/Source/hoc-clk/overlay/lang/template.json +++ b/Source/hoc-clk/overlay/lang/template.json @@ -211,4 +211,18 @@ "X: %u Y: %u": "", "%u.%u%u mV": "", "Compiling with minimal features": "", + "Horizon OC\nKip opening failed": "", + "Horizon OC\nKip read failed": "", + "Horizon OC\nOutdated kip detected!\nPlease update Horizon OC": "", + "Horizon OC\nOutdated sysmodule detected!\nPlease update Horizon OC": "", + "Horizon OC\nKip write failed": "", + "Horizon OC\nKip config set failed": "", + "Kip is not loaded!": "", + "Horizon OC\nKIP has been updated\nPlease reboot your console": "", + "Horizon OC has been installed": "", + "Horizon OC\nConfig Buffer Mismatch": "", + "Horizon OC\nDeactivated frequency.\nReboot to apply.": "", + "Horizon OC\nSecmon read failed!\n This may be a hardware issue!": "", + "Horizon OC\nFailed to write I2C\nwhile setting vddq": "", + "Horizon OC\nKip version mismatch\nPlease reinstall Horizon OC": "" } diff --git a/Source/hoc-clk/overlay/lang/uk.json b/Source/hoc-clk/overlay/lang/uk.json index 7af7040a..ffd3b5ac 100644 --- a/Source/hoc-clk/overlay/lang/uk.json +++ b/Source/hoc-clk/overlay/lang/uk.json @@ -211,5 +211,19 @@ "X: %u Y: %u": "X: %u Y: %u", "%u.%u%u mV": "%u.%u%u мВ", "Compiling with minimal features": "Компіляція з мінімальними можливостями", - "THE BEER-WARE LICENSE": "ЛІЦЕНЗІЯ НА ПИВНИЙ ПОСУД" + "THE BEER-WARE LICENSE": "ЛІЦЕНЗІЯ НА ПИВНИЙ ПОСУД", + "Horizon OC\nKip opening failed": "Horizon OC\nНе вдалося відкрити KIP", + "Horizon OC\nKip read failed": "Horizon OC\nНе вдалося прочитати KIP", + "Horizon OC\nOutdated kip detected!\nPlease update Horizon OC": "Horizon OC\nВиявлено застарілий KIP!\nОновіть Horizon OC", + "Horizon OC\nOutdated sysmodule detected!\nPlease update Horizon OC": "Horizon OC\nВиявлено застарілий sysmodule!\nОновіть Horizon OC", + "Horizon OC\nKip write failed": "Horizon OC\nПомилка запису KIP", + "Horizon OC\nKip config set failed": "Horizon OC\nПомилка налаштування KIP", + "Kip is not loaded!": "KIP не завантажено!", + "Horizon OC\nKIP has been updated\nPlease reboot your console": "Horizon OC\nKIP оновлено\nПерезавантажте консоль", + "Horizon OC has been installed": "Horizon OC встановлено", + "Horizon OC\nConfig Buffer Mismatch": "Horizon OC\nНевідповідність буфера конфігурації", + "Horizon OC\nDeactivated frequency.\nReboot to apply.": "Horizon OC\nЧастоту вимкнено.\nПерезавантажте для застосування.", + "Horizon OC\nSecmon read failed!\n This may be a hardware issue!": "Horizon OC\nПомилка читання Secmon!\n Це може бути апаратна проблема!", + "Horizon OC\nFailed to write I2C\nwhile setting vddq": "Horizon OC\nПомилка запису I2C\nпід час встановлення VDDQ", + "Horizon OC\nKip version mismatch\nPlease reinstall Horizon OC": "Horizon OC\nНевідповідність версії KIP\nПеревстановіть Horizon OC" } diff --git a/Source/hoc-clk/overlay/lang/zh-cn.json b/Source/hoc-clk/overlay/lang/zh-cn.json index fbe19238..27eedbe5 100644 --- a/Source/hoc-clk/overlay/lang/zh-cn.json +++ b/Source/hoc-clk/overlay/lang/zh-cn.json @@ -269,5 +269,19 @@ "X: %u Y: %u": "X: %u Y: %u", "%u.%u%u mV": "%u.%u%u mV", "Compiling with minimal features": "以最小功能编译", - "THE BEER-WARE LICENSE": "啤酒软件许可协议" + "THE BEER-WARE LICENSE": "啤酒软件许可协议", + "Horizon OC\nKip opening failed": "Horizon OC\n无法打开 KIP", + "Horizon OC\nKip read failed": "Horizon OC\n读取 KIP 失败", + "Horizon OC\nOutdated kip detected!\nPlease update Horizon OC": "Horizon OC\n检测到过时的 KIP!\n请更新 Horizon OC", + "Horizon OC\nOutdated sysmodule detected!\nPlease update Horizon OC": "Horizon OC\n检测到过时的系统模块!\n请更新 Horizon OC", + "Horizon OC\nKip write failed": "Horizon OC\n写入 KIP 失败", + "Horizon OC\nKip config set failed": "Horizon OC\n设置 KIP 配置失败", + "Kip is not loaded!": "KIP 未加载!", + "Horizon OC\nKIP has been updated\nPlease reboot your console": "Horizon OC\nKIP 已更新\n请重启主机", + "Horizon OC has been installed": "Horizon OC 已安装", + "Horizon OC\nConfig Buffer Mismatch": "Horizon OC\n配置缓冲区不匹配", + "Horizon OC\nDeactivated frequency.\nReboot to apply.": "Horizon OC\n已停用频率。\n重启以应用。", + "Horizon OC\nSecmon read failed!\n This may be a hardware issue!": "Horizon OC\n读取 Secmon 失败!\n 这可能是硬件问题!", + "Horizon OC\nFailed to write I2C\nwhile setting vddq": "Horizon OC\n设置 VDDQ 时\nI2C 写入失败", + "Horizon OC\nKip version mismatch\nPlease reinstall Horizon OC": "Horizon OC\nKIP 版本不匹配\n请重新安装 Horizon OC" } diff --git a/Source/hoc-clk/overlay/lang/zh-tw.json b/Source/hoc-clk/overlay/lang/zh-tw.json index 75765af9..96242b2a 100644 --- a/Source/hoc-clk/overlay/lang/zh-tw.json +++ b/Source/hoc-clk/overlay/lang/zh-tw.json @@ -211,5 +211,19 @@ "X: %u Y: %u": "X: %u Y: %u", "%u.%u%u mV": "%u.%u%u mV", "Compiling with minimal features": "使用最少的功能進行編譯", - "THE BEER-WARE LICENSE": "啤酒製品許可證" + "THE BEER-WARE LICENSE": "啤酒製品許可證", + "Horizon OC\nKip opening failed": "Horizon OC\n無法開啟 KIP", + "Horizon OC\nKip read failed": "Horizon OC\n讀取 KIP 失敗", + "Horizon OC\nOutdated kip detected!\nPlease update Horizon OC": "Horizon OC\n偵測到過時的 KIP!\n請更新 Horizon OC", + "Horizon OC\nOutdated sysmodule detected!\nPlease update Horizon OC": "Horizon OC\n偵測到過時的系統模組!\n請更新 Horizon OC", + "Horizon OC\nKip write failed": "Horizon OC\n寫入 KIP 失敗", + "Horizon OC\nKip config set failed": "Horizon OC\n設定 KIP 組態失敗", + "Kip is not loaded!": "KIP 尚未載入!", + "Horizon OC\nKIP has been updated\nPlease reboot your console": "Horizon OC\nKIP 已更新\n請重新啟動主機", + "Horizon OC has been installed": "Horizon OC 已安裝", + "Horizon OC\nConfig Buffer Mismatch": "Horizon OC\n組態緩衝區不符", + "Horizon OC\nDeactivated frequency.\nReboot to apply.": "Horizon OC\n已停用頻率。\n重新啟動以套用。", + "Horizon OC\nSecmon read failed!\n This may be a hardware issue!": "Horizon OC\n讀取 Secmon 失敗!\n 這可能是硬體問題!", + "Horizon OC\nFailed to write I2C\nwhile setting vddq": "Horizon OC\n設定 VDDQ 時\nI2C 寫入失敗", + "Horizon OC\nKip version mismatch\nPlease reinstall Horizon OC": "Horizon OC\nKIP 版本不符\n請重新安裝 Horizon OC" } diff --git a/Source/hoc-clk/sysmodule/src/hos/lang.cpp b/Source/hoc-clk/sysmodule/src/hos/lang.cpp new file mode 100644 index 00000000..180a4d24 --- /dev/null +++ b/Source/hoc-clk/sysmodule/src/hos/lang.cpp @@ -0,0 +1,141 @@ +/* + * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#include "lang.hpp" + +#include +#include +#include +#include + +#include "../file/file_utils.hpp" + +namespace lang { + namespace { + + constexpr const char *kUltrahandConfigPath = "sdmc:/config/ultrahand/config.ini"; + constexpr const char *kLangDir = "sdmc:" FILE_CONFIG_DIR "/lang/"; + + std::string gLoadedLang; + std::unordered_map gCache; + + void NormalizeNewlines(std::string &s) { + size_t n = 0; + while ((n = s.find("\\n", n)) != std::string::npos) { + s.replace(n, 2, "\n"); + n += 1; + } + } + + // Lightweight Ultrahand-compatible flat JSON string map parser. + void ParseJsonContent(const std::string &content, std::unordered_map &result) { + size_t pos = 0; + + while ((pos = content.find('"', pos)) != std::string::npos) { + const size_t keyStart = pos + 1; + const size_t keyEnd = content.find('"', keyStart); + if (keyEnd == std::string::npos) { + break; + } + + const size_t colonPos = content.find(':', keyEnd); + if (colonPos == std::string::npos) { + break; + } + + const size_t valueStart = content.find('"', colonPos); + const size_t valueEnd = content.find('"', valueStart + 1); + if (valueStart == std::string::npos || valueEnd == std::string::npos) { + break; + } + + std::string key = content.substr(keyStart, keyEnd - keyStart); + std::string value = content.substr(valueStart + 1, valueEnd - valueStart - 1); + + NormalizeNewlines(key); + NormalizeNewlines(value); + + result[std::move(key)] = std::move(value); + pos = valueEnd + 1; + } + } + + bool ReadFileContent(const std::string &filePath, std::string &content) { + FILE *file = fopen(filePath.c_str(), "r"); + if (!file) { + return false; + } + + char buffer[256]; + while (fgets(buffer, sizeof(buffer), file) != nullptr) { + content += buffer; + } + fclose(file); + return true; + } + + bool LoadLangFile(const std::string &langCode) { + const std::string path = std::string(kLangDir) + langCode + ".json"; + std::string content; + if (!ReadFileContent(path, content)) { + return false; + } + + gCache.clear(); + ParseJsonContent(content, gCache); + gLoadedLang = langCode; + return true; + } + + std::string GetDefaultLang() { + char buf[32] = {}; + ini_gets("ultrahand", "default_lang", "en", buf, sizeof(buf), kUltrahandConfigPath); + if (buf[0] == '\0') { + return "en"; + } + return buf; + } + + void EnsureLoaded() { + const std::string langCode = GetDefaultLang(); + if (langCode == gLoadedLang && !gCache.empty()) { + return; + } + + if (!LoadLangFile(langCode) && langCode != "en") { + LoadLangFile("en"); + } + } + + } // namespace + + std::string translate(const std::string &text) { + if (text.empty()) { + return text; + } + + EnsureLoaded(); + + const auto it = gCache.find(text); + if (it != gCache.end() && !it->second.empty()) { + return it->second; + } + + return text; + } + +} // namespace lang diff --git a/Source/hoc-clk/sysmodule/src/hos/lang.hpp b/Source/hoc-clk/sysmodule/src/hos/lang.hpp new file mode 100644 index 00000000..81aff87c --- /dev/null +++ b/Source/hoc-clk/sysmodule/src/hos/lang.hpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#pragma once + +#include + +namespace lang { + + // Translates text using Ultrahand's language setting and + // /config/horizon-oc/lang/.json (same format as the overlay). + // Returns the original text when no translation is available. + std::string translate(const std::string &text); + +} // namespace lang diff --git a/Source/hoc-clk/sysmodule/src/hos/notification.cpp b/Source/hoc-clk/sysmodule/src/hos/notification.cpp index c5a4f5f0..70d9e343 100644 --- a/Source/hoc-clk/sysmodule/src/hos/notification.cpp +++ b/Source/hoc-clk/sysmodule/src/hos/notification.cpp @@ -15,6 +15,7 @@ * */ +#include "lang.hpp" #include "notification.h" namespace notification { @@ -27,13 +28,15 @@ namespace notification { } fclose(flagFile); + const std::string translated = lang::translate(message); + std::string filename = "hoc-" + std::to_string(std::time(nullptr)) + ".notify"; std::string fullPath = "sdmc:/config/ultrahand/notifications/" + filename; FILE *file = fopen(fullPath.c_str(), "w"); if (file) { fprintf(file, "{\n"); - fprintf(file, " \"text\": \"%s\",\n", message.c_str()); + fprintf(file, " \"text\": \"%s\",\n", translated.c_str()); fprintf(file, " \"fontSize\": 28\n"); fprintf(file, "}\n"); fclose(file); From 6c4b356b0cc895bcdb3e9ae53f0335add880845a Mon Sep 17 00:00:00 2001 From: Niklas080208 Date: Sat, 18 Jul 2026 18:49:19 +0200 Subject: [PATCH 2/2] Use PascalCase for lang helpers and constexpr names. --- Source/hoc-clk/sysmodule/src/hos/lang.cpp | 10 +++++----- Source/hoc-clk/sysmodule/src/hos/lang.hpp | 2 +- Source/hoc-clk/sysmodule/src/hos/notification.cpp | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Source/hoc-clk/sysmodule/src/hos/lang.cpp b/Source/hoc-clk/sysmodule/src/hos/lang.cpp index 180a4d24..6d959c01 100644 --- a/Source/hoc-clk/sysmodule/src/hos/lang.cpp +++ b/Source/hoc-clk/sysmodule/src/hos/lang.cpp @@ -27,8 +27,8 @@ namespace lang { namespace { - constexpr const char *kUltrahandConfigPath = "sdmc:/config/ultrahand/config.ini"; - constexpr const char *kLangDir = "sdmc:" FILE_CONFIG_DIR "/lang/"; + constexpr const char *UltrahandConfigPath = "sdmc:/config/ultrahand/config.ini"; + constexpr const char *LangDir = "sdmc:" FILE_CONFIG_DIR "/lang/"; std::string gLoadedLang; std::unordered_map gCache; @@ -89,7 +89,7 @@ namespace lang { } bool LoadLangFile(const std::string &langCode) { - const std::string path = std::string(kLangDir) + langCode + ".json"; + const std::string path = std::string(LangDir) + langCode + ".json"; std::string content; if (!ReadFileContent(path, content)) { return false; @@ -103,7 +103,7 @@ namespace lang { std::string GetDefaultLang() { char buf[32] = {}; - ini_gets("ultrahand", "default_lang", "en", buf, sizeof(buf), kUltrahandConfigPath); + ini_gets("ultrahand", "default_lang", "en", buf, sizeof(buf), UltrahandConfigPath); if (buf[0] == '\0') { return "en"; } @@ -123,7 +123,7 @@ namespace lang { } // namespace - std::string translate(const std::string &text) { + std::string Translate(const std::string &text) { if (text.empty()) { return text; } diff --git a/Source/hoc-clk/sysmodule/src/hos/lang.hpp b/Source/hoc-clk/sysmodule/src/hos/lang.hpp index 81aff87c..7b03635b 100644 --- a/Source/hoc-clk/sysmodule/src/hos/lang.hpp +++ b/Source/hoc-clk/sysmodule/src/hos/lang.hpp @@ -24,6 +24,6 @@ namespace lang { // Translates text using Ultrahand's language setting and // /config/horizon-oc/lang/.json (same format as the overlay). // Returns the original text when no translation is available. - std::string translate(const std::string &text); + std::string Translate(const std::string &text); } // namespace lang diff --git a/Source/hoc-clk/sysmodule/src/hos/notification.cpp b/Source/hoc-clk/sysmodule/src/hos/notification.cpp index 70d9e343..333b0604 100644 --- a/Source/hoc-clk/sysmodule/src/hos/notification.cpp +++ b/Source/hoc-clk/sysmodule/src/hos/notification.cpp @@ -28,7 +28,7 @@ namespace notification { } fclose(flagFile); - const std::string translated = lang::translate(message); + const std::string translated = lang::Translate(message); std::string filename = "hoc-" + std::to_string(std::time(nullptr)) + ".notify"; std::string fullPath = "sdmc:/config/ultrahand/notifications/" + filename;