Просмотр исходного кода

Merge pull request #1550 from weseek/imprv/refactor-app-setting

Imprv/refactor app setting
itizawa 6 лет назад
Родитель
Сommit
a7d096a269

+ 38 - 0
resource/locales/en-US/admin/app_setting.json

@@ -0,0 +1,38 @@
+  {
+    "site_name": "Site name",
+    "sitename_change": "You can change Site Name which is used for header and HTML title.",
+    "header_content": "The contents entered here will be shown in the header etc.",
+    "site_url_desc": "This is for the site URL setting.",
+    "site_url_warn": "Some features don't work because the site URL is not set.",
+    "siteurl_help": "Site full URL beginning from <code>http://</code> or <code>https://</code>.",
+    "confidential_name": "Confidential name",
+    "confidential_example": "ex): internal use only",
+    "default_language": "Default Language for new users",
+    "file_uploading": "File Uploading",
+    "enable_files_except_image": "Enable file upload other than image files.",
+    "attach_enable": "You can attach files other than image files if you enable this option.",
+    "update": "Update",
+    "mail_settings": "Mail settings",
+    "smtp_used": "If you have SMTP settings, it will be used.",
+    "smtp_but_aws": "If you do not have SMTP settings but AWS settings,  e-mails will be sent by SES.",
+    "neihter_of": "If you do not of neither of these, e-mails will not be sent.",
+    "from_e-mail_address": "From e-mail address",
+    "smtp_settings": "SMTP settings",
+    "host": "Host",
+    "port": "Port",
+    "user": "User",
+    "aws_settings": "AWS settings",
+    "aws_access": "This is for AWS settings. If you complete AWS settings, file upload function, profile picture function etc will be enabled.",
+    "no_smtp_setting": "If you do not have SMTP settings, e-mails will be sent via SES. You need to verify from e-mail address and production settings.",
+    "change_setting": "Caution:if you change this setting not completed, you will not be able to access files you have uploaded so far.",
+    "region": "Region",
+    "bucket_name": "Bucket name",
+    "custom_endpoint": "Custom endpoint",
+    "custom_endpoint_change": "Input the URL of the endpoint of an object storage service like MinIO that has a S3-compatible API.  Amazon S3 is used if empty.",
+    "plugin_settings": "Plugin settings",
+    "enable_plugin_loading": "Enable plugin loading",
+    "load_plugins": "Load_plugins",
+    "enable": "Enable",
+    "disable": "Disable",
+    "use_env_var_if_empty": "If the value in the database is empty, the value of the environment variable <cod>{{variable}}</code> is used."
+  }

+ 0 - 41
resource/locales/en-US/translation.json

@@ -364,47 +364,6 @@
     "Specified version": "Specified version",
     "Installed version": "Installed version"
   },
