From 184daa3e733fffe263943660675332dbd3f6d4d4 Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Sat, 28 Jan 2023 15:41:20 +0800 Subject: [PATCH] =?UTF-8?q?feat(admin):=20=E5=A2=9E=E5=8A=A0user=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E7=9A=84=E5=9B=BD=E9=99=85=E5=8C=96=E5=86=99=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/admin/app/ra/i18n.ts | 346 +++++++++++++------------ server/admin/app/ra/resources/user.tsx | 20 +- 2 files changed, 195 insertions(+), 171 deletions(-) diff --git a/server/admin/app/ra/i18n.ts b/server/admin/app/ra/i18n.ts index 3d240b45..a6cb3315 100644 --- a/server/admin/app/ra/i18n.ts +++ b/server/admin/app/ra/i18n.ts @@ -1,174 +1,200 @@ import { TranslationMessages } from 'react-admin'; import _merge from 'lodash/merge'; -import englishMessages from 'ra-language-english'; +import defaultEnglishMessages from 'ra-language-english'; import polyglotI18nProvider from 'ra-i18n-polyglot'; -export { englishMessages }; - -const chineseMessages: TranslationMessages = _merge(englishMessages, { - ra: { - action: { - add_filter: '增加检索', - add: '增加', - back: '回退', - bulk_actions: '选中%{smart_count}项', - cancel: '取消', - clear_input_value: '清空输入', - clone: '克隆', - confirm: '确认', - create: '新建', - create_item: '新建 %{item}', - delete: '删除', - edit: '编辑', - export: '导出', - list: '列表', - refresh: '刷新', - remove_filter: '移除检索', - remove: '删除', - save: '保存', - search: '检索', - select_all: '选中全部', - select_row: '选中这行', - show: '查看', - sort: '排序', - undo: '撤销', - unselect: '反选', - expand: '展开', - close: '关闭', - open_menu: '打开菜单', - close_menu: '关闭菜单', - update: '更新', - move_up: '上移', - move_down: '下移', - open: '打开', - toggle_theme: '切换主题', - }, - boolean: { - true: '是', - false: '否', - null: ' ', - }, - page: { - create: '新建 %{name}', - dashboard: '概览', - edit: '%{name} #%{id}', - error: '出现错误', - list: '%{name} 列表', - loading: '加载中', - not_found: '未发现', - show: '%{name} #%{id}', - empty: '无 %{name} ', - invite: '要增加吗?', +const chineseResources = { + resources: { + users: { + fields: { + id: '用户ID', + email: '邮箱', + avatar: '头像', + username: '用户名', + password: '密码', + nickname: '昵称', + discriminator: '标识符', + temporary: '是否游客', + type: '用户类型', + settings: '用户设置', + createdAt: '创建时间', + }, }, - input: { - file: { - upload_several: '将文件集合拖拽到这里, 或点击这里选择文件集合.', - upload_single: '将文件拖拽到这里, 或点击这里选择文件.', + }, +}; + +const chineseMessages: TranslationMessages = _merge( + defaultEnglishMessages, + { + ra: { + action: { + add_filter: '增加检索', + add: '增加', + back: '回退', + bulk_actions: '选中%{smart_count}项', + cancel: '取消', + clear_input_value: '清空输入', + clone: '克隆', + confirm: '确认', + create: '新建', + create_item: '新建 %{item}', + delete: '删除', + edit: '编辑', + export: '导出', + list: '列表', + refresh: '刷新', + remove_filter: '移除检索', + remove: '删除', + save: '保存', + search: '检索', + select_all: '选中全部', + select_row: '选中这行', + show: '查看', + sort: '排序', + undo: '撤销', + unselect: '反选', + expand: '展开', + close: '关闭', + open_menu: '打开菜单', + close_menu: '关闭菜单', + update: '更新', + move_up: '上移', + move_down: '下移', + open: '打开', + toggle_theme: '切换主题', }, - image: { - upload_several: '将图片文件集合拖拽到这里, 或点击这里选择图片文件集合.', - upload_single: '将图片文件拖拽到这里, 或点击这里选择图片文件.', + boolean: { + true: '是', + false: '否', + null: ' ', }, - references: { - all_missing: '未找到参考数据.', - many_missing: '至少有一条参考数据不再可用.', - single_missing: '关联的参考数据不再可用.', + page: { + create: '新建 %{name}', + dashboard: '概览', + edit: '%{name} #%{id}', + error: '出现错误', + list: '%{name} 列表', + loading: '加载中', + not_found: '未发现', + show: '%{name} #%{id}', + empty: '无 %{name} ', + invite: '要增加吗?', }, - password: { - toggle_visible: '隐藏密码', - toggle_hidden: '显示密码', + input: { + file: { + upload_several: '将文件集合拖拽到这里, 或点击这里选择文件集合.', + upload_single: '将文件拖拽到这里, 或点击这里选择文件.', + }, + image: { + upload_several: + '将图片文件集合拖拽到这里, 或点击这里选择图片文件集合.', + upload_single: '将图片文件拖拽到这里, 或点击这里选择图片文件.', + }, + references: { + all_missing: '未找到参考数据.', + many_missing: '至少有一条参考数据不再可用.', + single_missing: '关联的参考数据不再可用.', + }, + password: { + toggle_visible: '隐藏密码', + toggle_hidden: '显示密码', + }, + }, + message: { + about: '关于', + are_you_sure: '您确定操作?', + bulk_delete_title: '删除 %{name} |||| 删除 %{smart_count}项 %{name} ', + bulk_delete_content: + '您确定要删除 %{name}? |||| 您确定要删除 %{smart_count} 项?', + bulk_update_content: + '你确定要更新 %{name}? |||| 你确定想更新 %{smart_count} 项?', + bulk_update_title: + '更新 %{name} |||| 您确定更新 %{smart_count} %{name}', + delete_content: '您确定要删除该条目?', + delete_title: '删除 %{name} #%{id}', + details: '详情', + error: '客户端错误导致请求未完成.', + invalid_form: '表单输入无效. 请检查错误提示', + loading: '正在加载页面, 请稍候', + no: '否', + not_found: '您输入了错误的URL或者错误的链接.', + yes: '是', + unsaved_changes: '修改未保存. 放弃修改吗?', + }, + navigation: { + no_results: '结果为空', + no_more_results: '页码 %{page} 超出边界. 试试上一页.', + page_out_of_boundaries: '页码 %{page} 超出边界', + page_out_from_end: '已到最末页', + page_out_from_begin: '已到最前页', + page_range_info: '%{offsetBegin}-%{offsetEnd} / %{total}', + partial_page_range_info: + '%{offsetBegin}-%{offsetEnd} of more than %{offsetEnd}', + current_page: '页码 %{page}', + page: '跳转到 %{page}', + prev: '向前', + first: '第一页', + last: '最后一页', + next: '向后', + previous: '先前第一页', + page_rows_per_page: '每页行数:', + skip_nav: '跳到内容', + }, + sort: { + sort_by: '按 %{field} %{order}', + ASC: '升序', + DESC: '降序', + }, + auth: { + auth_check_error: '请登录以继续', + user_menu: '设置', + username: '用户名', + password: '密码', + sign_in: '登录', + sign_in_error: '验证失败, 请重试', + logout: '退出', + }, + notification: { + updated: '条目已更新 |||| %{smart_count} 项条目已更新', + created: '条目已新建', + deleted: '条目已删除 |||| %{smart_count} 项条目已删除', + bad_item: '不正确的条目', + item_doesnt_exist: '条目不存在', + http_error: '与服务通信出错', + canceled: '取消动作', + data_provider_error: 'dataProvider错误. 请检查console的详细信息.', + i18n_error: '无法加载指定语言包', + logged_out: '会话失效, 请重连.', + not_authorized: '您无权访问此资源.', + }, + validation: { + required: '必填', + minLength: '必须不少于 %{min} 个字符', + maxLength: '必须不多于 %{max} 个字符', + minValue: '必须不小于 %{min}', + maxValue: '必须不大于 %{max}', + number: '必须为数字', + email: '必须是有效的邮箱', + oneOf: '必须为: %{options}其中一项', + regex: '必须符合指定的格式 (regexp): %{pattern}', + }, + saved_queries: { + label: '保存查询', + query_name: '搜索名称', + new_label: '保存当前的查询...', + new_dialog_title: '将当前查询另存为', + remove_label: '删除保存的查询', + remove_label_with_name: '删除查询 "%{name}"', + remove_dialog_title: '是否删除保存的查询?', + remove_message: '确实要从保存的查询列表中删除该项吗?', + help: '筛选列表并保存此查询以备将来使用', }, - }, - message: { - about: '关于', - are_you_sure: '您确定操作?', - bulk_delete_title: '删除 %{name} |||| 删除 %{smart_count}项 %{name} ', - bulk_delete_content: - '您确定要删除 %{name}? |||| 您确定要删除 %{smart_count} 项?', - bulk_update_content: - '你确定要更新 %{name}? |||| 你确定想更新 %{smart_count} 项?', - bulk_update_title: '更新 %{name} |||| 您确定更新 %{smart_count} %{name}', - delete_content: '您确定要删除该条目?', - delete_title: '删除 %{name} #%{id}', - details: '详情', - error: '客户端错误导致请求未完成.', - invalid_form: '表单输入无效. 请检查错误提示', - loading: '正在加载页面, 请稍候', - no: '否', - not_found: '您输入了错误的URL或者错误的链接.', - yes: '是', - unsaved_changes: '修改未保存. 放弃修改吗?', - }, - navigation: { - no_results: '结果为空', - no_more_results: '页码 %{page} 超出边界. 试试上一页.', - page_out_of_boundaries: '页码 %{page} 超出边界', - page_out_from_end: '已到最末页', - page_out_from_begin: '已到最前页', - page_range_info: '%{offsetBegin}-%{offsetEnd} / %{total}', - partial_page_range_info: - '%{offsetBegin}-%{offsetEnd} of more than %{offsetEnd}', - current_page: '页码 %{page}', - page: '跳转到 %{page}', - prev: '向前', - first: '第一页', - last: '最后一页', - next: '向后', - previous: '先前第一页', - page_rows_per_page: '每页行数:', - skip_nav: '跳到内容', - }, - sort: { - sort_by: '按 %{field} %{order}', - ASC: '升序', - DESC: '降序', - }, - auth: { - auth_check_error: '请登录以继续', - user_menu: '设置', - username: '用户名', - password: '密码', - sign_in: '登录', - sign_in_error: '验证失败, 请重试', - logout: '退出', - }, - notification: { - updated: '条目已更新 |||| %{smart_count} 项条目已更新', - created: '条目已新建', - deleted: '条目已删除 |||| %{smart_count} 项条目已删除', - bad_item: '不正确的条目', - item_doesnt_exist: '条目不存在', - http_error: '与服务通信出错', - canceled: '取消动作', - data_provider_error: 'dataProvider错误. 请检查console的详细信息.', - i18n_error: '无法加载指定语言包', - logged_out: '会话失效, 请重连.', - not_authorized: '您无权访问此资源.', - }, - validation: { - required: '必填', - minLength: '必须不少于 %{min} 个字符', - maxLength: '必须不多于 %{max} 个字符', - minValue: '必须不小于 %{min}', - maxValue: '必须不大于 %{max}', - number: '必须为数字', - email: '必须是有效的邮箱', - oneOf: '必须为: %{options}其中一项', - regex: '必须符合指定的格式 (regexp): %{pattern}', - }, - saved_queries: { - label: '保存查询', - query_name: '搜索名称', - new_label: '保存当前的查询...', - new_dialog_title: '将当前查询另存为', - remove_label: '删除保存的查询', - remove_label_with_name: '删除查询 "%{name}"', - remove_dialog_title: '是否删除保存的查询?', - remove_message: '确实要从保存的查询列表中删除该项吗?', - help: '筛选列表并保存此查询以备将来使用', }, }, -}); + chineseResources +); + +const englishMessages = _merge(defaultEnglishMessages, chineseResources); export const i18nProvider = polyglotI18nProvider((locale: string) => { if (locale === 'ch') { diff --git a/server/admin/app/ra/resources/user.tsx b/server/admin/app/ra/resources/user.tsx index 710e8d23..dd300591 100644 --- a/server/admin/app/ra/resources/user.tsx +++ b/server/admin/app/ra/resources/user.tsx @@ -35,19 +35,18 @@ export const UserList: React.FC = () => ( ]} > - - - - - + + + + + - - - + + + @@ -96,8 +95,7 @@ export const UserShow: React.FC = () => ( - - + );