Skip to content

Commit

Permalink
feat: improve version management and i18n
Browse files Browse the repository at this point in the history
- Add version comparison functionality
- Support plugin version rollback
- Complete Bulgarian translation
- Update various i18n strings
  • Loading branch information
honjow committed Dec 26, 2024
1 parent c109f6b commit 0f87f38
Show file tree
Hide file tree
Showing 14 changed files with 510 additions and 309 deletions.
11 changes: 7 additions & 4 deletions src/components/more.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ButtonItem, Field, PanelSection, PanelSectionRow } from "@decky/ui";
import { FC, useEffect, useState } from "react";
import { localizationManager, localizeStrEnum } from "../i18n";
import { Backend, Settings } from "../util";
import { Backend, Settings, compareVersions } from "../util";
import { ActionButtonItem } from ".";

export const MoreComponent: FC = () => {
Expand All @@ -10,8 +10,6 @@ export const MoreComponent: FC = () => {

useEffect(() => {
const getData = async () => {
// const latestVersion = await Backend.getLatestVersion();
// setLatestVersion(latestVersion);
setTimeout(() => {
setLatestVersion(latestVersion);
Backend.getLatestVersion().then((latestVersion) => {
Expand All @@ -25,7 +23,12 @@ export const MoreComponent: FC = () => {
let uptButtonText = localizationManager.getString(localizeStrEnum.REINSTALL_PLUGIN);

if (currentVersion !== latestVersion && Boolean(latestVersion)) {
uptButtonText = `${localizationManager.getString(localizeStrEnum.UPDATE_PLUGIN)} ${latestVersion}`;
const versionCompare = compareVersions(latestVersion, currentVersion);
if (versionCompare > 0) {
uptButtonText = `${localizationManager.getString(localizeStrEnum.UPDATE_PLUGIN)} ${latestVersion}`;
} else if (versionCompare < 0) {
uptButtonText = `${localizationManager.getString(localizeStrEnum.ROLLBACK_PLUGIN)} ${latestVersion}`;
}
}

return (
Expand Down
107 changes: 66 additions & 41 deletions src/i18n/bulgarian.json
Original file line number Diff line number Diff line change
@@ -1,43 +1,68 @@
{
"TITEL_SETTINGS":"",
"ENABLE_SETTINGS":"",
"USE_PERGAME_PROFILE":"",
"USING":"",
"DEFAULT":"",
"PROFILE":"",
"CPU_BOOST":"",
"CPU_BOOST_DESC":"",
"SMT_DESC":"",
"CPU_NUM":"",
"CPU_NUM_DESC":"",
"TDP":"",
"TDP_DESC":"",
"RYZENADJ_NOT_FOUND":"",
"WATTS":"",
"GPU_FREQMODE":"",
"UNLIMITED":"",
"FIXED_FREQ":"",
"RANGE_FREQ":"",
"AUTO_FREQ":"",
"GPU_FIX_FREQ":"",
"GPU_MIN_FREQ":"",
"GPU_MAX_FREQ":"",
"FAN_SPEED":"",
"CREATE_FAN_PROFILE":"",
"GRID_ALIG":"",
"FAN_MODE":"",
"NOT_CONTROLLED":"",
"FIXED":"",
"CURVE":"",
"SNAP_GRIDLINE":"",
"FAN_SPEED_PERCENT":"",
"SENSOR_TEMP":"",
"CREATE_FAN_PROFILE_TIP":"",
"SELECT_FAN_PROFILE_TIP":"",
"FAN_PROFILE_NAME":"",
"USE":"",
"DELETE":"",
"CREATE":"",
"CANCEL":"",
"CURENT_STAT":""
"TITEL_SETTINGS":"Настройки",
"ENABLE_SETTINGS":"Активиране на настройките",
"USE_PERGAME_PROFILE":"Използване на профил за игра",
"USING":"Използва се",
"DEFAULT":"По подразбиране",
"PROFILE":"Профил",
"CPU_BOOST":"CPU Boost",
"CPU_BOOST_DESC":"Увеличаване на максималната честота на CPU",
"SMT_DESC":"Активиране на хипертрединг",
"CPU_NUM":"Брой CPU ядра",
"CPU_NUM_DESC":"Задаване на активните физически ядра",
"CPU_MAX_PERF":"Максимална производителност на CPU",
"TDP":"Лимит на термична мощност (TDP)",
"TDP_DESC":"Ограничаване на мощността на процесора за по-ниска обща консумация",
"RYZENADJ_NOT_FOUND":"RyzenAdj не е намерен",
"WATTS":"Вата",
"GPU_FREQMODE":"Режим на честота на GPU",
"UNLIMITED":"Неограничен",
"FIXED_FREQ":"Фиксиран",
"RANGE_FREQ":"Диапазон",
"AUTO_FREQ":"Автоматичен",
"GPU_FIX_FREQ":"Честота на GPU",
"GPU_MIN_FREQ":"Минимална честота",
"GPU_MAX_FREQ":"Максимална честота",
"FAN_SPEED":"Скорост на вентилатора",
"CREATE_FAN_PROFILE":"Създаване на профил за вентилатора",
"GRID_ALIG":"Подравняване по мрежа",
"FAN_MODE":"Режим на вентилатора",
"NOT_CONTROLLED":"Без контрол",
"FIXED":"Фиксиран",
"CURVE":"Крива",
"SNAP_GRIDLINE":"Прилепване към пресечните точки на мрежата",
"FAN_SPEED_PERCENT":"Скорост на вентилатора (%)",
"SENSOR_TEMP":"Температура на сензора",
"CREATE_FAN_PROFILE_TIP":"Създаване на профил за вентилатора",
"SELECT_FAN_PROFILE_TIP":"Избор на профил за вентилатора",
"FAN_PROFILE_NAME":"Име на профила",
"USE":"Използване",
"DELETE":"Изтриване",
"CREATE":"Създаване",
"CANCEL":"Отказ",
"CURENT_STAT":"Текущо състояние",
"EDIT":"Редактиране",
"SAVE":"Запазване",
"NATIVE_FREQ":"Нативен",
"MORE":"Още",
"REINSTALL_PLUGIN": "Преинсталиране на плъгина",
"UPDATE_PLUGIN": "Обновяване до",
"ROLLBACK_PLUGIN": "Връщане до",
"INSTALLED_VERSION": "Инсталирана версия",
"LATEST_VERSION": "Последна версия",
"GPU_NATIVE_SLIDER": "Нативен GPU плъзгач",
"GPU_NATIVE_SLIDER_DESC": "Активиране на нативния плъзгач за контрол на GPU",
"USE_PERACMODE_PROFILE": "Използване на профил според захранването",
"AC_MODE": "Режим на захранване",
"BAT_MODE": "Режим на батерия",
"CUSTOM_TDP_RANGE": "Персонализиран диапазон на TDP плъзгача",
"RESET_ALL": "Нулиране на всичко",
"NATIVE_FREQ_DESC": "Задаване на честота чрез системното меню",
"UNLIMITED_DESC": "Без ограничение на GPU честотата, системно планиране по подразбиране",
"FIXED_FREQ_DESC": "Фиксирана GPU честота",
"RANGE_FREQ_DESC": "Задаване на диапазон на GPU честотата",
"AUTO_FREQ_DESC": "Адаптивна GPU честота, принудително изключен TDP лимит, изключен Boost",
"AUTO_FREQ_TDP_NOTIF": "GPU режим {{mode}}, TDP лимитът е изключен",
"FORCE_SHOW_TDP": "Принудително показване на TDP контрол",
"FORCE_SHOW_TDP_DESC": "По подразбиране плъгинът обработва нативния TDP плъзгач. Ако нативният плъзгач има проблеми, активирайте тази опция, за да използвате вътрешния TDP контрол на плъгина"
}
3 changes: 2 additions & 1 deletion src/i18n/english.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
"NATIVE_FREQ":"Native",
"MORE":"More",
"REINSTALL_PLUGIN": "Reinstall Plugin",
"UPDATE_PLUGIN": "Update Plugin To",
"UPDATE_PLUGIN": "Update to",
"ROLLBACK_PLUGIN": "Rollback to",
"INSTALLED_VERSION": "Installed Version",
"LATEST_VERSION": "Latest Version",
"GPU_NATIVE_SLIDER": "Native GPU Slider",
Expand Down
107 changes: 66 additions & 41 deletions src/i18n/french.json
Original file line number Diff line number Diff line change
@@ -1,43 +1,68 @@
{
"TITEL_SETTINGS":"",
"ENABLE_SETTINGS":"",
"USE_PERGAME_PROFILE":"",
"USING":"",
"DEFAULT":"",
"PROFILE":"",
"CPU_BOOST":"",
"CPU_BOOST_DESC":"",
"SMT_DESC":"",
"CPU_NUM":"",
"CPU_NUM_DESC":"",
"TDP":"",
"TDP_DESC":"",
"RYZENADJ_NOT_FOUND":"",
"WATTS":"",
"GPU_FREQMODE":"",
"UNLIMITED":"",
"FIXED_FREQ":"",
"RANGE_FREQ":"",
"AUTO_FREQ":"",
"GPU_FIX_FREQ":"",
"GPU_MIN_FREQ":"",
"GPU_MAX_FREQ":"",
"FAN_SPEED":"",
"CREATE_FAN_PROFILE":"",
"GRID_ALIG":"",
"FAN_MODE":"",
"NOT_CONTROLLED":"",
"FIXED":"",
"CURVE":"",
"SNAP_GRIDLINE":"",
"FAN_SPEED_PERCENT":"",
"SENSOR_TEMP":"",
"CREATE_FAN_PROFILE_TIP":"",
"SELECT_FAN_PROFILE_TIP":"",
"FAN_PROFILE_NAME":"",
"USE":"",
"DELETE":"",
"CREATE":"",
"CANCEL":"",
"CURENT_STAT":""
"TITEL_SETTINGS":"Paramètres",
"ENABLE_SETTINGS":"Activer les paramètres",
"USE_PERGAME_PROFILE":"Utiliser un profil par jeu",
"USING":"En cours d'utilisation",
"DEFAULT":"Par défaut",
"PROFILE":"Profil",
"CPU_BOOST":"Boost CPU",
"CPU_BOOST_DESC":"Augmenter la fréquence maximale du CPU",
"SMT_DESC":"Activer l'hyperthreading",
"CPU_NUM":"Nombre de cœurs CPU",
"CPU_NUM_DESC":"Définir les cœurs physiques activés",
"CPU_MAX_PERF":"Performance CPU maximale",
"TDP":"Limite de puissance thermique (TDP)",
"TDP_DESC":"Limite la puissance du processeur pour réduire la consommation totale",
"RYZENADJ_NOT_FOUND":"RyzenAdj non trouvé",
"WATTS":"Watts",
"GPU_FREQMODE":"Mode de fréquence GPU",
"UNLIMITED":"Illimité",
"FIXED_FREQ":"Fixe",
"RANGE_FREQ":"Plage",
"AUTO_FREQ":"Auto",
"GPU_FIX_FREQ":"Fréquence GPU",
"GPU_MIN_FREQ":"Fréquence minimale",
"GPU_MAX_FREQ":"Fréquence maximale",
"FAN_SPEED":"Vitesse du ventilateur",
"CREATE_FAN_PROFILE":"Créer un profil de ventilateur",
"GRID_ALIG":"Alignement de la grille",
"FAN_MODE":"Mode ventilateur",
"NOT_CONTROLLED":"Non contrôlé",
"FIXED":"Fixe",
"CURVE":"Courbe",
"SNAP_GRIDLINE":"Aligner sur les intersections de la grille",
"FAN_SPEED_PERCENT":"Vitesse du ventilateur (%)",
"SENSOR_TEMP":"Température du capteur",
"CREATE_FAN_PROFILE_TIP":"Créer un profil de ventilateur",
"SELECT_FAN_PROFILE_TIP":"Sélectionner un profil de ventilateur",
"FAN_PROFILE_NAME":"Nom du profil",
"USE":"Utiliser",
"DELETE":"Supprimer",
"CREATE":"Créer",
"CANCEL":"Annuler",
"CURENT_STAT":"État actuel",
"EDIT":"Modifier",
"SAVE":"Enregistrer",
"NATIVE_FREQ":"Natif",
"MORE":"Plus",
"REINSTALL_PLUGIN": "Réinstaller le plugin",
"UPDATE_PLUGIN": "Mettre à jour vers",
"ROLLBACK_PLUGIN": "Revenir à",
"INSTALLED_VERSION": "Version installée",
"LATEST_VERSION": "Dernière version",
"GPU_NATIVE_SLIDER": "Curseur GPU natif",
"GPU_NATIVE_SLIDER_DESC": "Activer le curseur de contrôle GPU natif",
"USE_PERACMODE_PROFILE": "Utiliser un profil par mode d'alimentation",
"AC_MODE": "Mode secteur",
"BAT_MODE": "Mode batterie",
"CUSTOM_TDP_RANGE": "Plage TDP personnalisée",
"RESET_ALL": "Tout réinitialiser",
"NATIVE_FREQ_DESC": "Régler la fréquence via le menu système",
"UNLIMITED_DESC": "Pas de limite de fréquence GPU, planification système par défaut",
"FIXED_FREQ_DESC": "Fréquence GPU fixe",
"RANGE_FREQ_DESC": "Définir la plage de fréquence GPU",
"AUTO_FREQ_DESC": "Fréquence GPU adaptative, limite TDP désactivée de force, Boost désactivé",
"AUTO_FREQ_TDP_NOTIF": "Mode GPU {{mode}}, limite TDP désactivée",
"FORCE_SHOW_TDP": "Forcer l'affichage du contrôle TDP",
"FORCE_SHOW_TDP_DESC": "Par défaut, le plugin traite le curseur TDP natif. Si le curseur natif pose problème, activez cette option pour utiliser le contrôle TDP interne du plugin"
}
55 changes: 40 additions & 15 deletions src/i18n/german.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,66 @@
"ENABLE_SETTINGS":"Einstellungen aktivieren",
"USE_PERGAME_PROFILE":"Spielspezifisches Profil",
"USING":"Verwendet",
"DEFAULT":" standard ",
"DEFAULT":"Standard",
"PROFILE":"Profil",
"CPU_BOOST":"CPU Boost",
"CPU_BOOST_DESC":"Maximale CPU Frequenz erhöhen",
"SMT_DESC":"Aktiviert ungerade CPU-Kerne",
"CPU_NUM":"Anzahl CPU-Kerne",
"CPU_NUM_DESC":"Anzahl physischer CPU-Kerne",
"TDP":"Maximale Verlustleistung (TDP)",
"CPU_MAX_PERF":"Maximale CPU-Leistung",
"TDP":"Thermische Verlustleistung (TDP)",
"TDP_DESC":"CPU-Leistung einschränken um Strom zu sparen",
"RYZENADJ_NOT_FOUND":"ryzenAdj nicht installiert",
"RYZENADJ_NOT_FOUND":"RyzenAdj nicht gefunden",
"WATTS":"Watt",
"GPU_FREQMODE":"Grafikkartenfrequenz Modus",
"GPU_FREQMODE":"GPU-Frequenzmodus",
"UNLIMITED":"Unbeschränkt",
"FIXED_FREQ":"fix",
"FIXED_FREQ":"Fest",
"RANGE_FREQ":"Bereich",
"AUTO_FREQ":"Automatisch",
"GPU_FIX_FREQ":"Grafikkartenfrequenz",
"GPU_FIX_FREQ":"GPU-Frequenz",
"GPU_MIN_FREQ":"Minimale Frequenz",
"GPU_MAX_FREQ":"Maximale Frequenz",
"FAN_SPEED":"Lüftergeschwindigkeit",
"CREATE_FAN_PROFILE":"Lüfterprofil erstellen",
"GRID_ALIG":"Gitternetz Ausrichtung",
"GRID_ALIG":"Gitternetz-Ausrichtung",
"FAN_MODE":"Lüftermodus",
"NOT_CONTROLLED":"Nicht kontrolliert",
"NOT_CONTROLLED":"Nicht gesteuert",
"FIXED":"Fest",
"CURVE":"Kurve",
"SNAP_GRIDLINE":"An der Gitternetzlinien ausrichten",
"FAN_SPEED_PERCENT":"Prozentanteil der Lüftergeschwindigkeit",
"SENSOR_TEMP":"Temperatur des Sensors",
"SNAP_GRIDLINE":"An Gitterlinien ausrichten",
"FAN_SPEED_PERCENT":"Lüftergeschwindigkeit (%)",
"SENSOR_TEMP":"Sensortemperatur",
"CREATE_FAN_PROFILE_TIP":"Lüfterprofil erstellen",
"SELECT_FAN_PROFILE_TIP":"Wähle ein Lüfterprofil aus",
"FAN_PROFILE_NAME":"Name des Profils",
"USE":"Benutzen",
"SELECT_FAN_PROFILE_TIP":"Lüfterprofil auswählen",
"FAN_PROFILE_NAME":"Profilname",
"USE":"Verwenden",
"DELETE":"Löschen",
"CREATE":"Erstellen",
"CANCEL":"Abbrechen",
"CURENT_STAT":"Aktueller Stand"
"CURENT_STAT":"Aktueller Status",
"EDIT":"Bearbeiten",
"SAVE":"Speichern",
"NATIVE_FREQ":"Nativ",
"MORE":"Mehr",
"REINSTALL_PLUGIN": "Plugin neu installieren",
"UPDATE_PLUGIN": "Aktualisieren auf",
"ROLLBACK_PLUGIN": "Zurücksetzen auf",
"INSTALLED_VERSION": "Installierte Version",
"LATEST_VERSION": "Neueste Version",
"GPU_NATIVE_SLIDER": "Nativer GPU-Schieberegler",
"GPU_NATIVE_SLIDER_DESC": "Nativen GPU-Schieberegler aktivieren",
"USE_PERACMODE_PROFILE": "Profil nach Stromversorgung",
"AC_MODE": "Netzbetrieb",
"BAT_MODE": "Akkubetrieb",
"CUSTOM_TDP_RANGE": "Benutzerdefinierter TDP-Bereich",
"RESET_ALL": "Alles zurücksetzen",
"NATIVE_FREQ_DESC": "Frequenz über Systemmenü einstellen",
"UNLIMITED_DESC": "Keine GPU-Frequenzbegrenzung, Standard-Systemplanung",
"FIXED_FREQ_DESC": "Feste GPU-Frequenz",
"RANGE_FREQ_DESC": "GPU-Frequenzbereich festlegen",
"AUTO_FREQ_DESC": "Adaptive GPU-Frequenz, TDP-Limit deaktiviert, Boost deaktiviert",
"AUTO_FREQ_TDP_NOTIF": "GPU-Modus {{mode}}, TDP-Limit deaktiviert",
"FORCE_SHOW_TDP": "TDP-Steuerung erzwingen",
"FORCE_SHOW_TDP_DESC": "Standardmäßig verarbeitet das Plugin den nativen TDP-Schieberegler. Bei Problemen mit dem nativen Schieberegler aktivieren Sie diese Option, um die interne TDP-Steuerung des Plugins zu verwenden"
}
Loading

0 comments on commit 0f87f38

Please sign in to comment.