feat: update i18n (#790)

* feat: tag type i18n

* feat: custom server dialog i18n

* feat: i18n resources name

* feat: i18n toast

* fix: eslint

* eslint: fix

* fix: eslint

* fix: eslint
This commit is contained in:
ChasLui 2022-12-20 17:47:02 +08:00 committed by GitHub
parent c177db69d5
commit a0face6695
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 214 additions and 49 deletions

View file

@ -167,6 +167,7 @@ const MemoFilterInputer: React.FC<MemoFilterInputerProps> = (props: MemoFilterIn
const tags = Array.from(memoStore.getState().tags);
const { type } = filter;
const typeDataSource = Object.values(filterConsts).map(({ text, value }) => ({ text: t(text), value }));
const operatorDataSource = Object.values(filterConsts[type as FilterType].operators).map(({ text, value }) => ({ text: t(text), value }));
const valueDataSource =
@ -247,12 +248,7 @@ const MemoFilterInputer: React.FC<MemoFilterInputerProps> = (props: MemoFilterIn
handleValueChanged={handleRelationChange}
/>
) : null}
<Selector
className="type-selector"
dataSource={Object.values(filterConsts)}
value={filter.type}
handleValueChanged={handleTypeChange}
/>
<Selector className="type-selector" dataSource={typeDataSource} value={filter.type} handleValueChanged={handleTypeChange} />
<Selector
className="operator-selector"
dataSource={operatorDataSource}

View file

@ -105,7 +105,7 @@ const ResourcesDialog: React.FC<Props> = (props: Props) => {
const handleCopyResourceLinkBtnClick = (resource: Resource) => {
copy(`${window.location.origin}/o/r/${resource.id}/${resource.filename}`);
toastHelper.success("Succeed to copy resource link to clipboard");
toastHelper.success(t("message.succeed-copy-resource-link"));
};
const handleDeleteUnusedResourcesBtnClick = () => {
@ -185,7 +185,7 @@ const ResourcesDialog: React.FC<Props> = (props: Props) => {
<div className="resource-table-container">
<div className="fields-container">
<span className="field-text id-text">ID</span>
<span className="field-text name-text">NAME</span>
<span className="field-text name-text">{t("resources.name")}</span>
<span></span>
</div>
{resources.length === 0 ? (

View file

@ -99,7 +99,7 @@ const ResourcesSelectorDialog: React.FC<Props> = (props: Props) => {
<div className="resource-table-container">
<div className="fields-container">
<span className="field-text id-text">ID</span>
<span className="field-text name-text">NAME</span>
<span className="field-text name-text">{t("resources.name")}</span>
<span></span>
</div>
{resources.length === 0 ? (

View file

@ -77,7 +77,7 @@ const SystemSection = () => {
console.error(error);
return;
}
toastHelper.success("Succeed to vacuum database");
toastHelper.success(t("message.succeed-vacuum-database"));
};
const handleSaveAdditionalStyle = async () => {
@ -90,7 +90,7 @@ const SystemSection = () => {
console.error(error);
return;
}
toastHelper.success("Succeed to update additional style");
toastHelper.success(t("message.succeed-update-additional-style"));
};
const handleAdditionalScriptChanged = (value: string) => {
@ -110,7 +110,7 @@ const SystemSection = () => {
console.error(error);
return;
}
toastHelper.success("Succeed to update additional script");
toastHelper.success(t("message.succeed-update-additional-script"));
};
return (
@ -118,9 +118,9 @@ const SystemSection = () => {
<p className="title-text">{t("common.basic")}</p>
<div className="form-label">
<div className="normal-text">
Server name: <span className="font-mono font-bold">{systemStatus.customizedProfile.name}</span>
{t("setting.system-section.server-name")}: <span className="font-mono font-bold">{systemStatus.customizedProfile.name}</span>
</div>
<Button onClick={handleUpdateCustomizedProfileButtonClick}>Edit</Button>
<Button onClick={handleUpdateCustomizedProfileButtonClick}>{t("common.edit")}</Button>
</div>
<div className="form-label">
<span className="normal-text">

View file

@ -92,7 +92,7 @@ const UpdateAccountDialog: React.FC<Props> = ({ destroy }: Props) => {
userPatch.email = state.email;
}
await userStore.patchUser(userPatch);
toastHelper.info("Update succeed");
toastHelper.info(t("message.update-succeed"));
handleCloseBtnClick();
} catch (error: any) {
console.error(error);

View file

@ -55,24 +55,25 @@ const UpdateCustomizedProfileDialog: React.FC<Props> = ({ destroy }: Props) => {
console.error(error);
return;
}
toastHelper.success("Succeed to update customized profile");
toastHelper.success(t("message.succeed-update-customized-profile"));
destroy();
};
return (
<>
<div className="dialog-header-container !w-64">
<p className="title-text">Customize server</p>
<p className="title-text">{t("setting.system-section.customize-server.title")}</p>
<button className="btn close-btn" onClick={handleCloseBtnClick}>
<Icon.X />
</button>
</div>
<div className="dialog-content-container">
<p className="text-sm mb-1">
Server Name<span className="text-sm text-gray-400 ml-1">(Default is memos)</span>
{t("setting.system-section.server-name")}
<span className="text-sm text-gray-400 ml-1">({t("setting.system-section.customize-server.default")})</span>
</p>
<input type="text" className="input-text" value={state.name} onChange={handleNameChanged} />
<p className="text-sm mb-1 mt-2">Icon URL</p>
<p className="text-sm mb-1 mt-2">{t("setting.system-section.customize-server.icon-url")}</p>
<input type="text" className="input-text" value={state.iconUrl} onChange={handleIconUrlChanged} />
<div className="mt-4 w-full flex flex-row justify-end items-center space-x-2">
<span className="btn-text" onClick={handleCloseBtnClick}>

View file

@ -17,7 +17,7 @@ interface Props {
}
const nullItem = {
text: "Select",
text: "common.select",
value: "",
};
@ -28,7 +28,7 @@ const Selector: React.FC<Props> = (props: Props) => {
const selectorElRef = useRef<HTMLDivElement>(null);
let currentItem = nullItem;
let currentItem = { text: t(nullItem.text), value: nullItem.value };
for (const d of dataSource) {
if (d.value === value) {
currentItem = d;

View file

@ -8,7 +8,7 @@ export const relationConsts = [
export const filterConsts = {
TAG: {
text: "Tag",
text: "filter.type.tag",
value: "TAG",
operators: [
{
@ -22,7 +22,7 @@ export const filterConsts = {
],
},
TYPE: {
text: "Type",
text: "filter.type.type",
value: "TYPE",
operators: [
{
@ -46,7 +46,7 @@ export const filterConsts = {
],
},
TEXT: {
text: "Text",
text: "filter.type.text",
value: "TEXT",
operators: [
{
@ -60,7 +60,7 @@ export const filterConsts = {
],
},
DISPLAY_TIME: {
text: "Display Time",
text: "filter.type.display-time",
value: "DISPLAY_TIME",
operators: [
{
@ -74,7 +74,7 @@ export const filterConsts = {
],
},
VISIBILITY: {
text: "Visibility",
text: "filter.type.visibility",
value: "VISIBILITY",
operators: [
{

View file

@ -46,7 +46,8 @@
"expand": "Erweitern",
"image": "Bild",
"link": "Link",
"vacuum": "Vacuum"
"vacuum": "Vacuum",
"select": "Select"
},
"slogan": "Eine quelloffene, selbst gehostete Sammlung an Memos zur Wissensverwaltung und Vernetzung.",
"auth": {
@ -76,7 +77,8 @@
"rename": "Umbenennen",
"clear-unused-resources": "Lösche ungenutzte Ressourcen",
"warning-text-unused": "Möchtest du diese ungenutzte Ressource wirklich löschen? Dies kann nicht rückgängig gemacht werden❗",
"no-unused-resources": "Keine ungenutzten Ressourcen"
"no-unused-resources": "Keine ungenutzten Ressourcen",
"name": "Name"
},
"archived": {
"archived-memos": "Archivierte Memos",
@ -117,6 +119,13 @@
},
"filter": {
"new-filter": "Neuer Filter",
"type": {
"tag": "Tag",
"type": "Type",
"text": "Text",
"display-time": "Display Time",
"visibility": "Visibility"
},
"operator": {
"contains": "enthält",
"not-contains": "enthält nicht",
@ -162,6 +171,12 @@
"create-a-member": "Mitglied hinzufügen"
},
"system-section": {
"server-name": "Server Name",
"customize-server": {
"title": "Customize Server",
"default": "Default is memos",
"icon-url": "Icon URL"
},
"database-file-size": "Dateigröße der Datenbank",
"allow-user-signup": "Erlaube Registrierungen für neue Mitglieder",
"additional-style": "Zusätzlicher Style",
@ -210,6 +225,12 @@
"too-short": "Zu kurz",
"too-long": "Zu lang",
"not-allow-space": "Keine Leerzeichen erlaubt",
"not-allow-chinese": "Keine chinesischen Zeichen erlaubt"
"not-allow-chinese": "Keine chinesischen Zeichen erlaubt",
"succeed-vacuum-database": "Succeed to vacuum database",
"succeed-update-additional-style": "Succeed to update additional style",
"succeed-copy-resource-link": "Succeed to copy resource link to clipboard",
"succeed-update-customized-profile": "Succeed to update customized profile",
"succeed-update-additional-script": "Succeed to update additional script",
"update-succeed": "Update succeed"
}
}

View file

@ -46,7 +46,8 @@
"expand": "Expand",
"image": "Image",
"link": "Link",
"vacuum": "Vacuum"
"vacuum": "Vacuum",
"select": "Select"
},
"slogan": "An open-source, self-hosted memo hub with knowledge management and socialization.",
"auth": {
@ -76,7 +77,8 @@
"rename": "Rename",
"clear-unused-resources": "Clear unused resources",
"warning-text-unused": "Are you sure to delete these unused resource? THIS ACTION IS IRREVERSIABLE❗",
"no-unused-resources": "No unused resources"
"no-unused-resources": "No unused resources",
"name": "Name"
},
"archived": {
"archived-memos": "Archived Memos",
@ -117,6 +119,13 @@
},
"filter": {
"new-filter": "New Filter",
"type": {
"tag": "Tag",
"type": "Type",
"text": "Text",
"display-time": "Display Time",
"visibility": "Visibility"
},
"operator": {
"contains": "Contains",
"not-contains": "Does not contain",
@ -162,6 +171,12 @@
"create-a-member": "Create a member"
},
"system-section": {
"server-name": "Server Name",
"customize-server": {
"title": "Customize Server",
"default": "Default is memos",
"icon-url": "Icon URL"
},
"database-file-size": "Database File Size",
"allow-user-signup": "Allow user signup",
"additional-style": "Additional style",
@ -210,6 +225,12 @@
"too-short": "Too short",
"too-long": "Too long",
"not-allow-space": "Don't allow space",
"not-allow-chinese": "Don't allow chinese"
"not-allow-chinese": "Don't allow chinese",
"succeed-vacuum-database": "Succeed to vacuum database",
"succeed-update-additional-style": "Succeed to update additional style",
"succeed-copy-resource-link": "Succeed to copy resource link to clipboard",
"succeed-update-customized-profile": "Succeed to update customized profile",
"succeed-update-additional-script": "Succeed to update additional script",
"update-succeed": "Update succeed"
}
}

View file

@ -46,7 +46,8 @@
"expand": "Expandir",
"image": "Imagen",
"link": "Enlace",
"vacuum": "Vaciar"
"vacuum": "Vaciar",
"select": "Select"
},
"slogan": "Un código abierto, centro de notas autoalojado con la gestión del conocimiento y la socialización.",
"auth": {
@ -76,7 +77,8 @@
"rename": "Renombrar",
"clear-unused-resources": "Borrar los recursos no utilizados",
"warning-text-unused": "Seguro que quieres eliminar estos recursos no utilizados? ESTA ACCIÓN ES IRREVERSIBLE❗.",
"no-unused-resources": "No hay recursos sin utilizar"
"no-unused-resources": "No hay recursos sin utilizar",
"name": "Name"
},
"archived": {
"archived-memos": "Notas Archivadas",
@ -117,6 +119,13 @@
},
"filter": {
"new-filter": "Nuevo Filtro",
"type": {
"tag": "Tag",
"type": "Type",
"text": "Text",
"display-time": "Display Time",
"visibility": "Visibility"
},
"operator": {
"contains": "Contiene",
"not-contains": "No contiene",
@ -162,6 +171,12 @@
"create-a-member": "Crear un miembro"
},
"system-section": {
"server-name": "Server Name",
"customize-server": {
"title": "Customize Server",
"default": "Default is memos",
"icon-url": "Icon URL"
},
"database-file-size": "Tamaño de la Base de Datos",
"allow-user-signup": "Permitir el registro de usuarios",
"additional-style": "Estilo adicional",
@ -210,6 +225,12 @@
"too-short": "Demasiado corto",
"too-long": "Demasiado largo",
"not-allow-space": "No se admiten espacios",
"not-allow-chinese": "El chino no está permitido"
"not-allow-chinese": "El chino no está permitido",
"succeed-vacuum-database": "Succeed to vacuum database",
"succeed-update-additional-style": "Succeed to update additional style",
"succeed-copy-resource-link": "Succeed to copy resource link to clipboard",
"succeed-update-customized-profile": "Succeed to update customized profile",
"succeed-update-additional-script": "Succeed to update additional script",
"update-succeed": "Update succeed"
}
}

View file

@ -46,7 +46,8 @@
"expand": "Développer",
"image": "Image",
"link": "Link",
"vacuum": "Vacuum"
"vacuum": "Vacuum",
"select": "Select"
},
"slogan": "An open-source, self-hosted memo hub with knowledge management and socialization.",
"auth": {
@ -76,7 +77,8 @@
"rename": "Renommer",
"clear-unused-resources": "Effacer les ressources inutilisées",
"warning-text-unused": "Etes-vous sûr de vouloir supprimer ces ressources inutilisées ? CETTE ACTION EST IRRÉVERSIBLE❗",
"no-unused-resources": "Aucune ressource inutilisée"
"no-unused-resources": "Aucune ressource inutilisée",
"name": "Name"
},
"archived": {
"archived-memos": "Mémos archivés",
@ -117,6 +119,13 @@
},
"filter": {
"new-filter": "Nouveau filtre",
"type": {
"tag": "Tag",
"type": "Type",
"text": "Text",
"display-time": "Display Time",
"visibility": "Visibility"
},
"operator": {
"contains": "Contient",
"not-contains": "Ne contient pas",
@ -162,6 +171,12 @@
"create-a-member": "Créer un membre"
},
"system-section": {
"server-name": "Server Name",
"customize-server": {
"title": "Customize Server",
"default": "Default is memos",
"icon-url": "Icon URL"
},
"database-file-size": "Taille de la base de données",
"allow-user-signup": "Autoriser l'inscription des utilisateurs",
"additional-style": "Style supplémentaire",
@ -205,6 +220,12 @@
"too-short": "Too short",
"too-long": "Too long",
"not-allow-space": "Don't allow space",
"not-allow-chinese": "Don't allow chinese"
"not-allow-chinese": "Don't allow chinese",
"succeed-vacuum-database": "Succeed to vacuum database",
"succeed-update-additional-style": "Succeed to update additional style",
"succeed-copy-resource-link": "Succeed to copy resource link to clipboard",
"succeed-update-customized-profile": "Succeed to update customized profile",
"succeed-update-additional-script": "Succeed to update additional script",
"update-succeed": "Update succeed"
}
}

View file

@ -72,7 +72,8 @@
"rename": "Hernoemen",
"clear-unused-resources": "Ongebruikte bronnen opruimen",
"warning-text-unused": "Weet je zeker dat je deze ongebruikte bron wilt verwijderen? Deze actie is NIET terug te draaien!",
"no-unused-resources": "Geen ongebruikte bronnen"
"no-unused-resources": "Geen ongebruikte bronnen",
"name": "Name"
},
"archived": {
"archived-memos": "Gearchiveerde Memos",
@ -111,6 +112,14 @@
},
"filter": {
"new-filter": "Nieuw Filter",
"type": {
"tag": "Tag",
"type": "Type",
"text": "Text",
"display-time": "Display Time",
"visibility": "Visibility",
"select": "Select"
},
"operator": {
"contains": "Bevat",
"not-contains": "Bevat niet",
@ -156,6 +165,12 @@
"create-a-member": "Lid toevoegen"
},
"system-section": {
"server-name": "Server Name",
"customize-server": {
"title": "Customize Server",
"default": "Default is memos",
"icon-url": "Icon URL"
},
"database-file-size": "Database bestandsgrootte",
"allow-user-signup": "Registratie toestaan",
"additional-style": "Optionele stijl",
@ -197,6 +212,12 @@
"resource-filename-updated": "Bestandsnaam van bron gewijzigd.",
"invalid-resource-filename": "Onjuiste bestandsnaam.",
"click-to-save-the-image": "Klik om de afbeelding op te slaan",
"generating-the-screenshot": "Screenshot genereren..."
"generating-the-screenshot": "Screenshot genereren...",
"succeed-vacuum-database": "Succeed to vacuum database",
"succeed-update-additional-style": "Succeed to update additional style",
"succeed-copy-resource-link": "Succeed to copy resource link to clipboard",
"succeed-update-customized-profile": "Succeed to update customized profile",
"succeed-update-additional-script": "Succeed to update additional script",
"update-succeed": "Update succeed"
}
}

View file

@ -46,7 +46,8 @@
"expand": "Expandera",
"image": "Bild",
"link": "Länk",
"vacuum": "Vacuum"
"vacuum": "Vacuum",
"select": "Select"
},
"slogan": "En öppen källkod, self-hosted antecknings hubb med kunskapshantering och socialisering",
"auth": {
@ -76,7 +77,8 @@
"rename": "Döp om",
"clear-unused-resources": "Rensa outnytjade resurser",
"warning-text-unused": "Är du säker på att du vill ta bort dessa oanvända resurser? DENNA ÅTGÄRD ÄR OÅTERSTÄLLBAR❗",
"no-unused-resources": "Inga oanvända resurser"
"no-unused-resources": "Inga oanvända resurser",
"name": "Name"
},
"archived": {
"archived-memos": "Arkiverade anteckningar",
@ -117,6 +119,13 @@
},
"filter": {
"new-filter": "Nytt filter",
"type": {
"tag": "Tag",
"type": "Type",
"text": "Text",
"display-time": "Display Time",
"visibility": "Visibility"
},
"operator": {
"contains": "Innehåller",
"not-contains": "Innehåller inte",
@ -162,6 +171,12 @@
"create-a-member": "Skapa en medlem"
},
"system-section": {
"server-name": "Server Name",
"customize-server": {
"title": "Customize Server",
"default": "Default is memos",
"icon-url": "Icon URL"
},
"database-file-size": "Databas filstorlek",
"allow-user-signup": "Tillåt användarregistrering",
"additional-style": "Ytterligare stil",
@ -210,6 +225,12 @@
"too-short": "För kort",
"too-long": "För långt",
"not-allow-space": "Tillåt inte mellanslag",
"not-allow-chinese": "Tillåt inte kinesiska"
"not-allow-chinese": "Tillåt inte kinesiska",
"succeed-vacuum-database": "Succeed to vacuum database",
"succeed-update-additional-style": "Succeed to update additional style",
"succeed-copy-resource-link": "Succeed to copy resource link to clipboard",
"succeed-update-customized-profile": "Succeed to update customized profile",
"succeed-update-additional-script": "Succeed to update additional script",
"update-succeed": "Update succeed"
}
}

View file

@ -46,7 +46,8 @@
"expand": "Expand",
"image": "Image",
"link": "Link",
"vacuum": "Vacuum"
"vacuum": "Vacuum",
"select": "Select"
},
"slogan": "An open-source, self-hosted memo hub with knowledge management and socialization.",
"auth": {
@ -91,7 +92,8 @@
"only-image-supported": "Chỉ hỗ trợ hình ảnh.",
"cant-empty": "Nội dung không thể trống",
"local": "Local",
"resources": "Resources"
"resources": "Resources",
"name": "Name"
},
"memo": {
"view-detail": "Xem chi tiết",
@ -117,6 +119,13 @@
},
"filter": {
"new-filter": "Bộ lọc mới",
"type": {
"tag": "Tag",
"type": "Type",
"text": "Text",
"display-time": "Display Time",
"visibility": "Visibility"
},
"operator": {
"contains": "Chứa",
"not-contains": "Không chứa",
@ -161,6 +170,12 @@
"create-a-member": "Tạo thành viên"
},
"system-section": {
"server-name": "Server Name",
"customize-server": {
"title": "Customize Server",
"default": "Default is memos",
"icon-url": "Icon URL"
},
"database-file-size": "Kích thước tệp cơ sở dữ liệu",
"allow-user-signup": "Cho phép người dùng đăng ký",
"additional-style": "Phong cách bổ sung",
@ -204,6 +219,12 @@
"too-short": "Too short",
"too-long": "Too long",
"not-allow-space": "Don't allow space",
"not-allow-chinese": "Don't allow chinese"
"not-allow-chinese": "Don't allow chinese",
"succeed-vacuum-database": "Succeed to vacuum database",
"succeed-update-additional-style": "Succeed to update additional style",
"succeed-copy-resource-link": "Succeed to copy resource link to clipboard",
"succeed-update-customized-profile": "Succeed to update customized profile",
"succeed-update-additional-script": "Succeed to update additional script",
"update-succeed": "Update succeed"
}
}

View file

@ -46,7 +46,8 @@
"expand": "展开",
"image": "图片",
"link": "链接",
"vacuum": "清理"
"vacuum": "清理",
"select": "选择"
},
"slogan": "An open-source, self-hosted memo hub with knowledge management and socialization.",
"auth": {
@ -76,7 +77,8 @@
"rename": "重命名",
"clear-unused-resources": "清除无用资源",
"warning-text-unused": "确定删除这些无用资源么?此操作不可逆❗",
"no-unused-resources": "无可删除的资源"
"no-unused-resources": "无可删除的资源",
"name": "资源名称"
},
"archived": {
"archived-memos": "已归档的 Memo",
@ -117,6 +119,13 @@
},
"filter": {
"new-filter": "新建过滤器",
"type": {
"tag": "标签",
"type": "类型",
"text": "文本",
"display-time": "显示时间",
"visibility": "可见性"
},
"operator": {
"contains": "包含",
"not-contains": "不包含",
@ -162,6 +171,12 @@
"create-a-member": "创建成员"
},
"system-section": {
"server-name": "服务名称",
"customize-server": {
"title": "自定义服务",
"default": "默认为 memos",
"icon-url": "图标 URL"
},
"database-file-size": "数据库文件大小",
"allow-user-signup": "允许用户注册",
"additional-style": "自定义样式",
@ -210,6 +225,12 @@
"too-short": "过短",
"too-long": "过长",
"not-allow-space": "不允许包含空格",
"not-allow-chinese": "不允许包含中文"
"not-allow-chinese": "不允许包含中文",
"succeed-to-vacuum-database": "清空数据库成功",
"succeed-update-additional-style": "更新附加样式成功",
"succeed-copy-resource-link": "复制资源链接到剪贴板成功",
"succeed-update-customized-profile": "更新自定义配置文件成功",
"succeed-update-additional-script": "更新附加脚本成功",
"update-succeed": "更新成功"
}
}