Skip to content

Commit 640b79b

Browse files
committed
Add translations.
1 parent b4e6e44 commit 640b79b

File tree

6 files changed

+164
-14
lines changed

6 files changed

+164
-14
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ find_package(mo2-cmake CONFIG REQUIRED)
77
mo2_configure_extension()
88

99
add_custom_target(basic_games ALL)
10-
mo2_configure_python(basic_games MODULE TRANSLATIONS OFF)
10+
mo2_configure_python(basic_games MODULE TRANSLATIONS ON)

basic_games/basic_game.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from typing import Callable, Generic, TypeVar
77

88
import mobase
9-
from PyQt6.QtCore import QDir, QFileInfo, QStandardPaths
9+
from PyQt6.QtCore import QCoreApplication, QDir, QFileInfo, QStandardPaths
1010
from PyQt6.QtGui import QIcon
1111

1212
from .basic_features.basic_save_game_info import (
@@ -253,7 +253,7 @@ def __init__(self, game: BasicGame):
253253
game,
254254
"Description",
255255
"description",
256-
lambda g: "Adds basic support for game {}.".format(g.gameName()),
256+
lambda g: game.tr("Adds basic support for game {}.").format(g.gameName()),
257257
)
258258
self.gameName = BasicGameMapping(game, "GameName", "gameName")
259259
self.gameShortName = BasicGameMapping(game, "GameShortName", "gameShortName")
@@ -424,6 +424,10 @@ def is_epic(self) -> bool:
424424
def is_eadesktop(self) -> bool:
425425
return self._mappings.eaDesktopContentId.has_value()
426426

427+
# Qt translation
428+
def tr(self, value: str) -> str:
429+
return QCoreApplication.translate("BasicGame", value)
430+
427431
# IPlugin interface:
428432

429433
def init(self, organizer: mobase.IOrganizer) -> bool:

