Skip to content

Commit e3d4fc2

Browse files
committed
Add French translation
1 parent bd7c185 commit e3d4fc2

19 files changed

+1285
-509
lines changed

changelog.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,4 @@ and only contains the latest changes.
33
Its purpose is to be shown in Olympus when updating.
44

55
#changelog#
6-
∙ Added more mirror options for people that cannot access maddie480.ovh
7-
∙ Improved logs for easier troubleshooting
8-
∙ Manage Installed Mods: "Disable All" does not disable favorited mods anymore
6+
∙ Added French language option

sharp/CmdUpdateAllMods.cs

Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,51 @@
88
using System.Security.Cryptography;
99

1010
namespace Olympus {
11-
public class CmdUpdateAllMods : Cmd<string, bool, string, bool, IEnumerator> {
11+
public class CmdUpdateAllMods : Cmd<string, bool, string, bool, string, IEnumerator> {
1212
private static readonly Logger log = new Logger(nameof(CmdUpdateAllMods));
1313

1414
public override bool Taskable => true;
1515

16-
public override IEnumerator Run(string root, bool onlyEnabled, string mirrorPreferences, bool apiMirror) {
17-
yield return "Downloading mod versions list...";
16+
private static readonly Dictionary<string, Dictionary<string, string>> translations = new Dictionary<string, Dictionary<string, string>> {
17+
{
18+
"en", new Dictionary<string, string> {
19+
{ "downloading", "Downloading mod versions list" },
20+
{ "checking", "Checking for outdated mods" },
21+
{ "updating", "Updating" },
22+
{ "installing", "installing update" },
23+
{ "finished_noop", "Update check finished.\nNo updates were found." },
24+
{ "finished", "Update successful!\nThe following mods were updated:" },
25+
{ "checksum", "verifying checksum" }
26+
}
27+
}, {
28+
"fr", new Dictionary<string, string> {
29+
{ "downloading", "Téléchargement de la liste des mods" },
30+
{ "checking", "Vérification des mises à jour" },
31+
{ "updating", "Mise à jour" },
32+
{ "installing", "installation en cours" },
33+
{ "finished_noop", "La vérification est terminée.\nAucune mise à jour n'a été trouvée." },
34+
{ "finished", "Mise à jour terminée !\nLes mods suivants ont été mis à jour :" },
35+
{ "checksum", "vérification de la somme de contrôle" }
36+
}
37+
},
38+
};
39+
40+
private static string langGet(string lang, string key) {
41+
if (lang.Equals("ne")) {
42+
char[] charArray = translations["en"][key].ToCharArray();
43+
Array.Reverse(charArray);
44+
return new string(charArray);
45+
}
46+
return translations[lang][key];
47+
}
48+
49+
50+
51+
public override IEnumerator Run(string root, bool onlyEnabled, string mirrorPreferences, bool apiMirror, string lang) {
52+
yield return $"{langGet(lang, "downloading")}...";
1853
Dictionary<string, ModUpdateInfo> modVersionList = downloadModUpdateList(apiMirror);
1954

20-
yield return "Checking for outdated mods...";
55+
yield return $"{langGet(lang, "checking")}...";
2156

2257
Dictionary<ModUpdateInfo, CmdModList.ModInfo> updates = new Dictionary<ModUpdateInfo, CmdModList.ModInfo>();
2358

@@ -30,7 +65,7 @@ public override IEnumerator Run(string root, bool onlyEnabled, string mirrorPref
3065

3166
foreach (CmdModList.ModInfo info in new EnumeratorEnumerator { Enumerator = new CmdModList().Run(root, readYamls: true, computeHashes: true, onlyUpdatable: true, onlyEnabled) }) {
3267
processedCount++;
33-
yield return "Checking for outdated mods (" + (int) Math.Round(processedCount * 100f / totalCount) + "%)...";
68+
yield return $"{langGet(lang, "checking")} (" + (int) Math.Round(processedCount * 100f / totalCount) + "%)...";
3469

3570
if (info.Hash != null && modVersionList.ContainsKey(info.Name)) {
3671
log.Debug($"Mod {info.Name}: installed hash {info.Hash}, latest hash(es) {string.Join(", ", modVersionList[info.Name].xxHash)}");
@@ -44,7 +79,7 @@ public override IEnumerator Run(string root, bool onlyEnabled, string mirrorPref
4479

4580
int updatingMod = 1;
4681
foreach (KeyValuePair<ModUpdateInfo, CmdModList.ModInfo> update in updates) {
47-
string messagePrefix = $"[{updatingMod}/{updates.Count}] Updating {update.Value.Name}";
82+
string messagePrefix = $"[{updatingMod}/{updates.Count}] {langGet(lang, "updating")} {update.Value.Name}";
4883

4984
yield return messagePrefix + "...";
5085

@@ -54,17 +89,17 @@ public override IEnumerator Run(string root, bool onlyEnabled, string mirrorPref
5489
yield return message;
5590
}
5691

57-
yield return messagePrefix + ": installing update";
92+
yield return messagePrefix + $": {langGet(lang, "installing")}";
5893
installModUpdate(update.Key, update.Value, tempZip);
5994

6095
updatingMod++;
6196
}
6297

6398
// The last yielded message might be displayed as a recap popup by Olympus when relevant.
6499
if (updates.Count == 0) {
65-
yield return "Update check finished.\nNo updates were found.";
100+
yield return langGet(lang, "finished_noop");
66101
} else {
67-
yield return "Update successful!\nThe following mods were updated:"
102+
yield return langGet(lang, "finished")
68103
+ updates.Values.Aggregate("", (a, b) => $"{a}\n- {b.Name}");
69104
}
70105
}

src/alert.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
local ui, uiu, uie = require("ui").quick()
22
local scener = require("scener")
33
local config = require("config")
4+
local lang = require("lang")
45

56
local alert = {}
67

@@ -96,8 +97,8 @@ function alert.show(data)
9697

9798
if not data.buttons then
9899
data.buttons = {
99-
{ "OK", function(container)
100-
container:close("OK")
100+
{ lang.get("ok"), function(container)
101+
container:close(lang.get("ok"))
101102
end }
102103
}
103104
end
@@ -283,4 +284,4 @@ return setmetatable(alert, {
283284
__call = function(self, ...)
284285
return self.show(...)
285286
end
286-
})
287+
})

src/config.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ function config.load()
141141

142142
default(data, "closeAfterOneClickInstall", "disabled")
143143

144+
default(data, "language", "en")
145+
144146
default(data, "extradata", {})
145147
end
146148

src/dragndrop.lua

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,31 @@ local alert = require("alert")
1111
local notify = require("notify")
1212
local modinstaller = require("modinstaller")
1313
local modupdater = require("modupdater")
14+
local lang = require("lang")
1415

1516
function love.filedropped(file)
1617
threader.routine(function()
1718
file = file:getFilename()
1819
log.info("file drag n dropped", file)
1920

2021
if #alert.root.children > 0 or scener.locked then
21-
notify("Olympus is currently busy with something else.")
22+
notify(lang.get("olympus_is_currently_busy_with_something"))
2223
return
2324
end
2425

2526
local install = config.installs[config.install]
2627
if not install then
2728
alert({
28-
body = [[
29-
Your Celeste installation list is still empty.
30-
Do you want to go to the Celeste installation manager?]],
29+
body = lang.get("your_celeste_installation_list_is_still_"),
3130
buttons = {
3231
{
33-
"Yes",
32+
lang.get("yes"),
3433
function(container)
3534
scener.push("installmanager")
36-
container:close("OK")
35+
container:close(lang.get("ok"))
3736
end
3837
},
39-
{ "No" }
38+
{ lang.get("no") }
4039
}
4140
})
4241
return
@@ -53,7 +52,7 @@ Do you want to go to the Celeste installation manager?]],
5352

5453
if not fs.isFile(file) then
5554
log.warning("user drag-n-dropped pathless file?")
56-
notify("Olympus can't handle that file - does it exist?")
55+
notify(lang.get("olympus_can_t_handle_that_file_does_it_e"))
5756
return
5857
end
5958

@@ -69,17 +68,17 @@ Do you want to go to the Celeste installation manager?]],
6968
return
7069
end
7170

72-
installer.update("Everest successfully installed", 1, "done")
71+
installer.update(lang.get("everest_successfully_installed"), 1, "done")
7372
installer.done({
7473
{
75-
"Launch",
74+
lang.get("launch"),
7675
function()
7776
modupdater.updateAllMods(install.entry.path, true)
7877
scener.pop()
7978
end
8079
},
8180
{
82-
"OK",
81+
lang.get("ok"),
8382
function()
8483
scener.pop()
8584
end
@@ -89,7 +88,7 @@ Do you want to go to the Celeste installation manager?]],
8988

9089
else
9190
log.warning("user drag-n-dropped file of unknown type", file)
92-
notify("Olympus can't handle that file.")
91+
notify(lang.get("olympus_can_t_handle_that_file"))
9392
end
9493
end)
95-
end
94+
end

0 commit comments

Comments
 (0)