-  "app_setting": {
-    "Site Name": "Site name",
-    "sitename_change": "You can change Site Name which is used for header and HTML title.",
-    "header_content": "The contents entered here will be shown in the header etc.",
-    "Site URL desc": "This is for the site URL setting.",
-    "Site URL warn": "Some features don't work because the site URL is not set.",
-    "siteurl_help": "Site full URL beginning from <code>http://</code> or <code>https://</code>.",
-    "Confidential name": "Confidential name",
-    "Default Language for new users": "Default Language for new users",
-    "ex) internal use only": "ex): internal use only",
-    "File Uploading": "File Uploading",
-    "enable_files_except_image": "Enable file upload other than image files.",
-    "attach_enable": "You can attach files other than image files if you enable this option.",
-    "Update": "Update",
-    "Mail settings": "Mail settings",
-    "SMTP_used": "If you have SMTP settings, it will be used.",
-    "SMTP_but_AWS": "If you do not have SMTP settings but AWS settings,  e-mails will be sent by SES.",
-    "neihter_of": "If you do not of neither of these, e-mails will not be sent.",
-    "From e-mail address": "From e-mail address",
-    "SMTP settings": "SMTP settings",
-    "Host": "Host",
-    "Port": "Port",
-    "User": "User",
-    "AWS settings": "AWS settings",
-    "AWS_access": "This is for AWS settings. If you complete AWS settings, file upload function, profile picture function etc will be enabled.",
-    "No_SMTP_setting": "If you do not have SMTP settings, e-mails will be sent via SES. You need to verify from e-mail address and production settings.",
-    "change_setting": "Caution:if you change this setting not completed, you will not be able to access files you have uploaded so far.",
-    "region": "Region",
-    "bucket name": "Bucket name",
-    "custom endpoint": "Custom endpoint",
-    "custom_endpoint_change": "Input the URL of the endpoint of an object storage service like MinIO that has a S3-compatible API.  Amazon S3 is used if empty.",
-    "Plugin settings": "Plugin settings",
-    "Enable plugin loading": "Enable plugin loading",
-    "Load plugins": "Load plugins",
-    "Enable": "Enable",
-    "Disable": "Disable",
-    "Use env var if empty": "If the value in the database is empty, the value of the environment variable <cod>{{variable}}</code> is used.",
-    "updated_app_setting": "Succeeded to update app setting",
-    "updated_site_url": "Succeeded to update site URL",
-    "updated_plugin_setting": "Succeeded to update plugin setting"
-  },
   "security_setting": {
     "Security settings": "Security settings",
     "Guest Users Access": "Guest Users Access",

+ 38 - 0
resource/locales/ja/admin/app_setting.json

@@ -0,0 +1,38 @@
+{
+  "site_name": "サイト名",
+  "sitename_change": "ヘッダーや HTML タイトルに使用されるサイト名を変更できます。",
+  "header_content": "ここに入力した内容は、ヘッダー等に表示されます。",
+  "site_url_desc": "サイトURLを設定します。",
+  "site_url_warn": "サイトURLが設定されていないため、一部機能が動作しない状態になっています。",
+  "siteurl_help": "<code>http://</code> または <code>https://</code> から始まるサイトのURL",
+  "confidential_name": "コンフィデンシャル表示",
+  "confidential_example": "例: 社外秘",
+  "default_language": "新規ユーザーのデフォルト設定言語",
+  "file_uploading": "ファイルアップロード",
+  "enable_files_except_image": "画像以外のファイルアップロードを許可",
+  "attach_enable": "許可をしている場合、画像以外のファイルをページに添付可能になります。",
+  "update": "更新",
+  "mail_settings": "メールの設定",
+  "smtp_used": "SMTPの設定がされている場合、それが利用されます。",
+  "smtp_but_aws": "SMTP設定がなく、AWSの設定がある場合、SESでの送信を試みます。",
+  "neihter_of": "どちらの設定もない場合、メールは送信されません。",
+  "from_e-mail_address": "Fromアドレス",
+  "smtp_settings": "SMTP設定",
+  "host": "ホスト",
+  "port": "ポート",
+  "user": "ユーザー",
+  "aws_settings": "AWS設定",
+  "aws_access": "AWS にアクセスするための設定を行います。AWS の設定を完了させると、ファイルアップロード機能、プロフィール写真機能などが有効になります。",
+  "no_smtp_setting": "また、SMTP の設定が無い場合、SES を利用したメール送信が行われます。FromメールアドレスのVerify、プロダクション利用設定をする必要があります。",
+  "change_setting": "この設定を途中で変更すると、これまでにアップロードしたファイル等へのアクセスができなくなりますのでご注意下さい。",
+  "region": "リージョン",
+  "bucket_name": "バケット名",
+  "custom_endpoint": "カスタムエンドポイント",
+  "custom_endpoint_change": "MinIOなど、S3互換APIを持つ他のオブジェクトストレージサービスを使用する場合のみ、そのエンドポイントのURLを入力してください。空欄の場合は、Amazon S3を使用します。",
+  "plugin_settings": "プラグイン設定",
+  "enable_plugin_loading": "プラグインの読み込みを有効にします。",
+  "load_plugins": "プラグインを読み込む",
+  "enable": "有効",
+  "disable": "無効",
+  "use_env_var_if_empty": "データベース側の値が空の場合、環境変数 <code>{{variable}}</code> の値を利用します"
+}

+ 0 - 41
resource/locales/ja/translation.json

@@ -362,47 +362,6 @@
     "Specified version": "指定バージョン",
     "Installed version": "インストールされているバージョン"
   },
