add translation for the last 2 option files

This commit is contained in:
Nriver 2024-08-15 11:26:51 +08:00
parent cc98ae0ea4
commit a78859fc2a
4 changed files with 70 additions and 21 deletions

View File

@ -1,27 +1,28 @@
import utils from "../../../services/utils.js";
import OptionsWidget from "./options_widget.js";
import { t } from "../../../services/i18n.js";
const TPL = `
<div class="options-section">
<h4>Spell Check</h4>
<h4>${t('spellcheck.title')}</h4>
<p>These options apply only for desktop builds, browsers will use their own native spell check. App restart is required after change.</p>
<p>${t('spellcheck.description')}</p>
<label>
<input type="checkbox" class="spell-check-enabled">
Enable spellcheck
${t('spellcheck.enable')}
</label>
<br/>
<div class="form-group">
<label>Language code(s)</label>
<input type="text" class="spell-check-language-code form-control" placeholder="for example &quot;en-US&quot;, &quot;de-AT&quot;">
<label>${t('spellcheck.language_code_label')}</label>
<input type="text" class="spell-check-language-code form-control" placeholder="${t('spellcheck.language_code_placeholder')}">
</div>
<p>Multiple languages can be separated by comma, e.g. <code>en-US, de-DE, cs</code>. Changes to the spell check options will take effect after application restart.</p>
<p>${t('spellcheck.multiple_languages_info')}</p>
<p><strong>Available language codes: </strong> <span class="available-language-codes"></span></p>
<p><strong>${t('spellcheck.available_language_codes_label')} </strong> <span class="available-language-codes"></span></p>
</div>`;
export default class SpellcheckOptions extends OptionsWidget {

View File

@ -1,44 +1,45 @@
import server from "../../../services/server.js";
import toastService from "../../../services/toast.js";
import OptionsWidget from "./options_widget.js";
import { t } from "../../../services/i18n.js";
const TPL = `
<div class="options-section">
<h4 style="margin-top: 0px;">Sync Configuration</h4>
<h4 style="margin-top: 0px;">${t('sync_2.config_title')}</h4>
<form class="sync-setup-form">
<div class="form-group">
<label>Server instance address</label>
<label>${t('sync_2.server_address')}</label>
<input class="sync-server-host form-control" placeholder="https://<host>:<port>">
</div>
<div class="form-group">
<label>Sync timeout (milliseconds)</label>
<label>${t('sync_2.timeout')}</label>
<input class="sync-server-timeout form-control" min="1" max="10000000" type="number" style="text-align: left;">
</div>
<div class="form-group">
<label>Sync proxy server (optional)</label>
<label>${t('sync_2.proxy_label')}</label>
<input class="sync-proxy form-control" placeholder="https://<host>:<port>">
<p><strong>Note:</strong> If you leave the proxy setting blank, the system proxy will be used (applies to desktop/electron build only).</p>
<p>Another special value is <code>noproxy</code> which forces ignoring even the system proxy and respectes <code>NODE_TLS_REJECT_UNAUTHORIZED</code>.</p>
<p><strong>${t('sync_2.note')}:</strong> ${t('sync_2.note_description')}</p>
<p>${t('sync_2.special_value_description')}</p>
</div>
<div style="display: flex; justify-content: space-between;">
<button class="btn btn-primary">Save</button>
<button class="btn btn-primary">${t('sync_2.save')}</button>
<button class="btn" type="button" data-help-page="synchronization.html">Help</button>
<button class="btn" type="button" data-help-page="synchronization.html">${t('sync_2.help')}</button>
</div>
</form>
</div>
<div class="options-section">
<h4>Sync Test</h4>
<h4>${t('sync_2.test_title')}</h4>
<p>This will test the connection and handshake to the sync server. If the sync server isn't initialized, this will set it up to sync with the local document.</p>
<p>${t('sync_2.test_description')}</p>
<button class="test-sync-button btn">Test sync</button>
<button class="test-sync-button btn">${t('sync_2.test_button')}</button>
</div>`;
export default class SyncOptions extends OptionsWidget {
@ -58,9 +59,8 @@ export default class SyncOptions extends OptionsWidget {
if (result.success) {
toastService.showMessage(result.message);
}
else {
toastService.showError(`Sync server handshake failed, error: ${result.message}`);
} else {
toastService.showError(t('sync_2.handshake_failed', { message: result.message }));
}
});
}

View File

@ -1194,5 +1194,29 @@
"reload_app": "重新加载应用以应用更改",
"set_all_to_default": "将所有快捷键重置为默认值",
"confirm_reset": "您确定要将所有键盘快捷键重置为默认值吗?"
},
"spellcheck": {
"title": "拼写检查",
"description": "这些选项仅适用于桌面版本,浏览器将使用其原生的拼写检查功能。更改后需要重启应用。",
"enable": "启用拼写检查",
"language_code_label": "语言代码",
"language_code_placeholder": "例如 \"en-US\", \"de-AT\"",
"multiple_languages_info": "多种语言可以用逗号分隔,例如 \"en-US, de-DE, cs\"。拼写检查选项的更改将在应用重启后生效。",
"available_language_codes_label": "可用的语言代码:"
},
"sync_2": {
"config_title": "同步配置",
"server_address": "服务器地址",
"timeout": "同步超时(单位:毫秒)",
"proxy_label": "同步代理服务器(可选)",
"note": "注意",
"note_description": "代理设置留空则使用系统代理(仅桌面客户端有效)。",
"special_value_description": "另一个特殊值是 <code>noproxy</code>,它强制忽略系统代理并遵守 <code>NODE_TLS_REJECT_UNAUTHORIZED</code>。",
"save": "保存",
"help": "帮助",
"test_title": "同步测试",
"test_description": "测试和同步服务器之间的连接。如果同步服务器没有初始化,会将本地文档同步到同步服务器上。",
"test_button": "测试同步",
"handshake_failed": "同步服务器握手失败,错误:{{message}}"
}
}

View File

@ -1195,5 +1195,29 @@
"reload_app": "Reload app to apply changes",
"set_all_to_default": "Set all shortcuts to the default",
"confirm_reset": "Do you really want to reset all keyboard shortcuts to the default?"
},
"spellcheck": {
"title": "Spell Check",
"description": "These options apply only for desktop builds, browsers will use their own native spell check. App restart is required after change.",
"enable": "Enable spellcheck",
"language_code_label": "Language code(s)",
"language_code_placeholder": "for example \"en-US\", \"de-AT\"",
"multiple_languages_info": "Multiple languages can be separated by comma, e.g. \"en-US, de-DE, cs\". Changes to the spell check options will take effect after application restart.",
"available_language_codes_label": "Available language codes:"
},
"sync": {
"config_title": "Sync Configuration",
"server_address": "Server instance address",
"timeout": "Sync timeout (milliseconds)",
"proxy_label": "Sync proxy server (optional)",
"note": "Note",
"note_description": "If you leave the proxy setting blank, the system proxy will be used (applies to desktop/electron build only).",
"special_value_description": "Another special value is <code>noproxy</code> which forces ignoring even the system proxy and respects <code>NODE_TLS_REJECT_UNAUTHORIZED</code>.",
"save": "Save",
"help": "Help",
"test_title": "Sync Test",
"test_description": "This will test the connection and handshake to the sync server. If the sync server isn't initialized, this will set it up to sync with the local document.",
"test_button": "Test sync",
"handshake_failed": "Sync server handshake failed, error: {{message}}"
}
}