-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/6.2' into fancybox
# Conflicts: # package-lock.json # package.json
- Loading branch information
Showing
445 changed files
with
4,483 additions
and
2,207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
Oops, something went wrong.