Add new const `LANGUAGE_CODE`
authorCyperghost <olaf_schmitz_1@t-online.de>
Mon, 23 Sep 2024 07:14:10 +0000 (09:14 +0200)
committerCyperghost <olaf_schmitz_1@t-online.de>
Mon, 14 Oct 2024 07:19:05 +0000 (09:19 +0200)
com.woltlab.wcf/templates/headIncludeJavaScript.tpl
ts/WoltLabSuite/WebComponent/emoji-picker.ts [new file with mode: 0644]
ts/WoltLabSuite/WebComponent/global.d.ts
ts/WoltLabSuite/WebComponent/index.ts
ts/global.d.ts

index 3bb9f1411107d40eca9f8fa5a39bc279d9564794..b08015171dbcb6aed7864e813cf7de48ebf32109 100644 (file)
@@ -8,6 +8,7 @@
        var WSC_RPC_API_URL = '{link controller="Api" id="rpc"}{/link}';
        {* The SECURITY_TOKEN is defined in wcf.globalHelper.js *}
        var LANGUAGE_ID = {@$__wcf->getLanguage()->languageID};
+       var LANGUAGE_CODE = "{@$__wcf->getLanguage()->languageCode}";
        var LANGUAGE_USE_INFORMAL_VARIANT = {if LANGUAGE_USE_INFORMAL_VARIANT}true{else}false{/if};
        var TIME_NOW = {@TIME_NOW};
        var LAST_UPDATE_TIME = {@LAST_UPDATE_TIME};
diff --git a/ts/WoltLabSuite/WebComponent/emoji-picker.ts b/ts/WoltLabSuite/WebComponent/emoji-picker.ts
new file mode 100644 (file)
index 0000000..1606107
--- /dev/null
@@ -0,0 +1,11 @@
+import { wheneverSeen } from "WoltLabSuite/Core/Helper/Selector";
+import { Picker } from "emoji-picker-element";
+
+import "emoji-picker-element";
+
+void import("emoji-picker-element/i18n/de").then((emojiLanguage) => {
+  wheneverSeen("emoji-picker", (emojiPicker: Picker) => {
+    emojiPicker.locale = window.LANGUAGE_CODE;
+    emojiPicker.i18n = emojiLanguage.default;
+  });
+});
index edda85c03d81264f2b806632c8827d41fc73bb9b..11c082dfadffdfd96e08fbf6ab19a89a763e14c7 100644 (file)
@@ -27,6 +27,7 @@ declare global {
       [key: string]: Reaction;
     };
     TIME_NOW: number;
+    LANGUAGE_CODE: string;
 
     getFontAwesome6IconMetadata: (name: string) => IconMetadata | undefined;
 
index 8e252f8c138100342846be3605666930554af8ee..371e4558600b7373f627917a489812d256fe02aa 100644 (file)
@@ -17,4 +17,4 @@ import "./woltlab-core-loading-indicator.ts";
 import "./woltlab-core-notice.ts";
 import "./woltlab-core-pagination.ts";
 import "./woltlab-core-reaction-summary.ts";
-import "emoji-picker-element";
+import "./emoji-picker.ts";
index e17ba42deb9c26633ae6396bfd1e6fbda7e85201..2daa700660766ca7f3beb0ed5de50dcd15fe1ece 100644 (file)
@@ -29,6 +29,7 @@ declare global {
     ENABLE_DEBUG_MODE: boolean;
     ENABLE_DEVELOPER_TOOLS: boolean;
     LANGUAGE_ID: number;
+    LANGUAGE_CODE: string;
     PAGE_TITLE: string;
     REACTION_TYPES: {
       [key: string]: Reaction;