Remove t from utils/emojis and related code (#27273)
* Update make_emojis.mjs and remove unused field * Remove skin tone translations from emojis.ts * Remove category name translations from emojis.ts --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
a3bc73c1dc
Коммит
65f7a623ce
@@ -13,17 +13,17 @@
|
||||
* npm run make-emojis -- --help
|
||||
*/
|
||||
|
||||
import path from 'node:path';
|
||||
import * as fsPromise from 'node:fs/promises';
|
||||
import * as fs from 'node:fs';
|
||||
import * as fsPromise from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
import * as url from 'node:url';
|
||||
|
||||
import yargs from 'yargs';
|
||||
import chalk from 'chalk';
|
||||
import jsonData from 'emoji-datasource/emoji.json';
|
||||
import jsonCategories from 'emoji-datasource/categories.json';
|
||||
import jsonCategories from 'emoji-datasource/categories.json' assert {type: 'json'};
|
||||
import jsonData from 'emoji-datasource/emoji.json' assert {type: 'json'};
|
||||
import yargs from 'yargs';
|
||||
|
||||
import additionalShortnames from './additional_shortnames.json';
|
||||
import additionalShortnames from './additional_shortnames.json' assert {type: 'json'};
|
||||
|
||||
const EMOJI_SIZE = 64;
|
||||
const EMOJI_SIZE_PADDED = EMOJI_SIZE + 2; // 1px per side
|
||||
@@ -142,7 +142,6 @@ const emojiIndicesByCategory = new Map();
|
||||
const emojiIndicesByCategoryAndSkin = new Map();
|
||||
const emojiIndicesByCategoryNoSkin = new Map();
|
||||
const categoryNamesSet = new Set();
|
||||
const categoryDefaultTranslation = new Map();
|
||||
const emojiImagesByAlias = [];
|
||||
const emojiFilePositions = new Map();
|
||||
const skinCodes = {
|
||||
@@ -237,7 +236,6 @@ fullEmoji.forEach((emoji, index) => {
|
||||
}
|
||||
|
||||
const safeCat = normalizeCategoryName(emoji.category);
|
||||
categoryDefaultTranslation.set(safeCat, emoji.category);
|
||||
emoji.category = safeCat;
|
||||
addIndexToMap(emojiIndicesByCategory, safeCat, index);
|
||||
if (emoji.skins || emoji.skin_variations) {
|
||||
@@ -351,17 +349,11 @@ endResults.push(writeToFileAndPrint('emoji.json', webappUtilsEmojiDir, JSON.stri
|
||||
|
||||
const categoryList = Object.keys(jsonCategories).filter((item) => item !== 'Component').map(normalizeCategoryName);
|
||||
const categoryNames = ['recent', ...categoryList, 'custom'];
|
||||
categoryDefaultTranslation.set('recent', 'Recently Used');
|
||||
categoryDefaultTranslation.set('searchResults', 'Search Results');
|
||||
categoryDefaultTranslation.set('custom', 'Custom');
|
||||
|
||||
const categoryTranslations = ['recent', 'searchResults', ...categoryNames].map((c) => `['${c}', t('emoji_picker.${c}')]`);
|
||||
const writeableSkinCategories = [];
|
||||
const skinTranslations = [];
|
||||
const skinnedCats = [];
|
||||
for (const skin of emojiIndicesByCategoryAndSkin.keys()) {
|
||||
writeableSkinCategories.push(`['${skin}', new Map(${JSON.stringify(Array.from(emojiIndicesByCategoryAndSkin.get(skin)))})]`);
|
||||
skinTranslations.push(`['${skin}', t('emoji_skin.${skinCodes[skin]}')]`);
|
||||
skinnedCats.push(`['${skin}', genSkinnedCategories('${skin}')]`);
|
||||
}
|
||||
|
||||
@@ -373,8 +365,6 @@ const emojiJSX = `// Copyright (c) 2015-present Mattermost, Inc. All Rights Rese
|
||||
|
||||
/* eslint-disable */
|
||||
|
||||
import {t} from 'utils/i18n';
|
||||
|
||||
import memoize from 'memoize-one';
|
||||
|
||||
import emojis from 'utils/emoji.json';
|
||||
@@ -389,14 +379,6 @@ export const EmojiIndicesByUnicode = new Map(${JSON.stringify(emojiIndicesByUnic
|
||||
|
||||
export const CategoryNames = ${JSON.stringify(categoryNames)};
|
||||
|
||||
export const CategoryMessage = new Map(${JSON.stringify(Array.from(categoryDefaultTranslation))});
|
||||
|
||||
export const CategoryTranslations = new Map([${categoryTranslations}]);
|
||||
|
||||
export const SkinTranslations = new Map([${skinTranslations.join(', ')}]);
|
||||
|
||||
export const ComponentCategory = 'Component';
|
||||
|
||||
const AllEmojiIndicesByCategory = new Map(${JSON.stringify(Array.from(emojiIndicesByCategory))});
|
||||
|
||||
const EmojiIndicesByCategoryAndSkin = new Map([${writeableSkinCategories.join(', ')}]);
|
||||
|
||||
Ссылка в новой задаче
Block a user