Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Commit

Permalink
Using intl on a few more example pages to help with internationalizat…
Browse files Browse the repository at this point in the history
…ion (#568)
  • Loading branch information
scouttyg authored Jul 18, 2020
1 parent 814ba3d commit 28cfeb2
Show file tree
Hide file tree
Showing 14 changed files with 46 additions and 28 deletions.
4 changes: 2 additions & 2 deletions example/src/components/RightContent/AvatarDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useCallback } from 'react';
import { LogoutOutlined, SettingOutlined, UserOutlined } from '@ant-design/icons';
import { Avatar, Menu, Spin } from 'antd';
import { ClickParam } from 'antd/es/menu';
import { history, useModel } from 'umi';
import { history, useIntl, useModel } from 'umi';
import { getPageQuery } from '@/utils/utils';
import { outLogin } from '@/services/login';

Expand Down Expand Up @@ -84,7 +84,7 @@ const AvatarDropdown: React.FC<GlobalHeaderRightProps> = ({ menu }) => {

<Menu.Item key="logout">
<LogoutOutlined />
退出登录
{useIntl().formatMessage({ id: 'menu.account.logout' })}
</Menu.Item>
</Menu>
);
Expand Down
3 changes: 2 additions & 1 deletion example/src/components/RightContent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useModel, SelectLang } from 'umi';
import Avatar from './AvatarDropdown';
import HeaderSearch from '../HeaderSearch';
import styles from './index.less';
import { useIntl } from 'umi';

export type SiderTheme = 'light' | 'dark';

