mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-14 23:24:52 +09:00
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:
1 parent
a1148c7ec9
commit
cc8ec36e5a
5 files changed
+47
-1
No files matched your search
@@ -9,6 +9,27 @@ const patch = require("@clusterio/host/dist/src/patch");
|
||||
|
||||
|
||||
describe("host/patch", function() {
|
||||
describe("class SaveModule", function() {
|
||||
describe("static moduleFilePath()", function() {
|
||||
it("Should remap locale files", function() {
|
||||
const mappings = [
|
||||
["locale/en/foo.cfg", "locale/en/test-foo.cfg"],
|
||||
["locale/en/foo.txt", "locale/en/test-foo.txt"],
|
||||
["locale/en/foo.txt.tmp", "locale/en/test-foo.txt.tmp"],
|
||||
["locale/en/foo", "locale/en/test-foo"],
|
||||
["locale/en.cfg", "locale/en/test.cfg"],
|
||||
["locale/en.txt", "locale/en/test.txt"],
|
||||
["locale/en.txt.tmp", "locale/en/test.txt.tmp"],
|
||||
["locale/en", "locale/en/test"],
|
||||
["locale/en/bar/foo.cfg", "locale/en/test-bar/foo.cfg"],
|
||||
];
|
||||
for (let [input, expected] of mappings) {
|
||||
assert.equal(patch.SaveModule.moduleFilePath(input, "test"), expected);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("generateLoader()", function() {
|
||||
let reference = [
|
||||
"-- Auto generated scenario module loader created by Clusterio",
|
||||
|
||||
Reference in new issue
Block a user