mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-01-09 04:08:16 +08:00
Use client side translation for public login page
The translation strings are meant to be synced from Transifex.
This commit is contained in:
parent
c06817f4eb
commit
ac91c1348b
@ -78,7 +78,11 @@ repos:
|
|||||||
m4/.* |
|
m4/.* |
|
||||||
src/base/3rdparty/.* |
|
src/base/3rdparty/.* |
|
||||||
src/searchengine/nova3/socks.py |
|
src/searchengine/nova3/socks.py |
|
||||||
src/webui/www/private/scripts/lib/.*
|
src/webui/www/private/lang/.* |
|
||||||
|
src/webui/www/private/scripts/lib/.* |
|
||||||
|
src/webui/www/public/lang/.* |
|
||||||
|
src/webui/www/public/scripts/lib/.* |
|
||||||
|
src/webui/www/transifex/.*
|
||||||
)$
|
)$
|
||||||
exclude_types:
|
exclude_types:
|
||||||
- ts
|
- ts
|
||||||
@ -102,7 +106,11 @@ repos:
|
|||||||
m4/.* |
|
m4/.* |
|
||||||
src/base/3rdparty/.* |
|
src/base/3rdparty/.* |
|
||||||
src/searchengine/nova3/socks.py |
|
src/searchengine/nova3/socks.py |
|
||||||
src/webui/www/private/scripts/lib/.*
|
src/webui/www/private/lang/.* |
|
||||||
|
src/webui/www/private/scripts/lib/.* |
|
||||||
|
src/webui/www/public/lang/.* |
|
||||||
|
src/webui/www/public/scripts/lib/.* |
|
||||||
|
src/webui/www/transifex/.*
|
||||||
)$
|
)$
|
||||||
exclude_types:
|
exclude_types:
|
||||||
- svg
|
- svg
|
||||||
|
@ -17,6 +17,14 @@ type = QT
|
|||||||
minimum_perc = 23
|
minimum_perc = 23
|
||||||
lang_map = pt: pt_PT, zh: zh_CN
|
lang_map = pt: pt_PT, zh: zh_CN
|
||||||
|
|
||||||
|
[o:sledgehammer999:p:qbittorrent:r:qbittorrent_webui_json]
|
||||||
|
file_filter = src/webui/www/transifex/<lang>.json
|
||||||
|
source_file = src/webui/www/transifex/en.json
|
||||||
|
source_lang = en
|
||||||
|
type = KEYVALUEJSON
|
||||||
|
minimum_perc = 23
|
||||||
|
lang_map = pt: pt_PT, zh: zh_CN
|
||||||
|
|
||||||
[o:sledgehammer999:p:qbittorrent:r:qbittorrentdesktop_master]
|
[o:sledgehammer999:p:qbittorrent:r:qbittorrentdesktop_master]
|
||||||
source_file = dist/unix/org.qbittorrent.qBittorrent.desktop
|
source_file = dist/unix/org.qbittorrent.qBittorrent.desktop
|
||||||
source_lang = en
|
source_lang = en
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
"url": "https://github.com/qbittorrent/qBittorrent.git"
|
"url": "https://github.com/qbittorrent/qBittorrent.git"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"extract_translation": "i18next -c public/i18next-parser.config.mjs public/index.html public/scripts/login.js",
|
||||||
"format": "js-beautify -r private/*.html private/scripts/*.js private/views/*.html public/*.html public/scripts/*.js && prettier --write **.css",
|
"format": "js-beautify -r private/*.html private/scripts/*.js private/views/*.html public/*.html public/scripts/*.js && prettier --write **.css",
|
||||||
"lint": "eslint private/*.html private/scripts/*.js private/views/*.html public/*.html public/scripts/*.js && stylelint **/*.css && html-validate private public"
|
"lint": "eslint private/*.html private/scripts/*.js private/views/*.html public/*.html public/scripts/*.js && stylelint **/*.css && html-validate private public"
|
||||||
},
|
},
|
||||||
@ -13,6 +14,7 @@
|
|||||||
"eslint": "*",
|
"eslint": "*",
|
||||||
"eslint-plugin-html": "*",
|
"eslint-plugin-html": "*",
|
||||||
"html-validate": "*",
|
"html-validate": "*",
|
||||||
|
"i18next-parser": "*",
|
||||||
"js-beautify": "*",
|
"js-beautify": "*",
|
||||||
"prettier": "*",
|
"prettier": "*",
|
||||||
"stylelint": "*",
|
"stylelint": "*",
|
||||||
|
@ -31,7 +31,7 @@ body {
|
|||||||
color: #f00;
|
color: #f00;
|
||||||
}
|
}
|
||||||
|
|
||||||
#login {
|
#loginButton {
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
10
src/webui/www/public/i18next-parser.config.mjs
Normal file
10
src/webui/www/public/i18next-parser.config.mjs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
export default {
|
||||||
|
createOldCatalogs: false,
|
||||||
|
failOnWarnings: true,
|
||||||
|
keySeparator: false,
|
||||||
|
lineEnding: 'lf',
|
||||||
|
locales: ['en'],
|
||||||
|
namespaceSeparator: false,
|
||||||
|
output: 'public/lang/$LOCALE.json',
|
||||||
|
sort: true
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="${LANG}">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
@ -16,7 +16,8 @@
|
|||||||
<link rel="stylesheet" type="text/css" href="css/noscript.css?v=${CACHEID}" />
|
<link rel="stylesheet" type="text/css" href="css/noscript.css?v=${CACHEID}" />
|
||||||
</noscript>
|
</noscript>
|
||||||
|
|
||||||
<script defer src="scripts/login.js?locale=${LANG}&v=${CACHEID}"></script>
|
<script defer src="scripts/lib/i18next.min.js"></script>
|
||||||
|
<script defer src="scripts/login.js?v=${CACHEID}"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@ -29,17 +30,17 @@
|
|||||||
<img src="images/qbittorrent-tray.svg" alt="qBittorrent logo" />
|
<img src="images/qbittorrent-tray.svg" alt="qBittorrent logo" />
|
||||||
</div>
|
</div>
|
||||||
<div id="formplace" class="col">
|
<div id="formplace" class="col">
|
||||||
<form id="loginform" method="post" onsubmit="submitLoginForm(event);">
|
<form id="loginform">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<label for="username">Username</label><br />
|
<label for="username" class="qbt-translatable" data-i18n="Username">Username</label><br />
|
||||||
<input type="text" id="username" name="username" autocomplete="username" required />
|
<input type="text" id="username" name="username" autocomplete="username" autofocus required />
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<label for="password">Password</label><br />
|
<label for="password" class="qbt-translatable" data-i18n="Password">Password</label><br />
|
||||||
<input type="password" id="password" name="password" autocomplete="current-password" required />
|
<input type="password" id="password" name="password" autocomplete="current-password" required />
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<input type="submit" id="login" value="Login" />
|
<input type="submit" id="loginButton" class="qbt-translatable" data-i18n="Login" value="Login" />
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
7
src/webui/www/public/lang/ar.json
Normal file
7
src/webui/www/public/lang/ar.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/az@latin.json
Normal file
7
src/webui/www/public/lang/az@latin.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/be.json
Normal file
7
src/webui/www/public/lang/be.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/bg.json
Normal file
7
src/webui/www/public/lang/bg.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/ca.json
Normal file
7
src/webui/www/public/lang/ca.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/cs.json
Normal file
7
src/webui/www/public/lang/cs.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/da.json
Normal file
7
src/webui/www/public/lang/da.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/de.json
Normal file
7
src/webui/www/public/lang/de.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/el.json
Normal file
7
src/webui/www/public/lang/el.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/en.json
Normal file
7
src/webui/www/public/lang/en.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "Invalid Username or Password.",
|
||||||
|
"Login": "Login",
|
||||||
|
"Password": "Password",
|
||||||
|
"Unable to log in, server is probably unreachable.": "Unable to log in, server is probably unreachable.",
|
||||||
|
"Username": "Username"
|
||||||
|
}
|
7
src/webui/www/public/lang/en_AU.json
Normal file
7
src/webui/www/public/lang/en_AU.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/en_GB.json
Normal file
7
src/webui/www/public/lang/en_GB.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/eo.json
Normal file
7
src/webui/www/public/lang/eo.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/es.json
Normal file
7
src/webui/www/public/lang/es.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/et.json
Normal file
7
src/webui/www/public/lang/et.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/eu.json
Normal file
7
src/webui/www/public/lang/eu.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/fa.json
Normal file
7
src/webui/www/public/lang/fa.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/fi.json
Normal file
7
src/webui/www/public/lang/fi.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/fr.json
Normal file
7
src/webui/www/public/lang/fr.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/gl.json
Normal file
7
src/webui/www/public/lang/gl.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/he.json
Normal file
7
src/webui/www/public/lang/he.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/hi_IN.json
Normal file
7
src/webui/www/public/lang/hi_IN.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/hr.json
Normal file
7
src/webui/www/public/lang/hr.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/hu.json
Normal file
7
src/webui/www/public/lang/hu.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/hy.json
Normal file
7
src/webui/www/public/lang/hy.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/id.json
Normal file
7
src/webui/www/public/lang/id.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/is.json
Normal file
7
src/webui/www/public/lang/is.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/it.json
Normal file
7
src/webui/www/public/lang/it.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/ja.json
Normal file
7
src/webui/www/public/lang/ja.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/ka.json
Normal file
7
src/webui/www/public/lang/ka.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/ko.json
Normal file
7
src/webui/www/public/lang/ko.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/lt.json
Normal file
7
src/webui/www/public/lang/lt.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/ltg.json
Normal file
7
src/webui/www/public/lang/ltg.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/lv_LV.json
Normal file
7
src/webui/www/public/lang/lv_LV.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/mn_MN.json
Normal file
7
src/webui/www/public/lang/mn_MN.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/ms_MY.json
Normal file
7
src/webui/www/public/lang/ms_MY.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/nb.json
Normal file
7
src/webui/www/public/lang/nb.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/nl.json
Normal file
7
src/webui/www/public/lang/nl.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/oc.json
Normal file
7
src/webui/www/public/lang/oc.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/pl.json
Normal file
7
src/webui/www/public/lang/pl.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/pt_BR.json
Normal file
7
src/webui/www/public/lang/pt_BR.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/pt_PT.json
Normal file
7
src/webui/www/public/lang/pt_PT.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/ro.json
Normal file
7
src/webui/www/public/lang/ro.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/ru.json
Normal file
7
src/webui/www/public/lang/ru.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/sk.json
Normal file
7
src/webui/www/public/lang/sk.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/sl.json
Normal file
7
src/webui/www/public/lang/sl.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/sr.json
Normal file
7
src/webui/www/public/lang/sr.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/sv.json
Normal file
7
src/webui/www/public/lang/sv.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/th.json
Normal file
7
src/webui/www/public/lang/th.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/tr.json
Normal file
7
src/webui/www/public/lang/tr.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/uk.json
Normal file
7
src/webui/www/public/lang/uk.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/uz@Latn.json
Normal file
7
src/webui/www/public/lang/uz@Latn.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/vi.json
Normal file
7
src/webui/www/public/lang/vi.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/zh_CN.json
Normal file
7
src/webui/www/public/lang/zh_CN.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/zh_HK.json
Normal file
7
src/webui/www/public/lang/zh_HK.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
7
src/webui/www/public/lang/zh_TW.json
Normal file
7
src/webui/www/public/lang/zh_TW.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"Invalid Username or Password.": "",
|
||||||
|
"Login": "",
|
||||||
|
"Password": "",
|
||||||
|
"Unable to log in, server is probably unreachable.": "",
|
||||||
|
"Username": ""
|
||||||
|
}
|
1
src/webui/www/public/scripts/lib/i18next.min.js
vendored
Normal file
1
src/webui/www/public/scripts/lib/i18next.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Bittorrent Client using Qt and libtorrent.
|
* Bittorrent Client using Qt and libtorrent.
|
||||||
* Copyright (C) 2019 Mike Tzou (Chocobo1)
|
* Copyright (C) 2019-2024 Mike Tzou (Chocobo1)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
@ -28,10 +28,64 @@
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
async function setupI18n() {
|
||||||
document.getElementById('username').focus();
|
const languages = (() => {
|
||||||
document.getElementById('username').select();
|
const langs = new Set();
|
||||||
});
|
for (const lang of navigator.languages) {
|
||||||
|
langs.add(lang.replace('-', '_'));
|
||||||
|
|
||||||
|
const idx = lang.indexOf('-');
|
||||||
|
if (idx > 0)
|
||||||
|
langs.add(lang.slice(0, idx));
|
||||||
|
}
|
||||||
|
langs.add('en'); // fallback
|
||||||
|
return Array.from(langs);
|
||||||
|
})();
|
||||||
|
|
||||||
|
// it is faster to fetch all translation files at once than one by one
|
||||||
|
const fetches = languages.map(lang => fetch(`lang/${lang}.json`));
|
||||||
|
const fetchResults = await Promise.allSettled(fetches);
|
||||||
|
const translations = fetchResults
|
||||||
|
.map((value, idx) => ({ lang: languages[idx], result: value }))
|
||||||
|
.filter(v => (v.result.value.status === 200));
|
||||||
|
const translation = {
|
||||||
|
lang: (translations.length > 0) ? translations[0].lang.replace('_', '-') : undefined,
|
||||||
|
data: (translations.length > 0) ? (await translations[0].result.value.json()) : {}
|
||||||
|
};
|
||||||
|
|
||||||
|
// present it to i18next
|
||||||
|
const i18nextOptions = {
|
||||||
|
lng: translation.lang,
|
||||||
|
fallbackLng: false,
|
||||||
|
load: 'currentOnly',
|
||||||
|
resources: {
|
||||||
|
[translation.lang]: { translation: translation.data }
|
||||||
|
},
|
||||||
|
returnEmptyString: false
|
||||||
|
};
|
||||||
|
i18next.init(i18nextOptions, replaceI18nText);
|
||||||
|
}
|
||||||
|
|
||||||
|
function replaceI18nText() {
|
||||||
|
const tr = i18next.t; // workaround for warnings from i18next-parser
|
||||||
|
for (const element of document.getElementsByClassName('qbt-translatable')) {
|
||||||
|
const translationKey = element.getAttribute('data-i18n');
|
||||||
|
const translatedValue = tr(translationKey);
|
||||||
|
switch (element.nodeName) {
|
||||||
|
case 'INPUT':
|
||||||
|
element.value = translatedValue;
|
||||||
|
break;
|
||||||
|
case 'LABEL':
|
||||||
|
element.textContent = translatedValue;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
console.error(`Unhandled element: ${element}`);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
document.documentElement.lang = i18next.language.split('-')[0];
|
||||||
|
}
|
||||||
|
|
||||||
function submitLoginForm(event) {
|
function submitLoginForm(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
@ -40,18 +94,18 @@ function submitLoginForm(event) {
|
|||||||
const xhr = new XMLHttpRequest();
|
const xhr = new XMLHttpRequest();
|
||||||
xhr.open('POST', 'api/v2/auth/login', true);
|
xhr.open('POST', 'api/v2/auth/login', true);
|
||||||
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded; charset=UTF-8');
|
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded; charset=UTF-8');
|
||||||
xhr.addEventListener('readystatechange', function() {
|
xhr.addEventListener('readystatechange', () => {
|
||||||
if (xhr.readyState === 4) { // DONE state
|
if (xhr.readyState === 4) { // DONE state
|
||||||
if ((xhr.status === 200) && (xhr.responseText === "Ok."))
|
if ((xhr.status === 200) && (xhr.responseText === "Ok."))
|
||||||
location.replace(location);
|
location.replace(location);
|
||||||
else
|
else
|
||||||
errorMsgElement.textContent = 'Invalid Username or Password.';
|
errorMsgElement.textContent = i18next.t('Invalid Username or Password.');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
xhr.addEventListener('error', function() {
|
xhr.addEventListener('error', () => {
|
||||||
errorMsgElement.textContent = (xhr.responseText !== "")
|
errorMsgElement.textContent = (xhr.responseText !== "")
|
||||||
? xhr.responseText
|
? xhr.responseText
|
||||||
: 'Unable to log in, qBittorrent is probably unreachable.';
|
: i18next.t('Unable to log in, server is probably unreachable.');
|
||||||
});
|
});
|
||||||
|
|
||||||
const usernameElement = document.getElementById('username');
|
const usernameElement = document.getElementById('username');
|
||||||
@ -62,3 +116,11 @@ function submitLoginForm(event) {
|
|||||||
// clear the field
|
// clear the field
|
||||||
passwordElement.value = '';
|
passwordElement.value = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
const loginForm = document.getElementById('loginform');
|
||||||
|
loginForm.setAttribute('method', 'POST');
|
||||||
|
loginForm.addEventListener('submit', submitLoginForm);
|
||||||
|
|
||||||
|
setupI18n();
|
||||||
|
});
|
||||||
|
@ -423,6 +423,63 @@
|
|||||||
<file>public/images/qbittorrent-tray.svg</file>
|
<file>public/images/qbittorrent-tray.svg</file>
|
||||||
<file>public/images/qbittorrent32.png</file>
|
<file>public/images/qbittorrent32.png</file>
|
||||||
<file>public/index.html</file>
|
<file>public/index.html</file>
|
||||||
|
<file>public/lang/ar.json</file>
|
||||||
|
<file>public/lang/az@latin.json</file>
|
||||||
|
<file>public/lang/be.json</file>
|
||||||
|
<file>public/lang/bg.json</file>
|
||||||
|
<file>public/lang/ca.json</file>
|
||||||
|
<file>public/lang/cs.json</file>
|
||||||
|
<file>public/lang/da.json</file>
|
||||||
|
<file>public/lang/de.json</file>
|
||||||
|
<file>public/lang/el.json</file>
|
||||||
|
<file>public/lang/en.json</file>
|
||||||
|
<file>public/lang/en_AU.json</file>
|
||||||
|
<file>public/lang/en_GB.json</file>
|
||||||
|
<file>public/lang/eo.json</file>
|
||||||
|
<file>public/lang/es.json</file>
|
||||||
|
<file>public/lang/et.json</file>
|
||||||
|
<file>public/lang/eu.json</file>
|
||||||
|
<file>public/lang/fa.json</file>
|
||||||
|
<file>public/lang/fi.json</file>
|
||||||
|
<file>public/lang/fr.json</file>
|
||||||
|
<file>public/lang/gl.json</file>
|
||||||
|
<file>public/lang/he.json</file>
|
||||||
|
<file>public/lang/hi_IN.json</file>
|
||||||
|
<file>public/lang/hr.json</file>
|
||||||
|
<file>public/lang/hu.json</file>
|
||||||
|
<file>public/lang/hy.json</file>
|
||||||
|
<file>public/lang/id.json</file>
|
||||||
|
<file>public/lang/is.json</file>
|
||||||
|
<file>public/lang/it.json</file>
|
||||||
|
<file>public/lang/ja.json</file>
|
||||||
|
<file>public/lang/ka.json</file>
|
||||||
|
<file>public/lang/ko.json</file>
|
||||||
|
<file>public/lang/lt.json</file>
|
||||||
|
<file>public/lang/ltg.json</file>
|
||||||
|
<file>public/lang/lv_LV.json</file>
|
||||||
|
<file>public/lang/mn_MN.json</file>
|
||||||
|
<file>public/lang/ms_MY.json</file>
|
||||||
|
<file>public/lang/nb.json</file>
|
||||||
|
<file>public/lang/nl.json</file>
|
||||||
|
<file>public/lang/oc.json</file>
|
||||||
|
<file>public/lang/pl.json</file>
|
||||||
|
<file>public/lang/pt_BR.json</file>
|
||||||
|
<file>public/lang/pt_PT.json</file>
|
||||||
|
<file>public/lang/ro.json</file>
|
||||||
|
<file>public/lang/ru.json</file>
|
||||||
|
<file>public/lang/sk.json</file>
|
||||||
|
<file>public/lang/sl.json</file>
|
||||||
|
<file>public/lang/sr.json</file>
|
||||||
|
<file>public/lang/sv.json</file>
|
||||||
|
<file>public/lang/th.json</file>
|
||||||
|
<file>public/lang/tr.json</file>
|
||||||
|
<file>public/lang/uk.json</file>
|
||||||
|
<file>public/lang/uz@Latn.json</file>
|
||||||
|
<file>public/lang/vi.json</file>
|
||||||
|
<file>public/lang/zh_CN.json</file>
|
||||||
|
<file>public/lang/zh_HK.json</file>
|
||||||
|
<file>public/lang/zh_TW.json</file>
|
||||||
|
<file>public/scripts/lib/i18next.min.js</file>
|
||||||
<file>public/scripts/login.js</file>
|
<file>public/scripts/login.js</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
Loading…
Reference in New Issue
Block a user