feat(i18n): enhanced i18n support (#3761)
This commit is contained in:
1 parent
5a5c4f58af
commit
d14a8f0199
55 files changed
+319
-114
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import React, { useState, useRef, useEffect } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import PropTypes from 'prop-types';
|
||||
import classnames from 'classnames';
|
||||
|
||||
@@ -9,6 +10,8 @@ const DELAY_TO_HIDE = 10; // it needs at least a little delay to prevent tooltip
|
||||
const DELAY_TO_HIDE_AFTER_COPYING = 1000;
|
||||
|
||||
const TooltipClipboard = ({ children, text }) => {
|
||||
const { t } = useTranslation('TooltipClipboard');
|
||||
|
||||
const [isActive, setIsActive] = useState(false);
|
||||
const [message, setMessage] = useState(null);
|
||||
const [isCopying, setIsCopying] = useState(false);
|
||||
@@ -21,10 +24,10 @@ const TooltipClipboard = ({ children, text }) => {
|
||||
setIsCopying(true);
|
||||
try {
|
||||
await navigator.clipboard.writeText(text);
|
||||
setMessage('Copied!');
|
||||
setMessage(t('Copied'));
|
||||
} catch (err) {
|
||||
console.error('Failed to copy: ', err);
|
||||
setMessage('Failed to copy!');
|
||||
setMessage(t('Failed to copy'));
|
||||
} finally {
|
||||
refreshElementPosition();
|
||||
|
||||
|
||||
Reference in new issue
Block a user