Switch repo to English, add i18n with EN/DE language files and first-start language selection
- in-game texts moved to lang/en.lang and lang/de.lang (key = text, placeholders) - game logic emits message keys + args, translated at display time - localStorage access via own miniquad JS plugin (www/dc_plugin.js) - code comments, DESIGN.md, CREDITS.md translated; README.md added Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a101f6ddc4
commit
fbf6f223fc
18 files changed
+1072
-362
No files matched your search
@@ -0,0 +1,32 @@
|
||||
// DungeonCraft browser plugin for miniquad: localStorage access for the Rust code.
|
||||
(function () {
|
||||
"use strict";
|
||||
var pending = null;
|
||||
|
||||
function bytes(ptr, len) {
|
||||
return new Uint8Array(wasm_memory.buffer, ptr, len);
|
||||
}
|
||||
function str(ptr, len) {
|
||||
return new TextDecoder().decode(bytes(ptr, len));
|
||||
}
|
||||
|
||||
function register(importObject) {
|
||||
importObject.env.dc_storage_get = function (kp, kl) {
|
||||
var v = null;
|
||||
try { v = window.localStorage.getItem(str(kp, kl)); } catch (e) { }
|
||||
if (v === null) { pending = null; return -1; }
|
||||
pending = new TextEncoder().encode(v);
|
||||
return pending.length;
|
||||
};
|
||||
importObject.env.dc_storage_take = function (ptr) {
|
||||
if (pending === null) return;
|
||||
bytes(ptr, pending.length).set(pending);
|
||||
pending = null;
|
||||
};
|
||||
importObject.env.dc_storage_set = function (kp, kl, vp, vl) {
|
||||
try { window.localStorage.setItem(str(kp, kl), str(vp, vl)); } catch (e) { }
|
||||
};
|
||||
}
|
||||
|
||||
miniquad_add_plugin({ register_plugin: register, version: 1, name: "dungeoncraft" });
|
||||
})();
|
||||
Reference in new issue
Block a user