|
|
@@ -1,6 +1,7 @@
|
|
|
import React, { FC, useRef, useEffect } from 'react';
|
|
|
+import i18n from 'i18next';
|
|
|
import { Picker } from 'emoji-mart';
|
|
|
-import EmojiPickerHelper, { getEmojiTranslation } from './EmojiPickerHelper';
|
|
|
+import EmojiPickerHelper from './EmojiPickerHelper';
|
|
|
|
|
|
type Props = {
|
|
|
onClose: () => void,
|
|
|
@@ -54,6 +55,46 @@ const EmojiPicker: FC<Props> = (props: Props) => {
|
|
|
props.onClose();
|
|
|
};
|
|
|
|
|
|
+
|
|
|
+ const getEmojiTranslation = () => {
|
|
|
+
|
|
|
+ const categories = {};
|
|
|
+ [
|
|
|
+ 'search',
|
|
|
+ 'recent',
|
|
|
+ 'smileys',
|
|
|
+ 'people',
|
|
|
+ 'nature',
|
|
|
+ 'foods',
|
|
|
+ 'activity',
|
|
|
+ 'places',
|
|
|
+ 'objects',
|
|
|
+ 'symbols',
|
|
|
+ 'flags',
|
|
|
+ 'custom',
|
|
|
+ ].forEach((category) => {
|
|
|
+ categories[category] = i18n.t(`emoji.categories.${category}`);
|
|
|
+ });
|
|
|
+
|
|
|
+ const skintones = {};
|
|
|
+ (Array.from(Array(6).keys())).forEach((tone) => {
|
|
|
+ skintones[tone + 1] = i18n.t(`emoji.skintones.${tone + 1}`);
|
|
|
+ });
|
|
|
+
|
|
|
+ const translation = {
|
|
|
+ search: i18n.t('emoji.search'),
|
|
|
+ clear: i18n.t('emoji.clear'),
|
|
|
+ notfound: i18n.t('emoji.notfound'),
|
|
|
+ skintext: i18n.t('emoji.skintext'),
|
|
|
+ categories,
|
|
|
+ categorieslabel: i18n.t('emoji.categorieslabel'),
|
|
|
+ skintones,
|
|
|
+ title: i18n.t('emoji.title'),
|
|
|
+ };
|
|
|
+
|
|
|
+ return translation;
|
|
|
+ };
|
|
|
+
|
|
|
const translation = getEmojiTranslation();
|
|
|
|
|
|
return (
|