Map locale from modules into the save's locale

Map locale files located at locale/{lang}/{file} in a module to
locale/{lang}/{module-name}-{file} in the save. This additionally
support a shorthand notation by mapping locale/{lange}.cfg to
locale/{lang}/{module-name}.cfg.

Resolves #500.
This commit is contained in:
Hornwitser committed 2023-08-25 16:46:13 +02:00
1 parent a1148c7ec9
commit cc8ec36e5a
5 files changed
+47 -1

No files matched your search

+8
View File
@@ -27,6 +27,14 @@ describe("Integration of lib/factorio/patch", function() {
let zip = await JSZip.loadAsync(await fs.readFile(savePath));
assert.equal(await zip.file("test/modules/test/test.lua").async("string"), "-- test\n");
assert.equal(await zip.file("test/modules/subdir/dir/test.lua").async("string"), "-- test\n");
assert.equal(
await zip.file("test/locale/en/test.cfg").async("string"),
"module-test=A Test\n"
);
assert.equal(
await zip.file("test/locale/en/test-locale.cfg").async("string"),
"module-test-locale=Test Locale\n"
);
});
it("should remove old modules in a save", async function() {
slowTest(this);