diff --git a/Gruntfile.js b/Gruntfile.js
index 2aed5cbd..97a52148 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -19,7 +19,7 @@ module.exports = function (grunt) {
src: ['src/**/*.{jsx,js}'],
dest: 'src',
options: {
- lngs: ['en', 'zh'],
+ lngs: ['en', 'zh', 'ko-kr'],
removeUnusedKeys: true,
sort: true,
keySeparator: false,
@@ -39,10 +39,10 @@ module.exports = function (grunt) {
extensions: ['.js', '.jsx'],
},
defaultValue: (lng, ns, key) => {
- if (lng === 'zh') {
- return '';
+ if (lng === 'en') {
+ return key;
}
- return key;
+ return '';
},
},
},
diff --git a/releasenotes/notes/Support-Korean-I18n-6f258836f7b30db9.yaml b/releasenotes/notes/Support-Korean-I18n-6f258836f7b30db9.yaml
new file mode 100644
index 00000000..1722b73a
--- /dev/null
+++ b/releasenotes/notes/Support-Korean-I18n-6f258836f7b30db9.yaml
@@ -0,0 +1,10 @@
+---
+features:
+ - |
+ Support Korean I18n:
+
+ * Korean language switching is supported on the login page.
+
+ * Support switch Korean in the avatar hover box on the upper right of the page after logged in.
+
+ * Support automatic collection of Korean i18n file.
diff --git a/src/components/Layout/GlobalHeader/AvatarDropdown.jsx b/src/components/Layout/GlobalHeader/AvatarDropdown.jsx
index 080fa2c7..7f7be8c6 100644
--- a/src/components/Layout/GlobalHeader/AvatarDropdown.jsx
+++ b/src/components/Layout/GlobalHeader/AvatarDropdown.jsx
@@ -14,7 +14,7 @@
import React from 'react';
import { inject, observer } from 'mobx-react';
-import { Menu, Spin, Button } from 'antd';
+import { Menu, Spin, Button, Select } from 'antd';
import { UserOutlined } from '@ant-design/icons';
import i18n from 'core/i18n';
import ItemActionButtons from 'components/Tables/Base/ItemActionButtons';
@@ -24,7 +24,7 @@ import OpenRc from './OpenRc';
import HeaderDropdown from '../HeaderDropdown';
import styles from './index.less';
-const { getLocale, setLocale } = i18n;
+const { getLocale, setLocale, SUPPORT_LOCALES } = i18n;
export class AvatarDropdown extends React.Component {
get rootStore() {
@@ -58,6 +58,51 @@ export class AvatarDropdown extends React.Component {
}
};
+ onClickSelectLanguage = (e) => {
+ e && e.preventDefault();
+ e && e.stopPropagation();
+ };
+
+ renderLanguageSwitch() {
+ const selectedLang = getLocale();
+ const { length } = SUPPORT_LOCALES;
+ if (length > 3) {
+ const options = SUPPORT_LOCALES.map((it) => ({
+ label: it.shortName.toLocaleUpperCase(),
+ value: it.value,
+ }));
+ return (
+
+
+
+ );
+ }
+ const btns = SUPPORT_LOCALES.map((item, index) => {
+ const { value, shortName } = item;
+ return (
+ <>
+
+ {index !== length - 1 && /}
+ >
+ );
+ });
+ return {btns};
+ }
+
render() {
if (!this.user) {
return (
@@ -71,7 +116,6 @@ export class AvatarDropdown extends React.Component {
);
}
const { name: username } = this.user.user;
- const selectedLang = getLocale();
// const { selectedLang } = this.state.selectedLang;
const menuHeaderDropdown = (