2
0
Эх сурвалжийг харах

Added localization support for copy modal

Steven Fukase 5 жил өмнө
parent
commit
81a2e6d906

+ 1 - 0
resource/locales/en_US/admin/admin.json

@@ -254,6 +254,7 @@
   },
   },
   "slack_integration": {
   "slack_integration": {
     "bot_reset_successful": "Bot settings have been reset.",
     "bot_reset_successful": "Bot settings have been reset.",
+    "copied_to_clipboard": "Copied to clipboard",
     "modal": {
     "modal": {
       "warning": "Warning",
       "warning": "Warning",
       "sure_change_bot_type": "Are you sure you want to change the bot type?",
       "sure_change_bot_type": "Are you sure you want to change the bot type?",

+ 1 - 0
resource/locales/ja_JP/admin/admin.json

@@ -252,6 +252,7 @@
   },
   },
   "slack_integration": {
   "slack_integration": {
     "bot_reset_successful": "Botの設定を消去しました。",
     "bot_reset_successful": "Botの設定を消去しました。",
+    "copied_to_clipboard": "クリップボードにコピーされました。",
     "modal": {
     "modal": {
       "warning": "注意",
       "warning": "注意",
       "sure_change_bot_type": "Botの種類を変更しますか?",
       "sure_change_bot_type": "Botの種類を変更しますか?",

+ 1 - 0
resource/locales/zh_CN/admin/admin.json

@@ -262,6 +262,7 @@
   },
   },
   "slack_integration": {
   "slack_integration": {
     "bot_reset_successful": "删除了BOT设置。",
     "bot_reset_successful": "删除了BOT设置。",
+    "copied_to_clipboard": "它已复制到剪贴板。",
     "modal": {
     "modal": {
       "warning": "警告",
       "warning": "警告",
       "sure_change_bot_type": "您确定要更改设置吗?",
       "sure_change_bot_type": "您确定要更改设置吗?",

+ 5 - 3
src/client/js/components/Admin/SlackIntegration/AccessTokenSettings.jsx

@@ -25,16 +25,18 @@ const AccessTokenSettings = (props) => {
     try {
     try {
       const res = await appContainer.apiv3.put('slack-integration/access-token', { deleteAccessToken: true });
       const res = await appContainer.apiv3.put('slack-integration/access-token', { deleteAccessToken: true });
       setAccessToken(res.data.accessToken);
       setAccessToken(res.data.accessToken);
+      toastSuccess(t('slack_integration.bot_reset_successful'));
     }
     }
     catch (err) {
     catch (err) {
       toastError(err);
       toastError(err);
     }
     }
   };
   };
 
 
-  const textboxClickHandler = () => {
+  const textboxClickHandler = (e) => {
+    e.target.select();
     if (accessToken) {
     if (accessToken) {
       navigator.clipboard.writeText(accessToken)
       navigator.clipboard.writeText(accessToken)
-        .then(() => { toastSuccess('Copied to clipboard') });
+        .then(() => { toastSuccess('slack_integration.copied_to_clipboard') });
     }
     }
 
 
   };
   };
@@ -48,7 +50,7 @@ const AccessTokenSettings = (props) => {
         <div className="form-group row my-5">
         <div className="form-group row my-5">
           <label className="text-left text-md-right col-md-3 col-form-label">Access Token</label>
           <label className="text-left text-md-right col-md-3 col-form-label">Access Token</label>
           <div className="col-md-6">
           <div className="col-md-6">
-            <input className="form-control" type="text" value={accessToken} onClick={textboxClickHandler} readOnly />
+            <input className="form-control" type="text" value={accessToken} onClick={e => textboxClickHandler(e)} readOnly />
           </div>
           </div>
         </div>
         </div>