Skip to content

Commit

Permalink
fix(issue-56): load language
Browse files Browse the repository at this point in the history
  • Loading branch information
cesarwbr committed Mar 25, 2024
1 parent d1059bb commit 28e5f5f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions example/src/ExampleInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ const ExampleInput = () => {
onEnter={text => {
console.log("enter", text);
}}
language="fr"
placeholder="Type a message"
keepOpened
disableRecent
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-input-emoji",
"version": "5.6.7",
"version": "5.6.8",
"description": "A React input with an option to add an emoji with language support.",
"homepage": "https://cesarwbr.github.io/react-input-emoji/",
"author": "cesarwbr",
Expand Down
10 changes: 6 additions & 4 deletions src/components/emoji-picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ function EmojiPicker(props) {
useEffect(() => {
if (!language) {
// @ts-ignore
import(`@emoji-mart/data/i18n/en.json`)
.then(translations => {
fetch(`https://cdn.jsdelivr.net/npm/@emoji-mart/data/i18n/en.json`)
.then(async data => {
const translations = await data.json();
setI18n(translations);
})
.catch(error => {
Expand All @@ -58,8 +59,9 @@ function EmojiPicker(props) {
}

// @ts-ignore
import(`@emoji-mart/data/i18n/${language}.json`)
.then(translations => {
fetch(`https://cdn.jsdelivr.net/npm/@emoji-mart/data/i18n/${language}.json`)
.then(async data => {
const translations = await data.json();
setI18n(translations);
})
.catch(error => {
Expand Down

0 comments on commit 28e5f5f

Please sign in to comment.