Configure i18n and add simplified chinese (#99)

This commit is contained in:
1ilit
2024-05-16 06:44:39 +03:00
parent 9de091c990
commit 2b4b01c358
52 changed files with 1339 additions and 528 deletions

24
src/i18n/i18n.js Normal file
View File

@@ -0,0 +1,24 @@
import i18n from "i18next";
import { initReactI18next } from "react-i18next";
import LanguageDetector from "i18next-browser-languagedetector";
import { en, english } from "./locales/en";
import { zh, chinese } from "./locales/zh";
export const languages = [english, chinese];
i18n
.use(LanguageDetector)
.use(initReactI18next)
.init({
fallbackLng: "en",
debug: false,
interpolation: {
escapeValue: false,
},
resources: {
en,
zh,
},
});
export default i18n;

218
src/i18n/locales/en.js Normal file
View File

@@ -0,0 +1,218 @@
const english = {
name: "English",
native_name: "English",
code: "en",
};
const en = {
translation: {
report_bug: "Report a bug",
import: "Import",
file: "File",
new: "New",
new_window: "New window",
open: "Open",
save: "Save",
save_as: "Save as",
save_as_template: "Save as template",
template_saved: "Template saved!",
rename: "Rename",
delete_diagram: "Delete diagram",
are_you_sure_delete_diagram:
"Are you sure you want to delete this diagram? This operation is irreversible.",
oops_smth_went_wrong: "Oops! Something went wrong.",
import_diagram: "Import diagram",
import_from_source: "Import from source",
export_as: "Export as",
export_source: "Export source",
models: "Models",
exit: "Exit",
edit: "Edit",
undo: "Undo",
redo: "Redo",
clear: "Clear",
are_you_sure_clear:
"Are you sure you want to clear the diagram? This is irreversible.",
cut: "Cut",
copy: "Copy",
paste: "Paste",
duplicate: "Duplicate",
delete: "Delete",
copy_as_image: "Copy as image",
view: "View",
header: "Header",
sidebar: "Sidebar",
issues: "Issues",
presentation_mode: "Presentation mode",
strict_mode: "Strict mode",
field_details: "Field details",
reset_view: "Reset view",
show_grid: "Show grid",
show_cardinality: "Show cardinality",
theme: "Theme",
light: "Light",
dark: "Dark",
zoom_in: "Zoom in",
zoom_out: "Zoom out",
fullscreen: "Fullscreen",
settings: "Settings",
show_timeline: "Show timeline",
autosave: "Autosave",
panning: "Panning",
table_width: "Table width",
language: "Language",
flush_storage: "Flush storage",
are_you_sure_flush_storage:
"Are you sure you want to flush the storage? This will irreversibly delete all your diagrams and custom templates.",
storage_flushed: "Storage flushed",
help: "Help",
shortcuts: "Shortcuts",
ask_on_discord: "Ast us on Discord",
feedback: "Feedback",
no_changes: "No changes",
loading: "Loading...",
last_saved: "Last saved",
saving: "Saving...",
failed_to_save: "Failed to save",
fit_window_reset: "Fit window / Reset",
zoom: "Zoom",
add_table: "Add table",
add_area: "Add area",
add_note: "Add note",
add_type: "Add type",
to_do: "To-do",
tables: "Tables",
relationships: "Relationships",
subject_areas: "Subject areas",
notes: "Notes",
types: "Types",
search: "Search...",
no_tables: "No tables",
no_tables_text: "Start building your diagram!",
no_relationships: "No relationships",
no_relationships_text: "Drag to connect fields and form relationships!",
no_subject_areas: "No subject areas",
no_subject_areas_text: "Add subject areas to group tables!",
no_notes: "No notes",
no_notes_text: "Use notes to record extra info",
no_types: "No types",
no_types_text: "Make your own custom data types",
no_issues: "No issues were detected.",
strict_mode_is_on_no_issues:
"Strict mode is off so no issues will be displayed.",
name: "Name",
type: "Type",
null: "Null",
not_null: "Not null",
primary: "Primary",
unique: "Unique",
autoincrement: "Autoincrement",
default_value: "Default",
check: "Check expression",
this_will_appear_as_is: "*This will appear in the generated script as is.",
comment: "Comment",
add_field: "Add field",
values: "values",
size: "Size",
precision: "Precision",
set_precision: "Set precision: (size, digits)",
use_for_batch_input: "Use , for batch input",
indices: "Indices",
add_index: "Add index",
select_fields: "Select fields",
title: "Title",
not_set: "Not set",
foreign: "Foreign",
cardinality: "Cardinality",
on_update: "On update",
on_delete: "On delete",
swap: "Swap",
one_to_one: "One to one",
one_to_many: "One to many",
many_to_one: "Many to one",
content: "Content",
types_info:
"This feature is meant for object-relational DBMSs like PostgreSQL.\nIf used for MySQL or MariaDB a JSON type will be generated with the corresponding json validation check.\nIf used for SQLite it will be translated to a BLOB.\nIf used for MSSQL a type alias to the first field will be generated.",
table_deleted: "Table deleted",
area_deleted: "Area deleted",
note_deleted: "Note deleted",
relationship_deleted: "Relationship deleted",
type_deleted: "Type deleted",
cannot_connect: "Cannot connect, the columns have different types",
copied_to_clipboard: "Copied to clipboard",
create_new_diagram: "Create new diagram",
cancel: "Cancel",
open_diagram: "Open diagram",
rename_diagram: "Rename diagram",
export: "Export",
export_image: "Export image",
create: "Create",
confirm: "Confirm",
last_modified: "Last modified",
drag_and_drop_files: "Drag and drop the file here or click to upload.",
support_json_and_ddb: "JSON and DDB files are supported",
upload_sql_to_generate_diagrams:
"Upload an sql file to autogenerate your tables and columns.",
overwrite_existing_diagram: "Overwrite existing diagram",
only_mysql_supported:
"*For the time being loading only MySQL scripts is supported.",
blank: "Blank",
filename: "Filename",
table_w_no_name: "Declared a table with no name",
duplicate_table_by_name: "Duplicate table by the name '{{tableName}}'",
empty_field_name: "Empty field `name` in table '{{tableName}}'",
empty_field_type: "Empty field `type` in table '{{tableName}}'",
no_values_for_field:
"'{{fieldName}}' field of table '{{tableName}}' is of type `{{type}}` but no values have been specified",
default_doesnt_match_type:
"Default value for field '{{fieldName}}' in table '{{table.name}}' does not match its type",
not_null_is_null:
"'{{fieldName}}' field of table '{{tableName}}' is NOT NULL but has default NULL",
duplicate_fields:
"Duplicate table fields by name '{{fieldName}}' in table '{{tableName}}'",
duplicate_index:
"Duplicate index by name '{{indexName}}' in table '{{tableName}}'",
empty_index: "Index in table '{{tableName}}' indexes no columns",
no_primary_key: "Table '{{tableName}}' has no primary key",
type_with_no_name: "Declared a type with no name",
duplicate_types: "Duplicate types by the name '{{typeName}}'",
type_w_no_fields: "Declared an empty type '{{typeName}}'with no fields",
empty_type_field_name: "Empty field `name` in type '{{typeName}}'",
empty_type_field_type: "Empty field `type` in type '{{typeName}}'",
no_values_for_type_field:
"'{{fieldName}}' field of type '{{typeName}}' is of type `{{type}}` but no values have been specified",
duplicate_type_fields:
"Duplicate type fields by name '{{fieldName}}' in type '{{typeName}}'",
duplicate_reference: "Duplicate reference by the name '{{refName}}'",
circular_dependency: "Circular dependency involvind table '{{refName}}'",
timeline: "Timeline",
priority: "Priority",
none: "None",
low: "Low",
medium: "Medium",
high: "High",
sort_by: "Sort by",
my_order: "My order",
completed: "Completed",
alphabetically: "Alphabetically",
add_task: "Add task",
details: "Details",
no_tasks: "You have no tasks yet.",
no_activity: "You have no activity yet.",
move_element: "Move {{name}} to {{coords}}",
edit_area: "{{extra}} Edit area {{areaName}}",
delete_area: "Delete area {{areaName}}",
edit_note: "{{extra}} Edit note {{noteTitle}}",
delete_note: "Delete note {{noteTitle}}",
edit_table: "{{extra}} Edit table {{tableName}}",
delete_table: "Delete table {{tableName}}",
edit_type: "{{extra}} Edit type {{typeName}}",
delete_type: "Delete type {{typeName}}",
add_relationship: "Add relationship",
edit_relationship: "{{extra}} Edit relationship {{refName}}",
delete_relationship: "Delete relationship {{refName}}",
not_found: "Not found",
},
};
export { en, english };

213
src/i18n/locales/zh.js Normal file
View File

@@ -0,0 +1,213 @@
const chinese = {
name: "Simplified Chinese",
native_name: "简体中文",
code: "zh",
};
const zh = {
translation: {
report_bug: "报告问题",
import: "导入",
file: "文件",
new: "新建",
new_window: "新窗口",
open: "打开",
save: "保存",
save_as: "另存为",
save_as_template: "保存为模板",
template_saved: "模板已保存!",
rename: "重命名",
delete_diagram: "删除图表",
are_you_sure_delete_diagram: "确定要删除此图表吗?此操作不可逆转。",
oops_smth_went_wrong: "糟糕!出了些问题。",
import_diagram: "导入图表",
import_from_source: "从源导入",
export_as: "导出为",
export_source: "导出源",
models: "模型",
exit: "退出",
edit: "编辑",
undo: "撤销",
redo: "重做",
clear: "清除",
are_you_sure_clear: "确定要清除图表吗?此操作不可逆转。",
cut: "剪切",
copy: "复制",
paste: "粘贴",
duplicate: "复制",
delete: "删除",
copy_as_image: "复制为图像",
view: "视图",
header: "标题",
sidebar: "侧边栏",
issues: "问题",
presentation_mode: "演示模式",
strict_mode: "严格模式",
field_details: "字段详情",
reset_view: "重置视图",
show_grid: "显示网格",
show_cardinality: "显示基数",
theme: "主题",
light: "明亮",
dark: "暗黑",
zoom_in: "放大",
zoom_out: "缩小",
fullscreen: "全屏",
settings: "设置",
show_timeline: "显示时间轴",
autosave: "自动保存",
panning: "平移",
table_width: "表格宽度",
language: "语言",
flush_storage: "清除存储",
are_you_sure_flush_storage:
"确定要清除存储吗?这将不可逆地删除所有您的图表和自定义模板。",
storage_flushed: "存储已清除",
help: "帮助",
shortcuts: "快捷键",
ask_on_discord: "在 Discord 上问我们",
feedback: "反馈",
no_changes: "没有更改",
loading: "加载中...",
last_saved: "上次保存",
saving: "保存中...",
failed_to_save: "保存失败",
fit_window_reset: "适应窗口/重置",
zoom: "缩放",
add_table: "添加表",
add_area: "添加区域",
add_note: "添加注释",
add_type: "添加类型",
to_do: "待办事项",
tables: "表",
relationships: "关系",
subject_areas: "主题区域",
notes: "注释",
types: "类型",
search: "搜索...",
no_tables: "没有表",
no_tables_text: "开始构建您的图表!",
no_relationships: "没有关系",
no_relationships_text: "拖动以连接字段并形成关系!",
no_subject_areas: "没有主题区域",
no_subject_areas_text: "添加主题区域以分组表!",
no_notes: "没有注释",
no_notes_text: "使用注释记录额外信息",
no_types: "没有类型",
no_types_text: "制作您自己的自定义数据类型",
no_issues: "未检测到问题。",
strict_mode_is_on_no_issues: "严格模式已关闭,因此不会显示任何问题。",
name: "名称",
type: "类型",
null: "空",
not_null: "非空",
primary: "主键",
unique: "唯一",
autoincrement: "自增",
default_value: "默认",
check: "检查表达式",
this_will_appear_as_is: "*此内容将按原样显示在生成的脚本中。",
comment: "评论",
add_field: "添加字段",
values: "值",
size: "大小",
precision: "精度",
set_precision: "设置精度:(大小,位数)",
use_for_batch_input: "用于批量输入,使用逗号",
indices: "索引",
add_index: "添加索引",
select_fields: "选择字段",
title: "标题",
not_set: "未设置",
foreign: "外键",
cardinality: "基数",
on_update: "更新时",
on_delete: "删除时",
swap: "交换",
one_to_one: "一对一",
one_to_many: "一对多",
many_to_one: "多对一",
content: "内容",
types_info:
"此功能适用于像 PostgreSQL 这样的对象关系型数据库管理系统。\n如果用于 MySQL 或 MariaDB将生成具有相应 JSON 验证检查的 JSON 类型。\n如果用于 SQLite它将被转换为 BLOB。\n如果用于 MSSQL将生成到第一个字段的类型别名。",
table_deleted: "表已删除",
area_deleted: "区域已删除",
note_deleted: "注释已删除",
relationship_deleted: "关系已删除",
type_deleted: "类型已删除",
cannot_connect: "无法连接,列具有不同的类型",
copied_to_clipboard: "已复制到剪贴板",
create_new_diagram: "创建新图表",
cancel: "取消",
open_diagram: "打开图表",
rename_diagram: "重命名图表",
export: "导出",
export_image: "导出图像",
create: "创建",
confirm: "确认",
last_modified: "最后修改",
drag_and_drop_files: "拖放文件到此处或点击上传。",
support_json_and_ddb: "支持 JSON 和 DDB 文件",
upload_sql_to_generate_diagrams: "上传 SQL 文件以自动生成表和列。",
overwrite_existing_diagram: "覆盖现有图表",
only_mysql_supported: "目前仅支持加载 MySQL 脚本。",
blank: "空",
filename: "文件名",
table_w_no_name: "声明了一个没有名称的表",
duplicate_table_by_name: "通过名称 '{{tableName}}' 重复声明了一个表",
empty_field_name: "表 '{{tableName}}' 中的字段 `name` 为空",
empty_field_type: "表 '{{tableName}}' 中的字段 `type` 为空",
no_values_for_field:
"表 '{{tableName}}' 的 '{{fieldName}}' 字段类型为 `{{type}}`,但未指定任何值",
default_doesnt_match_type:
"表 '{{table.name}}' 中字段 '{{fieldName}}' 的默认值与其类型不匹配",
not_null_is_null:
"表 '{{tableName}}' 中的 '{{fieldName}}' 字段为 NOT NULL但默认值为 NULL",
duplicate_fields:
"在表 '{{tableName}}' 中通过名称 '{{fieldName}}' 重复声明了字段",
duplicate_index:
"在表 '{{tableName}}' 中通过名称 '{{indexName}}' 重复声明了索引",
empty_index: "在表 '{{tableName}}' 中的索引未指定任何列",
no_primary_key: "表 '{{tableName}}' 没有主键",
type_with_no_name: "声明了一个没有名称的类型",
duplicate_types: "通过名称 '{{typeName}}' 重复声明了类型",
type_w_no_fields: "声明了一个没有字段的空类型 '{{typeName}}'",
empty_type_field_name: "类型 '{{typeName}}' 中的字段 `name` 为空",
empty_type_field_type: "类型 '{{typeName}}' 中的字段 `type` 为空",
no_values_for_type_field:
"类型 '{{typeName}}' 的 '{{fieldName}}' 字段类型为 `{{type}}`,但未指定任何值",
duplicate_type_fields:
"在类型 '{{typeName}}' 中通过名称 '{{fieldName}}' 重复声明了字段",
duplicate_reference: "通过名称 '{{refName}}' 重复声明了引用",
circular_dependency: "涉及到表 '{{refName}}' 的循环依赖",
timeline: "时间轴",
priority: "优先级",
none: "无",
low: "低",
medium: "中",
high: "高",
sort_by: "排序方式",
my_order: "我的排序",
completed: "已完成",
alphabetically: "按字母顺序",
add_task: "添加任务",
details: "详情",
no_tasks: "您还没有任务。",
no_activity: "您还没有活动。",
move_element: "将 {{name}} 移动到 {{coords}}",
edit_area: "{{extra}} 编辑区域 {{areaName}}",
delete_area: "删除区域 {{areaName}}",
edit_note: "{{extra}} 编辑注释 {{noteTitle}}",
delete_note: "删除注释 {{noteTitle}}",
edit_table: "{{extra}} 编辑表格 {{tableName}}",
delete_table: "删除表格 {{tableName}}",
edit_type: "{{extra}} 编辑类型 {{typeName}}",
delete_type: "删除类型 {{typeName}}",
add_relationship: "添加关系",
edit_relationship: "{{extra}} 编辑关系 {{refName}}",
delete_relationship: "删除关系 {{refName}}",
not_found: "未找到",
},
};
export { zh, chinese };