Yuki Takei 6 лет назад
Родитель
Сommit
80987a1569

+ 6 - 1
resource/locales/en-US/translation.json

@@ -758,7 +758,12 @@
       "extracted_file": "Extracted File",
       "collection": "Collection",
       "upload": "Upload",
-      "discard": "Discard Uploaded Data"
+      "discard": "Discard Uploaded Data",
+      "errors": {
+        "at_least_one": "Select one or more collections.",
+        "page_and_revision": "'Pages' and 'Revisions' must be imported both.",
+        "depends": "'{{target}}' must be selected when '{{condition}}' is selected."
+      }
     },
     "esa_settings": {
       "team_name": "Team name",

+ 6 - 1
resource/locales/ja/translation.json

@@ -743,7 +743,12 @@
       "extracted_file": "展開されたファイル",
       "collection": "コレクション",
       "upload": "アップロード",
-      "discard": "アップロードしたデータを破棄する"
+      "discard": "アップロードしたデータを破棄する",
+      "errors": {
+        "at_least_one": "コレクションが選択されていません",
+        "page_and_revision": "'Pages' と 'Revisions' はセットでインポートする必要があります",
+        "depends": "'{{condition}}' をインポートする場合は、'{{target}}' を一緒に選択する必要があります"
+      }
     },
     "esa_settings": {
       "team_name": "チーム名",

+ 13 - 8
src/client/js/components/Admin/Import/GrowiZipImportForm.jsx

@@ -113,16 +113,18 @@ class GrowiImportForm extends React.Component {
   }
 
   async validateCollectionSize(validationErrors) {
+    const { t } = this.props;
     const { errorsForOtherGroups, selectedCollections } = this.state;
 
     if (selectedCollections.size === 0) {
-      errorsForOtherGroups.push('select collections at least one');
+      errorsForOtherGroups.push(t('importer_management.growi_settings.errors.at_least_one'));
     }
 
     this.setState({ errorsForOtherGroups });
   }
 
   async validatePagesCollectionPairs() {
+    const { t } = this.props;
     const { errorsForPageGroups, selectedCollections } = this.state;
 
     const pageRelatedCollectionsLength = ['pages', 'revisions'].filter((collectionName) => {
@@ -131,19 +133,20 @@ class GrowiImportForm extends React.Component {
 
     // MUST be included both or neither when importing
     if (pageRelatedCollectionsLength !== 0 && pageRelatedCollectionsLength !== 2) {
-      errorsForPageGroups.push('pages and revisions must be paried');
+      errorsForPageGroups.push(t('importer_management.growi_settings.errors.page_and_revision'));
     }
 
     this.setState({ errorsForPageGroups });
   }
 
   async validateExternalAccounts() {
+    const { t } = this.props;
     const { errorsForUserGroups, selectedCollections } = this.state;
 
     // MUST include also 'users' if 'externalaccounts' is selected
     if (selectedCollections.has('externalaccounts')) {
       if (!selectedCollections.has('users')) {
-        errorsForUserGroups.push('must include users when including externalaccounts');
+        errorsForUserGroups.push(t('importer_management.growi_settings.errors.depends', { target: 'Users', condition: 'Externalaccounts' }));
       }
     }
 
@@ -151,12 +154,13 @@ class GrowiImportForm extends React.Component {
   }
 
   async validateUserGroups() {
+    const { t } = this.props;
     const { errorsForUserGroups, selectedCollections } = this.state;
 
     // MUST include also 'users' if 'usergroups' is selected
     if (selectedCollections.has('usergroups')) {
       if (!selectedCollections.has('users')) {
-        errorsForUserGroups.push('must include users when including usergroups');
+        errorsForUserGroups.push(t('importer_management.growi_settings.errors.depends', { target: 'Users', condition: 'Usergroups' }));
       }
     }
 
@@ -164,12 +168,13 @@ class GrowiImportForm extends React.Component {
   }
 
   async validateUserGroupRelations() {
+    const { t } = this.props;
     const { errorsForUserGroups, selectedCollections } = this.state;
 
     // MUST include also 'usergroups' if 'usergrouprelations' is selected
     if (selectedCollections.has('usergrouprelations')) {
       if (!selectedCollections.has('usergroups')) {
-        errorsForUserGroups.push('must include usergroups when including usergrouprelations');
+        errorsForUserGroups.push(t('importer_management.growi_settings.errors.depends', { target: 'Usergroups', condition: 'Usergrouprelations' }));
       }
     }
 
@@ -329,12 +334,12 @@ class GrowiImportForm extends React.Component {
         </div>
 
         <div className="mt-5 text-center">
-          <button type="button" className="btn btn-primary mx-1" onClick={this.import} disabled={!this.state.canImport}>
-            { t('importer_management.import') }
-          </button>
           <button type="button" className="btn btn-default mx-1" onClick={this.props.onDiscard}>
             { t('importer_management.growi_settings.discard') }
           </button>
+          <button type="button" className="btn btn-primary mx-1" onClick={this.import} disabled={!this.state.canImport}>
+            { t('importer_management.import') }
+          </button>
         </div>
       </>
     );