Quellcode durchsuchen

translate exception pages

张秀玲 vor 7 Jahren
Ursprung
Commit
ac4dfc124b
5 geänderte Dateien mit 56 neuen und 12 gelöschten Zeilen
  1. 4 0
      src/locales/en-US.js
  2. 4 0
      src/locales/zh-CN.js
  3. 16 4
      src/pages/Exception/403.js
  4. 16 4
      src/pages/Exception/404.js
  5. 16 4
      src/pages/Exception/500.js

+ 4 - 0
src/locales/en-US.js

@@ -121,4 +121,8 @@ export default {
     'The to-do list will be notified in the form of a letter from the station',
   'app.settings.open': 'Open',
   'app.settings.close': 'Close',
+  'app.exception.back': 'Back to home',
+  'app.exception.description.403': "Sorry, you don't have access to this page",
+  'app.exception.description.404': 'Sorry, the page you visited does not exist',
+  'app.exception.description.500': 'Sorry, the server is reporting an error',
 };

+ 4 - 0
src/locales/zh-CN.js

@@ -117,4 +117,8 @@ export default {
   'app.settings.notification.todo-description': '账户密码',
   'app.settings.open': '开',
   'app.settings.close': '关',
+  'app.exception.back': '返回首页',
+  'app.exception.description.403': '抱歉,你无权访问该页面',
+  'app.exception.description.404': '抱歉,你访问的页面不存在',
+  'app.exception.description.500': '抱歉,服务器出错了',
 };

+ 16 - 4
src/pages/Exception/403.js

@@ -1,7 +1,19 @@
-import React from 'react';
+import React, { Component } from 'react';
+import { injectIntl } from 'react-intl';
 import { Link } from 'dva/router';
 import Exception from 'components/Exception';
 
-export default () => (
-  <Exception type="403" style={{ minHeight: 500, height: '80%' }} linkElement={Link} />
-);
+class Exception403 extends Component {
+  render() {
+    const { intl } = this.props;
+    return (
+      <Exception
+        type="403"
+        desc={intl.formatMessage({ id: 'app.exception.description.403' }, {})}
+        style={{ minHeight: 500, height: '80%' }}
+        linkElement={Link}
+      />
+    );
+  }
+}
+export default injectIntl(Exception403);

+ 16 - 4
src/pages/Exception/404.js

@@ -1,7 +1,19 @@
-import React from 'react';
+import React, { Component } from 'react';
+import { injectIntl } from 'react-intl';
 import { Link } from 'dva/router';
 import Exception from 'components/Exception';
 
-export default () => (
-  <Exception type="404" style={{ minHeight: 500, height: '80%' }} linkElement={Link} />
-);
+class Exception404 extends Component {
+  render() {
+    const { intl } = this.props;
+    return (
+      <Exception
+        type="404"
+        desc={intl.formatMessage({ id: 'app.exception.description.404' }, {})}
+        style={{ minHeight: 500, height: '80%' }}
+        linkElement={Link}
+      />
+    );
+  }
+}
+export default injectIntl(Exception404);

+ 16 - 4
src/pages/Exception/500.js

@@ -1,7 +1,19 @@
-import React from 'react';
+import React, { Component } from 'react';
+import { injectIntl } from 'react-intl';
 import { Link } from 'dva/router';
 import Exception from 'components/Exception';
 
-export default () => (
-  <Exception type="500" style={{ minHeight: 500, height: '80%' }} linkElement={Link} />
-);
+class Exception500 extends Component {
+  render() {
+    const { intl } = this.props;
+    return (
+      <Exception
+        type="500"
+        desc={intl.formatMessage({ id: 'app.exception.description.500' }, {})}
+        style={{ minHeight: 500, height: '80%' }}
+        linkElement={Link}
+      />
+    );
+  }
+}
+export default injectIntl(Exception500);