Expand Down Expand Up @@ -52,7 +53,7 @@ const GlobalHeaderRight: React.FC<{}> = () => {
// //console.log('input', value);
// }}
/>
<Tooltip title="使用文档">
<Tooltip title={useIntl().formatMessage({ id: 'component.globalHeader.help' })}>
<span
className={styles.action}
onClick={() => {
Expand Down
6 changes: 4 additions & 2 deletions example/src/locales/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ export default {
'layout.user.link.privacy': 'Privacy',
'layout.user.link.terms': 'Terms',
'app.preview.down.block': 'Download this page to your local project',
'app.welcome.link.fetch-blocks': 'Get all block',
'app.welcome.link.block-list': 'Quickly build standard, pages based on `block` development',
'app.alert.umi-ui-available': 'umi ui is now available, click the umi icon in the lower right corner to use it',
'app.alert.umi-ui-released': 'umi ui has been released, run `npm run ui` to try it out.',
'app.welcome.link.fetch-blocks': 'Fetch all blocks',
'app.welcome.link.block-list': 'Quickly build pages based on `block` development',
...globalHeader,
...menu,
...settingDrawer,
Expand Down
7 changes: 6 additions & 1 deletion example/src/locales/en-US/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ export default {
'menu.more-blocks': 'More Blocks',
'menu.home': 'Home',
'menu.admin': 'Admin',
'menu.admin.sub-page': 'Sub-Page',
'menu.admin.sub-page': 'Subpage',
'menu.admin.sub-page2': 'Subpage 2',
'menu.admin.sub-page3': 'Subpage 3',
'menu.list.table-list.sub-page': 'Subpage',
'menu.list.table-list.sub-page2': 'Subpage 2',
'menu.list.table-list.sub-page3': 'Subpage 3',
'menu.login': 'Login',
'menu.register': 'Register',
'menu.register.result': 'Register Result',
Expand Down
2 changes: 1 addition & 1 deletion example/src/locales/en-US/settingDrawer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default {
'app.setting.themecolor.cyan': 'Cyan',
'app.setting.themecolor.green': 'Polar Green',
'app.setting.themecolor.daybreak': 'Daybreak Blue (default)',
'app.setting.themecolor.geekblue': 'Geek Glue',
'app.setting.themecolor.geekblue': 'Geek Blue',
'app.setting.themecolor.purple': 'Golden Purple',
'app.setting.navigationmode': 'Navigation Mode',
'app.setting.sidemenu': 'Side Menu Layout',
Expand Down
4 changes: 3 additions & 1 deletion example/src/locales/pt-BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ export default {
'layout.user.link.help': 'ajuda',
'layout.user.link.privacy': 'política de privacidade',
'layout.user.link.terms': 'termos de serviços',
'app.preview.down.block': 'Download this page to your local project',
'app.preview.down.block': 'Faça o download desta página no seu projeto local',
'app.welcome.link.fetch-blocks': 'Buscar todos os blocos',
'app.welcome.link.block-list': 'Crie páginas rapidamente com base no desenvolvimento de `block`',
...globalHeader,
...menu,
...settingDrawer,
Expand Down
1 change: 0 additions & 1 deletion example/src/locales/pt-BR/globalHeader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@ export default {
'component.noticeIcon.clear': 'Limpar',
'component.noticeIcon.cleared': 'Limpo',
'component.noticeIcon.empty': 'Sem notificações',
'component.noticeIcon.loaded': 'Carregado',
'component.noticeIcon.view-more': 'Veja mais',
};
13 changes: 9 additions & 4 deletions example/src/locales/pt-BR/menu.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
export default {
'menu.welcome': 'Welcome',
'menu.more-blocks': 'More Blocks',
'menu.welcome': 'Bem-vinda',
'menu.more-blocks': 'Mais blocos',
'menu.home': 'Início',
'menu.login': 'Login',
'menu.admin': 'Admin',
'menu.admin.sub-page': 'Sub-Page',
'menu.admin.sub-page': 'Subpágina',
'menu.admin.sub-page2': 'Subpágina 2',
'menu.admin.sub-page3': 'Subpágina 3',
'menu.list.table-list.sub-page': 'Subpágina',
'menu.list.table-list.sub-page2': 'Subpágina 2',
'menu.list.table-list.sub-page3': 'Subpágina 3',
'menu.login': 'Login',
'menu.register': 'Registro',
'menu.register.result': 'Resultado de registro',
'menu.dashboard': 'Dashboard',
Expand Down
14 changes: 7 additions & 7 deletions example/src/locales/pt-BR/settingDrawer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ export default {
'app.setting.content-width.fixed': 'Fixo',
'app.setting.content-width.fluid': 'Fluido',
'app.setting.themecolor': 'Cor do Tema',
'app.setting.themecolor.dust': 'Dust Red',
'app.setting.themecolor.volcano': 'Volcano',
'app.setting.themecolor.dust': 'Poeira Vermelha',
'app.setting.themecolor.volcano': 'Vulcão',
'app.setting.themecolor.sunset': 'Sunset Orange',
'app.setting.themecolor.cyan': 'Cyan',
'app.setting.themecolor.green': 'Polar Green',
'app.setting.themecolor.daybreak': 'Daybreak Blue (default)',
'app.setting.themecolor.geekblue': 'Geek Glue',
'app.setting.themecolor.purple': 'Golden Purple',
'app.setting.themecolor.cyan': 'Ciano',
'app.setting.themecolor.green': 'Verde Polar',
'app.setting.themecolor.daybreak': 'Alvorada Azul (default)',
'app.setting.themecolor.geekblue': 'Geek Azul',
'app.setting.themecolor.purple': 'Roxo Dourado',
'app.setting.navigationmode': 'Modo de Navegação',
'app.setting.sidemenu': 'Layout do Menu Lateral',
'app.setting.topmenu': 'Layout do Menu Superior',
Expand Down
2 changes: 2 additions & 0 deletions example/src/locales/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export default {
'layout.user.link.privacy': '隐私',
'layout.user.link.terms': '条款',
'app.preview.down.block': '下载此页面到本地项目',
'app.alert.umi-ui-available': 'umi ui 现已发布,点击右下角 umi 图标即可使用',
'app.alert.umi-ui-released': 'umi ui 现已发布,欢迎使用 npm run ui 启动体验。',
'app.welcome.link.fetch-blocks': '获取全部区块',
'app.welcome.link.block-list': '基于 block 开发,快速构建标准页面',
...globalHeader,
Expand Down
3 changes: 2 additions & 1 deletion example/src/pages/Admin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ import React from 'react';
import { HeartTwoTone, SmileTwoTone } from '@ant-design/icons';
import { Card, Typography, Alert } from 'antd';
import { PageContainer } from '../../../src/';
import { useIntl } from 'umi';

export default (): React.ReactNode => (
<PageContainer>
<Card>
<Alert
message="umi ui 现已发布,欢迎使用 npm run ui 启动体验。"
message={useIntl().formatMessage({ id: 'app.alert.umi-ui-released' })}
type="success"
showIcon
banner
Expand Down
9 changes: 5 additions & 4 deletions example/src/pages/Welcome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import { Card, Typography, Alert } from 'antd';
import styles from './Welcome.less';
import { PageContainer } from '../../../src/';
import { useIntl } from 'umi';

const CodePreview: React.FC<{}> = ({ children }) => (
<pre className={styles.pre}>
Expand All @@ -12,10 +13,10 @@ const CodePreview: React.FC<{}> = ({ children }) => (
);

export default (): React.ReactNode => (
<PageContainer title="欢迎">
<PageContainer title={useIntl().formatMessage({ id: 'menu.welcome' })}>
<Card>
<Alert
message="umi ui 现已发布,点击右下角 umi 图标即可使用"
message={useIntl().formatMessage({ id: 'app.alert.umi-ui-available' })}
type="success"
showIcon
banner
Expand All @@ -26,7 +27,7 @@ export default (): React.ReactNode => (
/>
<Typography.Text strong>
<a target="_blank" rel="noopener noreferrer" href="https://pro.ant.design/docs/block">
基于 block 开发,快速构建标准页面
{useIntl().formatMessage({ id: 'app.welcome.link.block-list' })}
</a>
</Typography.Text>
<CodePreview> npm run ui</CodePreview>
Expand All @@ -41,7 +42,7 @@ export default (): React.ReactNode => (
rel="noopener noreferrer"
href="https://pro.ant.design/docs/available-script#npm-run-fetchblocks"
>
获取全部区块
{useIntl().formatMessage({ id: 'app.welcome.link.fetch-blocks' })}
</a>
</Typography.Text>
<CodePreview> npm run fetch:blocks</CodePreview>
Expand Down
4 changes: 2 additions & 2 deletions src/locales/en-US/settingDrawer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default {
'app.setting.themecolor.cyan': 'Cyan',
'app.setting.themecolor.green': 'Polar Green',
'app.setting.themecolor.daybreak': 'Daybreak Blue (default)',
'app.setting.themecolor.geekblue': 'Geek Glue',
'app.setting.themecolor.geekblue': 'Geek Blue',
'app.setting.themecolor.purple': 'Golden Purple',
'app.setting.navigationmode': 'Navigation Mode',
'app.setting.regionalsettings': 'Regional Settings',
Expand All @@ -23,7 +23,7 @@ export default {
'app.setting.sidemenu': 'Side Menu Layout',
'app.setting.topmenu': 'Top Menu Layout',
'app.setting.mixmenu': 'Mix Menu Layout',
'app.setting.splitMenus': 'split menus',
'app.setting.splitMenus': 'Split Menus',
'app.setting.fixedheader': 'Fixed Header',
'app.setting.fixedsidebar': 'Fixed Sidebar',
'app.setting.fixedsidebar.hint': 'Works on Side Menu Layout',
Expand Down
2 changes: 1 addition & 1 deletion src/locales/it-IT/settingDrawer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default {
'app.setting.sidemenu': 'Menu laterale',
'app.setting.topmenu': 'Menu in testata',
'app.setting.mixmenu': 'Menu misto',
'app.setting.splitMenus': 'split menus',
'app.setting.splitMenus': 'Menu divisi',
'app.setting.fixedheader': 'Testata fissa',
'app.setting.fixedsidebar': 'Menu laterale fisso',
'app.setting.fixedsidebar.hint': 'Solo se selezionato Menu laterale',
Expand Down

0 comments on commit 28cfeb2

Please sign in to comment.