Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/6.2' into fancybox
Browse files Browse the repository at this point in the history
# Conflicts:
#	package-lock.json
#	package.json
  • Loading branch information
Cyperghost committed Nov 12, 2024
2 parents f713981 + 0eefa53 commit 27e0dae
Show file tree
Hide file tree
Showing 445 changed files with 4,483 additions and 2,207 deletions.
2 changes: 1 addition & 1 deletion com.woltlab.wcf/option.xml
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@
<option name="module_smiley">
<categoryname>module.customization</categoryname>
<optiontype>boolean</optiontype>
<defaultvalue>1</defaultvalue>
<defaultvalue>0</defaultvalue>
</option>
<option name="module_users_online">
<categoryname>module.user</categoryname>
Expand Down
16 changes: 16 additions & 0 deletions com.woltlab.wcf/templates/shared_passwordFormField.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,19 @@
*}{if $field->getDocument()->isAjax()} data-dialog-submit-on-enter="true"{/if}{*
*}{foreach from=$field->getFieldAttributes() key='attributeName' item='attributeValue'} {$attributeName}="{$attributeValue}"{/foreach}{*
*}>

{if $field->getStrengthMeter()}
<script data-relocate="true">
require(["WoltLabSuite/Core/Ui/User/PasswordStrength", "Language"], (PasswordStrength, Language) => {
{include file='shared_passwordStrengthLanguage'}
new PasswordStrength(document.getElementById('{unsafe:$field->getPrefixedId()|encodeJS}'), {
relatedInputs: [
{foreach from=$field->getRelatedFieldsIDs() item=fieldId}
document.getElementById('{unsafe:$fieldId|encodeJS}'),
{/foreach}
],
});
});
</script>
{/if}
13 changes: 13 additions & 0 deletions emoji-picker-webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
"use strict";

const path = require("path");

module.exports = {
entry: "./node_modules/emoji-picker-element/index.js",
output: {
path: path.resolve(__dirname, "wcfsetup", "install", "files", "js", "3rdparty"),
filename: "emoji-picker-element.min.js",
libraryTarget: "amd",
},
mode: "production",
};
22 changes: 22 additions & 0 deletions extra/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions extra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"dependencies": {
"@woltlab/r.js": "git+https://github.com/WoltLab/r.js.git#ad2413df45fdf6164611243f9870943de3d2bce3",
"deepmerge": "^4.3.0",
"emoji-picker-element": "^1.22.8",
"emoji-picker-element-data": "^1.6.1",
"terser": "^5.16.5",
"ts-node": "^10.9.1"
},
Expand Down
129 changes: 129 additions & 0 deletions extra/update-emoji-picker-element.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
import * as fs from "fs";
import { promisify } from "util";
import * as path from "path";
import { I18n } from "emoji-picker-element/shared";
import de from "emoji-picker-element/i18n/de";
import en from "emoji-picker-element/i18n/en";
import es from "emoji-picker-element/i18n/es";
import fr from "emoji-picker-element/i18n/fr";
import it from "emoji-picker-element/i18n/it";
import nl from "emoji-picker-element/i18n/nl";
import pl from "emoji-picker-element/i18n/pl";
import pt_PT from "emoji-picker-element/i18n/pt_PT";
import ru_RU from "emoji-picker-element/i18n/ru_RU";

const copyFile = promisify(fs.copyFile);
const writeFile = promisify(fs.writeFile);
const rm = promisify(fs.rm);
const readdir = promisify(fs.readdir);

if (process.argv.length !== 4) {
throw new Error(
"Expects the path to the directory in which the emoji data is saved as the #1 argument and the path to the Localisation.ts as the #2 argument.",
);
}

const repository = process.argv[2];
if (!fs.existsSync(repository)) {
throw new Error(`The path '${repository}' does not exist.`);
}

const localisation = process.argv[3];
if (!fs.existsSync(localisation)) {
throw new Error(`The path '${localisation}' does not exist.`);
}

const languages: LanguageItem[] = [
{ local: "da" },
{ local: "nl", i18n: nl },
{ local: "en", i18n: en },
{ local: "en-gb" },
{ local: "et" },
{ local: "fi" },
{ local: "fr", i18n: fr },
{ local: "de", i18n: de },
{ local: "hu" },
{ local: "it", i18n: it },
{ local: "lt" },
{ local: "nb" },
{ local: "pl", i18n: pl },
{ local: "pt", i18n: pt_PT },
{ local: "ru", i18n: ru_RU },
{ local: "es", i18n: es },
{ local: "sv" },
{ local: "uk" },
];

(async () => {
let localisationContent = `/**
* This file is auto-generated, DO NOT MODIFY IT MANUALLY!
*
* To update the file, run in the extra directory:
* > \`npx tsx ./update-emoji-picker-element.ts ../wcfsetup/install/files/emoji ../ts/WoltLabSuite/Core/Component/EmojiPicker/Localization.ts\`
*
* @woltlabExcludeBundle all
*/
import { I18n } from "emoji-picker-element/shared";
// prettier-ignore
const locales = [
${languages.map((item) => {
return `"${item.local}"`;
})}
];
export function getLocalizationData(localization: string): I18n {
if (localization.includes("-")) {
localization = localization.split("-")[0];
}
switch (localization) {
${languages
.filter((item) => {
return item.local !== "en";
})
.filter((language) => language.i18n)
.map((item) => {
return `case "${item.local}":
// prettier-ignore
return ${JSON.stringify(item.i18n)};`;
})
.join("\n ")}
default:
// prettier-ignore
return ${JSON.stringify(en)};
}
}
export function getDataSource(locale: string): string {
if (!locales.includes(locale)) {
return \`\${window.WCF_PATH}emoji/en.json\`;
}
return \`\${window.WCF_PATH}emoji/\${locale}.json\`;
}
`;

for (const file in await readdir(repository)) {
if (!file.endsWith(".json")) {
continue;
}

await rm(path.join(repository, file));
}

for (const language of languages) {
await copyFile(
path.join(__dirname, `node_modules/emoji-picker-element-data/${language.local}/cldr-native/data.json`),
path.join(repository, `${language.local}.json`),
);
}

await writeFile(localisation, localisationContent);
})();

interface LanguageItem {
local: string;
i18n?: I18n;
}
Loading

0 comments on commit 27e0dae

Please sign in to comment.