Shun Miyazawa 1 rok temu
rodzic
commit
a5d6a395d5

+ 14 - 0
apps/app/public/static/locales/en_US/translation.json

@@ -513,6 +513,20 @@
       "owner": "All pages accessible by {{username}}",
       "groups": "Specify groups",
       "publicOnly": "Public pages only"
+    },
+    "share_scope": {
+      "publicOnly": {
+        "label": "Public",
+        "desc": "Shared with all users"
+      },
+      "groups": {
+        "label": "Specify groups",
+        "desc": "Shared only with members of selected groups"
+      },
+      "sameAsAccessScope": {
+        "label": "Same as page access scope",
+        "desc": "Shared with the same scope as page access"
+      }
     }
   },
   "link_edit": {

+ 14 - 0
apps/app/public/static/locales/fr_FR/translation.json

@@ -508,6 +508,20 @@
       "owner": "Toutes les pages accessibles par {{username}}",
       "groups": "Spécifier les groupes",
       "publicOnly": "Pages publiques uniquement"
+    },
+    "share_scope": {
+      "publicOnly": {
+        "label": "Public",
+        "desc": "Partagé avec tous les utilisateurs"
+      },
+      "groups": {
+        "label": "Spécifier les groupes",
+        "desc": "Partagé uniquement avec les membres des groupes sélectionnés"
+      },
+      "sameAsAccessScope": {
+        "label": "Même portée que l'accès à la page",
+        "desc": "Partagé avec la même portée que l'accès à la page"
+      }
     }
   },
   "link_edit": {

+ 14 - 0
apps/app/public/static/locales/ja_JP/translation.json

@@ -546,6 +546,20 @@
       "owner": "{{username}} がアクセス可能な全てのページ",
       "groups": "グループを指定",
       "publicOnly": "公開ページのみ"
+    },
+    "share_scope": {
+      "publicOnly": {
+        "label": "全体公開",
+        "desc": "すべてのユーザーに共有されます"
+      },
+      "groups": {
+        "label": "グループを指定",
+        "desc": "選択したグループのメンバーにのみ共有されます"
+      },
+      "sameAsAccessScope": {
+        "label": "ページのアクセス権限と同じ範囲",
+        "desc": "ページのアクセス権限と同じ範囲で共有されます"
+      }
     }
   },
   "link_edit": {

+ 14 - 0
apps/app/public/static/locales/zh_CN/translation.json

@@ -502,6 +502,20 @@
       "owner": "{{username}} 可访问的所有页面",
       "groups": "指定群组",
       "publicOnly": "仅公开页面"
+    },
+    "share_scope": {
+      "publicOnly": {
+        "label": "公开",
+        "desc": "与所有用户共享"
+      },
+      "groups": {
+        "label": "指定群组",
+        "desc": "仅与选定组的成员共享"
+      },
+      "sameAsAccessScope": {
+        "label": "与页面访问范围相同",
+        "desc": "与页面访问范围相同的范围共享"
+      }
     }
   },
   "link_edit": {

+ 21 - 46
apps/app/src/features/openai/client/components/AiAssistant/AiAssistantManagementModal/ShareScopeSwitch.tsx

@@ -1,5 +1,6 @@
 import React, { useCallback, useState } from 'react';
 
+import { useTranslation } from 'react-i18next';
 import {
   Input, Label, FormGroup,
 } from 'reactstrap';
@@ -31,6 +32,9 @@ export const ShareScopeSwitch: React.FC<Props> = (props: Props) => {
     selectedAccessScope,
     onSelect,
   } = props;
+
+  const { t } = useTranslation();
+
   const [selectedScope, setSelectedScope] = useState<ShareScopeSwitchType>(ShareScopeSwitchType.SAME_AS_ACCESS_SCOPE);
 
   const checkShareScopeRadioHandler = useCallback((shareScope: ShareScopeSwitchType) => {
@@ -48,53 +52,24 @@ export const ShareScopeSwitch: React.FC<Props> = (props: Props) => {
     <div className="mb-4">
       <Label className="text-secondary mb-3">アシスタントの共有範囲</Label>
       <div className="d-flex flex-column gap-3">
-        <FormGroup check>
-          <Input
-            type="radio"
-            name="shareScope"
-            id="shareAll"
-            className="form-check-input"
-            disabled={isDisabled}
-            onChange={() => checkShareScopeRadioHandler(ShareScopeSwitchType.PUBLIC_ONLY)}
-            checked={selectedScope === ShareScopeSwitchType.PUBLIC_ONLY}
-          />
-          <Label check for="shareAll" className="d-flex flex-column">
-            <span>全体公開</span>
-            <small className="text-secondary">全てのユーザーに共有されます</small>
-          </Label>
-        </FormGroup>
-
-        <FormGroup check>
-          <Input
-            type="radio"
-            name="shareScope"
-            id="shareGroup"
-            className="form-check-input"
-            disabled={isDisabled}
-            onChange={() => checkShareScopeRadioHandler(ShareScopeSwitchType.GROUPS)}
-            checked={selectedScope === ShareScopeSwitchType.GROUPS}
-          />
-          <Label check for="shareGroup" className="d-flex flex-column">
-            <span>グループを指定</span>
-            <small className="text-secondary">選択したグループのメンバーにのみ共有されます</small>
-          </Label>
-        </FormGroup>
 
-        <FormGroup check>
-          <Input
-            type="radio"
-            name="shareScope"
-            id="shareAccess"
-            className="form-check-input"
-            disabled={isDisabled}
-            onChange={() => checkShareScopeRadioHandler(ShareScopeSwitchType.SAME_AS_ACCESS_SCOPE)}
-            checked={selectedScope === ShareScopeSwitchType.SAME_AS_ACCESS_SCOPE}
-          />
-          <Label check for="shareAccess" className="d-flex flex-column">
-            <span>ページのアクセス権限と同じ範囲</span>
-            <small className="text-secondary">ページのアクセス権限と同じ範囲で共有されます</small>
-          </Label>
-        </FormGroup>
+        {[ShareScopeSwitchType.PUBLIC_ONLY, ShareScopeSwitchType.GROUPS, ShareScopeSwitchType.SAME_AS_ACCESS_SCOPE].map(shareScope => (
+          <FormGroup check key={shareScope}>
+            <Input
+              type="radio"
+              name="shareScope"
+              id="shareGroup"
+              className="form-check-input"
+              disabled={isDisabled}
+              onChange={() => checkShareScopeRadioHandler(shareScope)}
+              checked={selectedScope === shareScope}
+            />
+            <Label check for="shareGroup" className="d-flex flex-column">
+              <span>{t(`modal_ai_assistant.share_scope.${shareScope}.label`)}</span>
+              <small className="text-secondary">{t(`modal_ai_assistant.share_scope.${shareScope}.desc`)}</small>
+            </Label>
+          </FormGroup>
+        ))}
       </div>
     </div>
   );