-  "app_setting": {
-    "Site Name": "サイト名",
-    "sitename_change": "ヘッダーや HTML タイトルに使用されるサイト名を変更できます。",
-    "header_content": "ここに入力した内容は、ヘッダー等に表示されます。",
-    "Site URL desc": "サイトURLを設定します。",
-    "Site URL warn": "サイトURLが設定されていないため、一部機能が動作しない状態になっています。",
-    "siteurl_help": "<code>http://</code> または <code>https://</code> から始まるサイトのURL",
-    "Confidential name": "コンフィデンシャル表示",
-    "Default Language for new users": "新規ユーザーのデフォルト設定言語",
-    "ex) internal use only": "例: 社外秘",
-    "File Uploading": "ファイルアップロード",
-    "enable_files_except_image": "画像以外のファイルアップロードを許可",
-    "attach_enable": "許可をしている場合、画像以外のファイルをページに添付可能になります。",
-    "Update": "更新",
-    "Mail settings": "メールの設定",
-    "SMTP_used": "SMTPの設定がされている場合、それが利用されます。",
-    "SMTP_but_AWS": "SMTP設定がなく、AWSの設定がある場合、SESでの送信を試みます。",
-    "neihter_of": "どちらの設定もない場合、メールは送信されません。",
-    "From e-mail address": "Fromアドレス",
-    "SMTP settings": "SMTP設定",
-    "Host": "ホスト",
-    "Port": "ポート",
-    "User": "ユーザー",
-    "AWS settings": "AWS設定",
-    "AWS_access": "AWS にアクセスするための設定を行います。AWS の設定を完了させると、ファイルアップロード機能、プロフィール写真機能などが有効になります。",
-    "No_SMTP_setting": "また、SMTP の設定が無い場合、SES を利用したメール送信が行われます。FromメールアドレスのVerify、プロダクション利用設定をする必要があります。",
-    "change_setting": "この設定を途中で変更すると、これまでにアップロードしたファイル等へのアクセスができなくなりますのでご注意下さい。",
-    "region": "リージョン",
-    "bucket name": "バケット名",
-    "custom endpoint": "カスタムエンドポイント",
-    "custom_endpoint_change": "MinIOなど、S3互換APIを持つ他のオブジェクトストレージサービスを使用する場合のみ、そのエンドポイントのURLを入力してください。空欄の場合は、Amazon S3を使用します。",
-    "Plugin settings": "プラグイン設定",
-    "Enable plugin loading": "プラグインの読み込みを有効にします。",
-    "Load plugins": "プラグインを読み込む",
-    "Enable": "有効",
-    "Disable": "無効",
-    "Use env var if empty": "データベース側の値が空の場合、環境変数 <code>{{variable}}</code> の値を利用します",
-    "updated_app_setting": "アプリ設定を更新しました",
-    "updated_site_url": "サイトURLを更新しました",
-    "updated_plugin_setting": "プラグイン設定を更新しました"
-  },
   "security_setting": {
     "Guest Users Access": "ゲストユーザーのアクセス",
     "Fixed by env var": "環境変数 <code>%s=%s</code> により固定されています。",

+ 11 - 11
src/client/js/components/Admin/App/AppSetting.jsx

@@ -25,7 +25,7 @@ class AppSetting extends React.Component {
 
     try {
       await adminAppContainer.updateAppSettingHandler();
-      toastSuccess(t('app_setting.updated_app_setting'));
+      toastSuccess(t('toaster:update_successed', { target: 'App' }));
     }
     catch (err) {
       toastError(err);
@@ -39,7 +39,7 @@ class AppSetting extends React.Component {
     return (
       <React.Fragment>
         <div className="row md-5">
-          <label className="col-xs-3 control-label">{t('app_setting.Site Name')}</label>
+          <label className="col-xs-3 control-label">{t('app_setting:site_name')}</label>
           <div className="col-xs-6">
             <input
               className="form-control"
@@ -48,26 +48,26 @@ class AppSetting extends React.Component {
               onChange={(e) => { adminAppContainer.changeTitle(e.target.value) }}
               placeholder="GROWI"
             />
-            <p className="help-block">{t('app_setting.sitename_change')}</p>
+            <p className="help-block">{t('app_setting:sitename_change')}</p>
           </div>
         </div>
 
         <div className="row md-5">
-          <label className="col-xs-3 control-label">{t('app_setting.Confidential name')}</label>
+          <label className="col-xs-3 control-label">{t('app_setting:confidential_name')}</label>
           <div className="col-xs-6">
             <input
               className="form-control"
               type="text"
               defaultValue={adminAppContainer.state.confidential}
               onChange={(e) => { adminAppContainer.changeConfidential(e.target.value) }}
-              placeholder={t('app_setting.ex) internal use only')}
+              placeholder={t('app_setting:confidential_example')}
             />
-            <p className="help-block">{t('app_setting.header_content')}</p>
+            <p className="help-block">{t('app_setting:header_content')}</p>
           </div>
         </div>
 
         <div className="row md-5">
-          <label className="col-xs-3 control-label">{t('app_setting.Default Language for new users')}</label>
+          <label className="col-xs-3 control-label">{t('app_setting:default_language')}</label>
           <div className="col-xs-6">
             <div className="radio radio-primary radio-inline">
               <input
@@ -95,7 +95,7 @@ class AppSetting extends React.Component {
         </div>
 
         <div className="row md-5">
-          <label className="col-xs-3 control-label">{t('app_setting.File Uploading')}</label>
+          <label className="col-xs-3 control-label">{t('app_setting:file_uploading')}</label>
           <div className="col-xs-6">
             <div className="checkbox checkbox-info">
               <input
@@ -105,13 +105,13 @@ class AppSetting extends React.Component {
                 checked={adminAppContainer.state.fileUpload}
                 onChange={(e) => { adminAppContainer.changeFileUpload(e.target.checked) }}
               />
-              <label htmlFor="cbFileUpload">{t('app_setting.enable_files_except_image')}</label>
+              <label htmlFor="cbFileUpload">{t('app_setting:enable_files_except_image')}</label>
             </div>
 
             <p className="help-block">
-              {t('app_setting.enable_files_except_image')}
+              {t('app_setting:enable_files_except_image')}
               <br />
-              {t('app_setting.attach_enable')}
+              {t('app_setting:attach_enable')}
             </p>
           </div>
         </div>

+ 3 - 3
src/client/js/components/Admin/App/AppSettingsPage.jsx

@@ -53,21 +53,21 @@ class AppSettingsPage extends React.Component {
 
         <div className="row">
           <div className="col-md-12">
-            <h2>{t('app_setting.Mail settings')}</h2>
+            <h2>{t('app_setting:mail_settings')}</h2>
             <MailSetting />
           </div>
         </div>
 
         <div className="row">
           <div className="col-md-12">
-            <h2>{t('app_setting.AWS settings')}</h2>
+            <h2>{t('app_setting:aws_settings')}</h2>
             <AwsSetting />
           </div>
         </div>
 
         <div className="row">
           <div className="col-md-12">
-            <h2>{t('app_setting.Plugin settings')}</h2>
+            <h2>{t('app_setting:plugin_settings')}</h2>
             <PluginSetting />
           </div>
         </div>

+ 8 - 8
src/client/js/components/Admin/App/AwsSetting.jsx

@@ -25,7 +25,7 @@ class AwsSetting extends React.Component {
 
     try {
       await adminAppContainer.updateAwsSettingHandler();
-      toastSuccess(t('app_setting.updated_app_setting'));
+      toastSuccess(t('toaster:update_successed', { target: 'AWS' }));
     }
     catch (err) {
       toastError(err);
@@ -39,20 +39,20 @@ class AwsSetting extends React.Component {
     return (
       <React.Fragment>
         <p className="well">
-          {t('app_setting.AWS_access')}
+          {t('app_setting:aws_access')}
           <br />
-          {t('app_setting.No_SMTP_setting')}
+          {t('app_setting:no_smtp_setting')}
           <br />
           <br />
           <span className="text-danger">
             <i className="ti-unlink"></i>
-            {t('app_setting.change_setting')}
+            {t('app_setting:change_setting')}
           </span>
         </p>
 
         <div className="row mb-5">
           <label className="col-xs-3 control-label">
-            {t('app_setting.region')}
+            {t('app_setting:region')}
           </label>
           <div className="col-xs-6">
             <input
@@ -68,7 +68,7 @@ class AwsSetting extends React.Component {
 
         <div className="row mb-5">
           <label className="col-xs-3 control-label">
-            {t('app_setting.custom endpoint')}
+            {t('app_setting:custom_endpoint')}
           </label>
           <div className="col-xs-6">
             <input
@@ -80,13 +80,13 @@ class AwsSetting extends React.Component {
                 adminAppContainer.changeCustomEndpoint(e.target.value);
               }}
             />
-            <p className="help-block">{t('app_setting.custom_endpoint_change')}</p>
+            <p className="help-block">{t('app_setting:custom_endpoint_change')}</p>
           </div>
         </div>
 
         <div className="row mb-5">
           <label className="col-xs-3 control-label">
-            {t('app_setting.bucket name')}
+            {t('app_setting:bucket_name')}
           </label>
           <div className="col-xs-6">
             <input

+ 8 - 8
src/client/js/components/Admin/App/MailSetting.jsx

@@ -25,7 +25,7 @@ class MailSetting extends React.Component {
 
     try {
       await adminAppContainer.updateMailSettingHandler();
-      toastSuccess(t('app_setting.updated_app_setting'));
+      toastSuccess(t('toster.update_successed', { target: 'Mail' }));
     }
     catch (err) {
       toastError(err);
@@ -38,9 +38,9 @@ class MailSetting extends React.Component {
 
     return (
       <React.Fragment>
-        <p className="well">{t('app_setting.SMTP_used')} {t('app_setting.SMTP_but_AWS')}<br />{t('app_setting.neihter_of')}</p>
+        <p className="well">{t('app_setting:smtp_used')} {t('app_setting:smtp_but_aws')}<br />{t('app_setting:neihter_of')}</p>
         <div className="row mb-5">
-          <label className="col-xs-3 control-label">{t('app_setting.From e-mail address')}</label>
+          <label className="col-xs-3 control-label">{t('app_setting:from_e-mail_address')}</label>
           <div className="col-xs-6">
             <input
               className="form-control"
@@ -53,9 +53,9 @@ class MailSetting extends React.Component {
         </div>
 
         <div className="row mb-5">
-          <label className="col-xs-3 control-label">{ t('app_setting.SMTP settings') }</label>
+          <label className="col-xs-3 control-label">{t('app_setting:smtp_settings')}</label>
           <div className="col-xs-4">
-            <label>{ t('app_setting.Host') }</label>
+            <label>{t('app_setting:host')}</label>
             <input
               className="form-control"
               type="text"
@@ -64,7 +64,7 @@ class MailSetting extends React.Component {
             />
           </div>
           <div className="col-xs-2">
-            <label>{ t('app_setting.Port') }</label>
+            <label>{t('app_setting:port')}</label>
             <input
               className="form-control"
               defaultValue={adminAppContainer.state.smtpPort}
@@ -75,7 +75,7 @@ class MailSetting extends React.Component {
 
         <div className="row mb-5">
           <div className="col-xs-3 col-xs-offset-3">
-            <label>{ t('app_setting.User') }</label>
+            <label>{t('app_setting:user')}</label>
             <input
               className="form-control"
               type="text"
@@ -84,7 +84,7 @@ class MailSetting extends React.Component {
             />
           </div>
           <div className="col-xs-3">
-            <label>{ t('Password') }</label>
+            <label>{t('Password')}</label>
             <input
               className="form-control"
               type="password"

+ 3 - 3
src/client/js/components/Admin/App/PluginSetting.jsx

@@ -26,7 +26,7 @@ class PluginSetting extends React.Component {
 
     try {
       await adminAppContainer.updatePluginSettingHandler();
-      toastSuccess(t('app_setting.updated_plugin_setting'));
+      toastSuccess(t('toaster:update_successed', { target: 'Plugin' }));
     }
     catch (err) {
       toastError(err);
@@ -39,7 +39,7 @@ class PluginSetting extends React.Component {
 
     return (
       <React.Fragment>
-        <p className="well">{t('app_setting.Enable plugin loading')}</p>
+        <p className="well">{t('app_setting:enable_plugin_loading')}</p>
 
         <div className="row mb-5">
           <div className="col-xs-offset-3 col-xs-6 text-left">
@@ -52,7 +52,7 @@ class PluginSetting extends React.Component {
                   adminAppContainer.changeIsEnabledPlugins(e.target.checked);
                 }}
               />
-              <label htmlFor="isEnabledPlugins">{t('app_setting.Load plugins')}</label>
+              <label htmlFor="isEnabledPlugins">{t('app_setting:load_plugins')}</label>
             </div>
           </div>
         </div>

+ 5 - 5
src/client/js/components/Admin/App/SiteUrlSetting.jsx

@@ -25,7 +25,7 @@ class SiteUrlSetting extends React.Component {
 
     try {
       await adminAppContainer.updateSiteUrlSettingHandler();
-      toastSuccess(t('app_setting.updated_site_url'));
+      toastSuccess(t('toaster:update_successed', { target: 'URL' }));
     }
     catch (err) {
       toastError(err);
@@ -38,8 +38,8 @@ class SiteUrlSetting extends React.Component {
 
     return (
       <React.Fragment>
-        <p className="well">{t('app_setting.Site URL desc')}</p>
-        {!adminAppContainer.state.isSetSiteUrl && (<p className="alert alert-danger"><i className="icon-exclamation"></i> {t('app_setting.Site URL warn')}</p>)}
+        <p className="well">{t('app_setting:site_url_desc')}</p>
+        {!adminAppContainer.state.isSetSiteUrl && (<p className="alert alert-danger"><i className="icon-exclamation"></i> {t('app_setting:site_url_warn')}</p>)}
 
         <div className="row">
           <div className="col-md-12">
@@ -68,14 +68,14 @@ class SiteUrlSetting extends React.Component {
                       />
                       <p className="help-block">
                         {/* eslint-disable-next-line react/no-danger */}
-                        <div dangerouslySetInnerHTML={{ __html: t('app_setting.siteurl_help') }} />
+                        <div dangerouslySetInnerHTML={{ __html: t('app_setting:siteurl_help') }} />
                       </p>
                     </td>
                     <td>
                       <input className="form-control" type="text" value={adminAppContainer.state.envSiteUrl} readOnly />
                       <p className="help-block">
                         {/* eslint-disable-next-line react/no-danger */}
-                        <div dangerouslySetInnerHTML={{ __html: t('app_setting.Use env var if empty', { variable: 'APP_SITE_URL' }) }} />
+                        <div dangerouslySetInnerHTML={{ __html: t('app_setting:use_env_var_if_empty', { variable: 'APP_SITE_URL' }) }} />
                       </p>
                     </td>
                   </tr>