-
Notifications
You must be signed in to change notification settings - Fork 3.9k
feat: support Spanish emojis #20828
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
feat: support Spanish emojis #20828
Changes from all commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
d38f775
feat: new emoji database
sangar-1028 08496e8
feat: update quick reactions(support es)
sangar-1028 51ac473
feat: all emojis and categories support es
sangar-1028 07b59e3
fix: import error
sangar-1028 8c18175
lint error
sangar-1028 91839ed
fix: merge main and fix conflicts
sangar-1028 d9835f9
fix: emoji suggestion bug
sangar-1028 b309e68
fix: Emoji and Report tests
sangar-1028 d3778b2
fix: conflicts
sangar-1028 23bb285
fix: nested property
sangar-1028 99b8343
fix: prettier
sangar-1028 f742447
fix: remove people-and-body category and corresponding icon, change c…
sangar-1028 2551336
fix: header emojis back to original
sangar-1028 61be178
fix: toggleReaction, quick emoji back to original
sangar-1028 d9820a1
Merge branch 'main' into fix/issue-16086
sangar-1028 e9eccaf
fix: remove wrong comments
sangar-1028 fe1d94b
fix: rename getEmojiName -> getLocalizedEmojiName
sangar-1028 1977161
fix: lint error
sangar-1028 ac4a5c2
fix: shortcode -> name
sangar-1028 a32d5a3
fix: toggle emoji reaction
sangar-1028 746c5af
fix: test and lint
sangar-1028 221c763
fix: remove shortcodes from tests
sangar-1028 fe06885
fix: remove differences
sangar-1028 555c8b4
fix: remove differences
sangar-1028 680fc05
fix: prettier error
sangar-1028 2dc64dd
fix: missing emoji
sangar-1028 fc90352
fix: emoji util function getEmojiName created
sangar-1028 18646ed
fix: prettier changes
sangar-1028 7ef92fc
fix: skintones order
sangar-1028 2ab63d5
fix: testing error due to skintones
sangar-1028 11f77ac
fix: use old English names
sangar-1028 2dbe1ed
feat: new emoji language files
sangar-1028 45dec32
feat: rename emoji language files
sangar-1028 361f3d9
fix: new emoji structure
sangar-1028 29070e3
fix: new structure of emoji
sangar-1028 70bc730
feat: support En as well for other locales
sangar-1028 353ace4
fix: tests
sangar-1028 71110cb
Merge branch 'main' into fix/issue-16086
sangar-1028 4bed2dd
fix: lint errors
sangar-1028 0df9868
fix: remove unused comments
sangar-1028 70cce1e
fix: conflicts
sangar-1028 467f49f
fix: conflicts
sangar-1028 a878f3a
fix: conflicts
sangar-1028 f9192ee
Merge branch 'main' into fix/issue-16086
sangar-1028 d7d91b8
fix: preferredLocaled added to BaseQuickEmojiReactions
sangar-1028 bf8e80e
fix: lint error
sangar-1028 6461f53
fix: conflicts
sangar-1028 cb4e9cf
fix: conflicts
sangar-1028 a3cd2c9
fix: rename emojiToReact -> reactionEmoji
sangar-1028 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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,36 @@ | ||
| import _ from 'underscore'; | ||
| import emojis from './common'; | ||
| import enEmojis from './en'; | ||
| import esEmojis from './es'; | ||
|
|
||
| const emojiNameTable = _.reduce( | ||
| emojis, | ||
| (prev, cur) => { | ||
| const newValue = prev; | ||
| if (!cur.header) { | ||
| newValue[cur.name] = cur; | ||
| } | ||
| return newValue; | ||
| }, | ||
| {}, | ||
| ); | ||
|
|
||
| const emojiCodeTable = _.reduce( | ||
| emojis, | ||
| (prev, cur) => { | ||
| const newValue = prev; | ||
| if (!cur.header) { | ||
| newValue[cur.code] = cur; | ||
| } | ||
| return newValue; | ||
| }, | ||
| {}, | ||
| ); | ||
|
|
||
| const localeEmojis = { | ||
| en: enEmojis, | ||
| es: esEmojis, | ||
| }; | ||
|
|
||
| export {emojiNameTable, emojiCodeTable, localeEmojis}; | ||
| export {skinTones, categoryFrequentlyUsed, default} from './common'; |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,37 +1,53 @@ | ||
| import emojis from '../../assets/emojis'; | ||
| import _ from 'underscore'; | ||
| import emojis, {localeEmojis} from '../../assets/emojis'; | ||
| import Trie from './Trie'; | ||
| import Timing from './actions/Timing'; | ||
| import CONST from '../CONST'; | ||
|
|
||
| Timing.start(CONST.TIMING.TRIE_INITIALIZATION); | ||
|
|
||
| const emojisTrie = new Trie(); | ||
| const supportedLanguages = [CONST.LOCALES.DEFAULT, CONST.LOCALES.ES]; | ||
|
|
||
| // Inserting all emojis into the Trie object | ||
| for (let i = 0; i < emojis.length; i++) { | ||
| if (emojis[i].name) { | ||
| const node = emojisTrie.search(emojis[i].name); | ||
| if (!node) { | ||
| emojisTrie.add(emojis[i].name, {code: emojis[i].code, types: emojis[i].types, suggestions: []}); | ||
| } else { | ||
| emojisTrie.update(emojis[i].name, {code: emojis[i].code, types: emojis[i].types, suggestions: node.metaData.suggestions}); | ||
| function createTrie(lang = CONST.LOCALES.DEFAULT) { | ||
| const trie = new Trie(); | ||
| const langEmojis = localeEmojis[lang]; | ||
| const isDefaultLocale = lang === CONST.LOCALES.DEFAULT; | ||
|
|
||
| _.forEach(emojis, (item) => { | ||
| if (item.header) { | ||
| return; | ||
| } | ||
|
|
||
| if (emojis[i].keywords) { | ||
| for (let j = 0; j < emojis[i].keywords.length; j++) { | ||
| const keywordNode = emojisTrie.search(emojis[i].keywords[j]); | ||
| if (!keywordNode) { | ||
| emojisTrie.add(emojis[i].keywords[j], {suggestions: [{code: emojis[i].code, types: emojis[i].types, name: emojis[i].name}]}); | ||
| } else { | ||
| emojisTrie.update(emojis[i].keywords[j], { | ||
| ...keywordNode.metaData, | ||
| suggestions: [...keywordNode.metaData.suggestions, {code: emojis[i].code, types: emojis[i].types, name: emojis[i].name}], | ||
| }); | ||
| } | ||
| const name = isDefaultLocale ? item.name : _.get(langEmojis, [item.code, 'name']); | ||
| const names = isDefaultLocale ? [name] : [...new Set([name, item.name])]; | ||
| _.forEach(names, (nm) => { | ||
| const node = trie.search(nm); | ||
| if (!node) { | ||
| trie.add(nm, {code: item.code, types: item.types, name: nm, suggestions: []}); | ||
| } else { | ||
| trie.update(nm, {code: item.code, types: item.types, name: nm, suggestions: node.metaData.suggestions}); | ||
| } | ||
| }); | ||
|
|
||
| const keywords = _.get(langEmojis, [item.code, 'keywords'], []).concat(isDefaultLocale ? [] : _.get(localeEmojis, [CONST.LOCALES.DEFAULT, item.code, 'keywords'], [])); | ||
| for (let j = 0; j < keywords.length; j++) { | ||
| const keywordNode = trie.search(keywords[j]); | ||
| if (!keywordNode) { | ||
| trie.add(keywords[j], {suggestions: [{code: item.code, types: item.types, name}]}); | ||
| } else { | ||
| trie.update(keywords[j], { | ||
| ...keywordNode.metaData, | ||
| suggestions: [...keywordNode.metaData.suggestions, {code: item.code, types: item.types, name}], | ||
| }); | ||
| } | ||
| } | ||
| } | ||
| }); | ||
|
|
||
| return trie; | ||
| } | ||
|
|
||
| const emojiTrie = _.reduce(supportedLanguages, (prev, cur) => ({...prev, [cur]: createTrie(cur)}), {}); | ||
|
|
||
| Timing.end(CONST.TIMING.TRIE_INITIALIZATION); | ||
|
dummy-1111 marked this conversation as resolved.
|
||
|
|
||
| export default emojisTrie; | ||
| export default emojiTrie; | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.