basic_games/games/game_cyberpunk2077.py

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -397,23 +397,26 @@ def settings(self) -> list[mobase.PluginSetting]:
397397
return [
398398
mobase.PluginSetting(
399399
"skipStartScreen",
400-
(
400+
self.tr("Skip start screen"),
401+
self.tr(
401402
'Skips the "Breaching..." start screen on game launch'
402403
" (can also skip loading of GOG rewards)"
403404
),
404405
False,
405406
),
406407
mobase.PluginSetting(
407408
"enforce_archive_load_order",
408-
(
409+
self.tr("Enforce archive load order"),
410+
self.tr(
409411
"Enforce the current load order via"
410412
" <code>archive/pc/mod/modlist.txt</code>"
411413
),
412414
False,
413415
),
414416
mobase.PluginSetting(
415417
"reverse_archive_load_order",
416-
(
418+
self.tr("Reverse archive load order"),
419+
self.tr(
417420
"Reverse MOs load order in"
418421
" <code>archive/pc/mod/modlist.txt</code>"
419422
" (first loaded mod wins = last one / highest prio in MO)"
@@ -422,33 +425,40 @@ def settings(self) -> list[mobase.PluginSetting]:
422425
),
423426
mobase.PluginSetting(
424427
"enforce_redmod_load_order",
425-
"Enforce the current load order on redmod deployment",
428+
self.tr("Enforce RedMod load order"),
429+
self.tr("Enforce the current load order on redmod deployment"),
426430
True,
427431
),
428432
mobase.PluginSetting(
429433
"reverse_redmod_load_order",
430-
(
434+
self.tr("Reverse RedMod load order"),
435+
self.tr(
431436
"Reverse MOs load order on redmod deployment"
432437
" (first loaded mod wins = last one / highest prio in MO)"
433438
),
434439
False,
435440
),
436441
mobase.PluginSetting(
437442
"auto_deploy_redmod",
438-
"Deploy redmod before game launch if necessary",
443+
self.tr("Auto deploy RedMod"),
444+
self.tr("Deploy redmod before game launch if necessary"),
439445
True,
440446
),
441447
mobase.PluginSetting(
442448
"clear_cache_after_game_update",
443-
(
449+
self.tr("Clear cache after game update"),
450+
self.tr(
444451
'Clears "overwrite/r6/cache/*" if the original game files changed'
445452
" (after update)"
446453
),
447454
True,
448455
),
449456
mobase.PluginSetting(
450457
"configure_RootBuilder",
451-
"Configures RootBuilder for Cyberpunk if installed and enabled",
458+
self.tr("Configure RootBuilder"),
459+
self.tr(
460+
"Configures RootBuilder for Cyberpunk if installed and enabled"
461+
),
452462
True,
453463
),
454464
]

basic_games/games/game_subnautica.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ def settings(self) -> list[mobase.PluginSetting]:
159159
return [
160160
mobase.PluginSetting(
161161
"use_qmods",
162-
(
162+
self.tr("Use QMods"),
163+
self.tr(
163164
"Install */.dll mods in legacy QMods folder,"
164165
" instead of BepInEx/plugins (default)."
165166
),

basic_games/games/game_valheim.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,11 +385,15 @@ def settings(self) -> list[mobase.PluginSetting]:
385385
settings.extend(
386386
[
387387
mobase.PluginSetting(
388-
"sync_overwrite", "Sync overwrite with mods", True
388+
"sync_overwrite",
389+
self.tr("Synchronize overwrite"),
390+
self.tr("Synchronize overwrite with mods"),
391+
True,
389392
),
390393
mobase.PluginSetting(
391394
"search_overwrite_file_content",
392-
"Search content of files in overwrite for matching mod",
395+
self.tr("Search overwrite file content"),
396+
self.tr("Search content of files in overwrite for matching mod"),
393397
True,
394398
),
395399
]

basic_games_en.ts

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!DOCTYPE TS>
3+
<TS version="2.1">
4+
<context>
5+
<name>BasicGameMappings</name>
6+
<message>
7+
<location filename="basic_games\basic_game.py" line="256" />
8+
<source>Adds basic support for game {}.</source>
9+
<translation type="unfinished" />
10+
</message>
11+
</context>
12+
<context>
13+
<name>Cyberpunk2077Game</name>
14+
<message>
15+
<location filename="basic_games\games\game_cyberpunk2077.py" line="400" />
16+
<source>Skip start screen</source>
17+
<translation type="unfinished" />
18+
</message>
19+
<message>
20+
<location filename="basic_games\games\game_cyberpunk2077.py" line="401" />
21+
<source>Skips the "Breaching..." start screen on game launch (can also skip loading of GOG rewards)</source>
22+
<translation type="unfinished" />
23+
</message>
24+
<message>
25+
<location filename="basic_games\games\game_cyberpunk2077.py" line="409" />
26+
<source>Enforce archive load order</source>
27+
<translation type="unfinished" />
28+
</message>
29+
<message>
30+
<location filename="basic_games\games\game_cyberpunk2077.py" line="410" />
31+
<source>Enforce the current load order via &lt;code&gt;archive/pc/mod/modlist.txt&lt;/code&gt;</source>
32+
<translation type="unfinished" />
33+
</message>
34+
<message>
35+
<location filename="basic_games\games\game_cyberpunk2077.py" line="418" />
36+
<source>Reverse archive load order</source>
37+
<translation type="unfinished" />
38+
</message>
39+
<message>
40+
<location filename="basic_games\games\game_cyberpunk2077.py" line="419" />
41+
<source>Reverse MOs load order in &lt;code&gt;archive/pc/mod/modlist.txt&lt;/code&gt; (first loaded mod wins = last one / highest prio in MO)</source>
42+
<translation type="unfinished" />
43+
</message>
44+
<message>
45+
<location filename="basic_games\games\game_cyberpunk2077.py" line="428" />
46+
<source>Enforce RedMod load order</source>
47+
<translation type="unfinished" />
48+
</message>
49+
<message>
50+
<location filename="basic_games\games\game_cyberpunk2077.py" line="429" />
51+
<source>Enforce the current load order on redmod deployment</source>
52+
<translation type="unfinished" />
53+
</message>
54+
<message>
55+
<location filename="basic_games\games\game_cyberpunk2077.py" line="434" />
56+
<source>Reverse RedMod load order</source>
57+
<translation type="unfinished" />
58+
</message>
59+
<message>
60+
<location filename="basic_games\games\game_cyberpunk2077.py" line="435" />
61+
<source>Reverse MOs load order on redmod deployment (first loaded mod wins = last one / highest prio in MO)</source>
62+
<translation type="unfinished" />
63+
</message>
64+
<message>
65+
<location filename="basic_games\games\game_cyberpunk2077.py" line="443" />
66+
<source>Auto deploy RedMod</source>
67+
<translation type="unfinished" />
68+
</message>
69+
<message>
70+
<location filename="basic_games\games\game_cyberpunk2077.py" line="444" />
71+
<source>Deploy redmod before game launch if necessary</source>
72+
<translation type="unfinished" />
73+
</message>
74+
<message>
75+
<location filename="basic_games\games\game_cyberpunk2077.py" line="449" />
76+
<source>Clear cache after game update</source>
77+
<translation type="unfinished" />
78+
</message>
79+
<message>
80+
<location filename="basic_games\games\game_cyberpunk2077.py" line="450" />
81+
<source>Clears "overwrite/r6/cache/*" if the original game files changed (after update)</source>
82+
<translation type="unfinished" />
83+
</message>
84+
<message>
85+
<location filename="basic_games\games\game_cyberpunk2077.py" line="458" />
86+
<source>Configure RootBuilder</source>
87+
<translation type="unfinished" />
88+
</message>
89+
<message>
90+
<location filename="basic_games\games\game_cyberpunk2077.py" line="459" />
91+
<source>Configures RootBuilder for Cyberpunk if installed and enabled</source>
92+
<translation type="unfinished" />
93+
</message>
94+
</context>
95+
<context>
96+
<name>SubnauticaGame</name>
97+
<message>
98+
<location filename="basic_games\games\game_subnautica.py" line="162" />
99+
<source>Use QMods</source>
100+
<translation type="unfinished" />
101+
</message>
102+
<message>
103+
<location filename="basic_games\games\game_subnautica.py" line="163" />
104+
<source>Install */.dll mods in legacy QMods folder, instead of BepInEx/plugins (default).</source>
105+
<translation type="unfinished" />
106+
</message>
107+
</context>
108+
<context>
109+
<name>ValheimGame</name>
110+
<message>
111+
<location filename="basic_games\games\game_valheim.py" line="389" />
112+
<source>Synchronize overwrite</source>
113+
<translation type="unfinished" />
114+
</message>
115+
<message>
116+
<location filename="basic_games\games\game_valheim.py" line="390" />
117+
<source>Synchronize overwrite with mods</source>
118+
<translation type="unfinished" />
119+
</message>
120+
<message>
121+
<location filename="basic_games\games\game_valheim.py" line="395" />
122+
<source>Search overwrite file content</source>
123+
<translation type="unfinished" />
124+
</message>
125+
<message>
126+
<location filename="basic_games\games\game_valheim.py" line="396" />
127+
<source>Search content of files in overwrite for matching mod</source>
128+
<translation type="unfinished" />
129+
</message>
130+
</context>
131+
</TS>

0 commit comments

Comments
 (0)