diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 711d09596..a910f1c77 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -78,7 +78,11 @@ repos: m4/.* | src/base/3rdparty/.* | 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: - ts @@ -102,7 +106,11 @@ repos: m4/.* | src/base/3rdparty/.* | 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: - svg diff --git a/.tx/config b/.tx/config index 95d5b1afa..593cf8675 100644 --- a/.tx/config +++ b/.tx/config @@ -17,6 +17,14 @@ type = QT minimum_perc = 23 lang_map = pt: pt_PT, zh: zh_CN +[o:sledgehammer999:p:qbittorrent:r:qbittorrent_webui_json] +file_filter = src/webui/www/transifex/.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] source_file = dist/unix/org.qbittorrent.qBittorrent.desktop source_lang = en diff --git a/src/webui/www/package.json b/src/webui/www/package.json index f62e214f5..fe3c45704 100644 --- a/src/webui/www/package.json +++ b/src/webui/www/package.json @@ -6,6 +6,7 @@ "url": "https://github.com/qbittorrent/qBittorrent.git" }, "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", "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-plugin-html": "*", "html-validate": "*", + "i18next-parser": "*", "js-beautify": "*", "prettier": "*", "stylelint": "*", diff --git a/src/webui/www/public/css/login.css b/src/webui/www/public/css/login.css index f807b4629..fd72f94fb 100644 --- a/src/webui/www/public/css/login.css +++ b/src/webui/www/public/css/login.css @@ -31,7 +31,7 @@ body { color: #f00; } -#login { +#loginButton { float: right; } diff --git a/src/webui/www/public/i18next-parser.config.mjs b/src/webui/www/public/i18next-parser.config.mjs new file mode 100644 index 000000000..7d1889618 --- /dev/null +++ b/src/webui/www/public/i18next-parser.config.mjs @@ -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 +} diff --git a/src/webui/www/public/index.html b/src/webui/www/public/index.html index 235f70dee..31a1ad482 100644 --- a/src/webui/www/public/index.html +++ b/src/webui/www/public/index.html @@ -1,5 +1,5 @@ - + @@ -16,7 +16,8 @@ - + + @@ -29,17 +30,17 @@ qBittorrent logo
-
+
-
- +
+
-
+
- +
diff --git a/src/webui/www/public/lang/ar.json b/src/webui/www/public/lang/ar.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/ar.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/az@latin.json b/src/webui/www/public/lang/az@latin.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/az@latin.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/be.json b/src/webui/www/public/lang/be.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/be.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/bg.json b/src/webui/www/public/lang/bg.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/bg.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/ca.json b/src/webui/www/public/lang/ca.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/ca.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/cs.json b/src/webui/www/public/lang/cs.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/cs.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/da.json b/src/webui/www/public/lang/da.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/da.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/de.json b/src/webui/www/public/lang/de.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/de.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/el.json b/src/webui/www/public/lang/el.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/el.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/en.json b/src/webui/www/public/lang/en.json new file mode 100644 index 000000000..44c903470 --- /dev/null +++ b/src/webui/www/public/lang/en.json @@ -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" +} diff --git a/src/webui/www/public/lang/en_AU.json b/src/webui/www/public/lang/en_AU.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/en_AU.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/en_GB.json b/src/webui/www/public/lang/en_GB.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/en_GB.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/eo.json b/src/webui/www/public/lang/eo.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/eo.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/es.json b/src/webui/www/public/lang/es.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/es.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/et.json b/src/webui/www/public/lang/et.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/et.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/eu.json b/src/webui/www/public/lang/eu.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/eu.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/fa.json b/src/webui/www/public/lang/fa.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/fa.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/fi.json b/src/webui/www/public/lang/fi.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/fi.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/fr.json b/src/webui/www/public/lang/fr.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/fr.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/gl.json b/src/webui/www/public/lang/gl.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/gl.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/he.json b/src/webui/www/public/lang/he.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/he.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/hi_IN.json b/src/webui/www/public/lang/hi_IN.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/hi_IN.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/hr.json b/src/webui/www/public/lang/hr.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/hr.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/hu.json b/src/webui/www/public/lang/hu.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/hu.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/hy.json b/src/webui/www/public/lang/hy.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/hy.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/id.json b/src/webui/www/public/lang/id.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/id.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/is.json b/src/webui/www/public/lang/is.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/is.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/it.json b/src/webui/www/public/lang/it.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/it.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/ja.json b/src/webui/www/public/lang/ja.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/ja.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/ka.json b/src/webui/www/public/lang/ka.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/ka.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/ko.json b/src/webui/www/public/lang/ko.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/ko.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/lt.json b/src/webui/www/public/lang/lt.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/lt.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/ltg.json b/src/webui/www/public/lang/ltg.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/ltg.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/lv_LV.json b/src/webui/www/public/lang/lv_LV.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/lv_LV.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/mn_MN.json b/src/webui/www/public/lang/mn_MN.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/mn_MN.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/ms_MY.json b/src/webui/www/public/lang/ms_MY.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/ms_MY.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/nb.json b/src/webui/www/public/lang/nb.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/nb.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/nl.json b/src/webui/www/public/lang/nl.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/nl.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/oc.json b/src/webui/www/public/lang/oc.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/oc.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/pl.json b/src/webui/www/public/lang/pl.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/pl.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/pt_BR.json b/src/webui/www/public/lang/pt_BR.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/pt_BR.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/pt_PT.json b/src/webui/www/public/lang/pt_PT.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/pt_PT.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/ro.json b/src/webui/www/public/lang/ro.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/ro.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/ru.json b/src/webui/www/public/lang/ru.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/ru.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/sk.json b/src/webui/www/public/lang/sk.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/sk.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/sl.json b/src/webui/www/public/lang/sl.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/sl.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/sr.json b/src/webui/www/public/lang/sr.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/sr.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/sv.json b/src/webui/www/public/lang/sv.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/sv.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/th.json b/src/webui/www/public/lang/th.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/th.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/tr.json b/src/webui/www/public/lang/tr.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/tr.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/uk.json b/src/webui/www/public/lang/uk.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/uk.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/uz@Latn.json b/src/webui/www/public/lang/uz@Latn.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/uz@Latn.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/vi.json b/src/webui/www/public/lang/vi.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/vi.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/zh_CN.json b/src/webui/www/public/lang/zh_CN.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/zh_CN.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/zh_HK.json b/src/webui/www/public/lang/zh_HK.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/zh_HK.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/lang/zh_TW.json b/src/webui/www/public/lang/zh_TW.json new file mode 100644 index 000000000..69a29e028 --- /dev/null +++ b/src/webui/www/public/lang/zh_TW.json @@ -0,0 +1,7 @@ +{ + "Invalid Username or Password.": "", + "Login": "", + "Password": "", + "Unable to log in, server is probably unreachable.": "", + "Username": "" +} diff --git a/src/webui/www/public/scripts/lib/i18next.min.js b/src/webui/www/public/scripts/lib/i18next.min.js new file mode 100644 index 000000000..95aef8eed --- /dev/null +++ b/src/webui/www/public/scripts/lib/i18next.min.js @@ -0,0 +1 @@ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).i18next=e()}(this,(function(){"use strict";const t={type:"logger",log(t){this.output("log",t)},warn(t){this.output("warn",t)},error(t){this.output("error",t)},output(t,e){console&&console[t]&&console[t].apply(console,e)}};class e{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.init(t,e)}init(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=s.prefix||"i18next:",this.logger=e||t,this.options=s,this.debug=s.debug}log(){for(var t=arguments.length,e=new Array(t),s=0;s{this.observers[t]||(this.observers[t]=new Map);const s=this.observers[t].get(e)||0;this.observers[t].set(e,s+1)})),this}off(t,e){this.observers[t]&&(e?this.observers[t].delete(e):delete this.observers[t])}emit(t){for(var e=arguments.length,s=new Array(e>1?e-1:0),i=1;i{let[e,i]=t;for(let t=0;t{let[i,n]=e;for(let e=0;e{t=s,e=i}));return s.resolve=t,s.reject=e,s}function o(t){return null==t?"":""+t}const r=/###/g;function a(t,e,s){function i(t){return t&&t.indexOf("###")>-1?t.replace(r,"."):t}function n(){return!t||"string"==typeof t}const o="string"!=typeof e?e:e.split(".");let a=0;for(;a":">",'"':""","'":"'","/":"/"};function g(t){return"string"==typeof t?t.replace(/[&<>"'\/]/g,(t=>c[t])):t}const d=[" ",",","?","!",";"],f=new class{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const e=this.regExpMap.get(t);if(void 0!==e)return e;const s=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,s),this.regExpQueue.push(t),s}}(20);function m(t,e){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(!t)return;if(t[e])return t[e];const i=e.split(s);let n=t;for(let t=0;t-1&&r0?t.replace("_","-"):t}class v extends i{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=t||{},this.options=e,void 0===this.options.keySeparator&&(this.options.keySeparator="."),void 0===this.options.ignoreJSONStructure&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const e=this.options.ns.indexOf(t);e>-1&&this.options.ns.splice(e,1)}getResource(t,e,s){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const n=void 0!==i.keySeparator?i.keySeparator:this.options.keySeparator,o=void 0!==i.ignoreJSONStructure?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let r;t.indexOf(".")>-1?r=t.split("."):(r=[t,e],s&&(Array.isArray(s)?r.push(...s):"string"==typeof s&&n?r.push(...s.split(n)):r.push(s)));const a=u(this.data,r);return!a&&!e&&!s&&t.indexOf(".")>-1&&(t=r[0],e=r[1],s=r.slice(2).join(".")),a||!o||"string"!=typeof s?a:m(this.data&&this.data[t]&&this.data[t][e],s,n)}addResource(t,e,s,i){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1};const o=void 0!==n.keySeparator?n.keySeparator:this.options.keySeparator;let r=[t,e];s&&(r=r.concat(o?s.split(o):s)),t.indexOf(".")>-1&&(r=t.split("."),i=e,e=r[1]),this.addNamespaces(e),l(this.data,r,i),n.silent||this.emit("added",t,e,s,i)}addResources(t,e,s){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(const i in s)"string"!=typeof s[i]&&"[object Array]"!==Object.prototype.toString.apply(s[i])||this.addResource(t,e,i,s[i],{silent:!0});i.silent||this.emit("added",t,e,s)}addResourceBundle(t,e,s,i,n){let o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1,skipCopy:!1},r=[t,e];t.indexOf(".")>-1&&(r=t.split("."),i=s,s=e,e=r[1]),this.addNamespaces(e);let a=u(this.data,r)||{};o.skipCopy||(s=JSON.parse(JSON.stringify(s))),i?h(a,s,n):a={...a,...s},l(this.data,r,a),o.silent||this.emit("added",t,e,s)}removeResourceBundle(t,e){this.hasResourceBundle(t,e)&&delete this.data[t][e],this.removeNamespaces(e),this.emit("removed",t,e)}hasResourceBundle(t,e){return void 0!==this.getResource(t,e)}getResourceBundle(t,e){return e||(e=this.options.defaultNS),"v1"===this.options.compatibilityAPI?{...this.getResource(t,e)}:this.getResource(t,e)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const e=this.getDataByLanguage(t);return!!(e&&Object.keys(e)||[]).find((t=>e[t]&&Object.keys(e[t]).length>0))}toJSON(){return this.data}}var b={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,s,i,n){return t.forEach((t=>{this.processors[t]&&(e=this.processors[t].process(e,s,i,n))})),e}};const x={};class S extends i{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,n;super(),i=t,n=this,["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"].forEach((t=>{i[t]&&(n[t]=i[t])})),this.options=e,void 0===this.options.keySeparator&&(this.options.keySeparator="."),this.logger=s.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(null==t)return!1;const s=this.resolve(t,e);return s&&void 0!==s.res}extractFromKey(t,e){let s=void 0!==e.nsSeparator?e.nsSeparator:this.options.nsSeparator;void 0===s&&(s=":");const i=void 0!==e.keySeparator?e.keySeparator:this.options.keySeparator;let n=e.ns||this.options.defaultNS||[];const o=s&&t.indexOf(s)>-1,r=!(this.options.userDefinedKeySeparator||e.keySeparator||this.options.userDefinedNsSeparator||e.nsSeparator||function(t,e,s){e=e||"",s=s||"";const i=d.filter((t=>e.indexOf(t)<0&&s.indexOf(t)<0));if(0===i.length)return!0;const n=f.getRegExp(`(${i.map((t=>"?"===t?"\\?":t)).join("|")})`);let o=!n.test(t);if(!o){const e=t.indexOf(s);e>0&&!n.test(t.substring(0,e))&&(o=!0)}return o}(t,s,i));if(o&&!r){const e=t.match(this.interpolator.nestingRegexp);if(e&&e.length>0)return{key:t,namespaces:n};const o=t.split(s);(s!==i||s===i&&this.options.ns.indexOf(o[0])>-1)&&(n=o.shift()),t=o.join(i)}return"string"==typeof n&&(n=[n]),{key:t,namespaces:n}}translate(t,e,s){if("object"!=typeof e&&this.options.overloadTranslationOptionHandler&&(e=this.options.overloadTranslationOptionHandler(arguments)),"object"==typeof e&&(e={...e}),e||(e={}),null==t)return"";Array.isArray(t)||(t=[String(t)]);const i=void 0!==e.returnDetails?e.returnDetails:this.options.returnDetails,n=void 0!==e.keySeparator?e.keySeparator:this.options.keySeparator,{key:o,namespaces:r}=this.extractFromKey(t[t.length-1],e),a=r[r.length-1],l=e.lng||this.language,u=e.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(l&&"cimode"===l.toLowerCase()){if(u){const t=e.nsSeparator||this.options.nsSeparator;return i?{res:`${a}${t}${o}`,usedKey:o,exactUsedKey:o,usedLng:l,usedNS:a,usedParams:this.getUsedParamsDetails(e)}:`${a}${t}${o}`}return i?{res:o,usedKey:o,exactUsedKey:o,usedLng:l,usedNS:a,usedParams:this.getUsedParamsDetails(e)}:o}const h=this.resolve(t,e);let p=h&&h.res;const c=h&&h.usedKey||o,g=h&&h.exactUsedKey||o,d=Object.prototype.toString.apply(p),f=void 0!==e.joinArrays?e.joinArrays:this.options.joinArrays,m=!this.i18nFormat||this.i18nFormat.handleAsObject;if(m&&p&&("string"!=typeof p&&"boolean"!=typeof p&&"number"!=typeof p)&&["[object Number]","[object Function]","[object RegExp]"].indexOf(d)<0&&("string"!=typeof f||"[object Array]"!==d)){if(!e.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const t=this.options.returnedObjectHandler?this.options.returnedObjectHandler(c,p,{...e,ns:r}):`key '${o} (${this.language})' returned an object instead of string.`;return i?(h.res=t,h.usedParams=this.getUsedParamsDetails(e),h):t}if(n){const t="[object Array]"===d,s=t?[]:{},i=t?g:c;for(const t in p)if(Object.prototype.hasOwnProperty.call(p,t)){const o=`${i}${n}${t}`;s[t]=this.translate(o,{...e,joinArrays:!1,ns:r}),s[t]===o&&(s[t]=p[t])}p=s}}else if(m&&"string"==typeof f&&"[object Array]"===d)p=p.join(f),p&&(p=this.extendTranslation(p,t,e,s));else{let i=!1,r=!1;const u=void 0!==e.count&&"string"!=typeof e.count,c=S.hasDefaultValue(e),g=u?this.pluralResolver.getSuffix(l,e.count,e):"",d=e.ordinal&&u?this.pluralResolver.getSuffix(l,e.count,{ordinal:!1}):"",f=u&&!e.ordinal&&0===e.count&&this.pluralResolver.shouldUseIntlApi(),m=f&&e[`defaultValue${this.options.pluralSeparator}zero`]||e[`defaultValue${g}`]||e[`defaultValue${d}`]||e.defaultValue;!this.isValidLookup(p)&&c&&(i=!0,p=m),this.isValidLookup(p)||(r=!0,p=o);const y=(e.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&r?void 0:p,v=c&&m!==p&&this.options.updateMissing;if(r||i||v){if(this.logger.log(v?"updateKey":"missingKey",l,a,o,v?m:p),n){const t=this.resolve(o,{...e,keySeparator:!1});t&&t.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let t=[];const s=this.languageUtils.getFallbackCodes(this.options.fallbackLng,e.lng||this.language);if("fallback"===this.options.saveMissingTo&&s&&s[0])for(let e=0;e{const n=c&&i!==p?i:y;this.options.missingKeyHandler?this.options.missingKeyHandler(t,a,s,n,v,e):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(t,a,s,n,v,e),this.emit("missingKey",t,a,s,p)};this.options.saveMissing&&(this.options.saveMissingPlurals&&u?t.forEach((t=>{const s=this.pluralResolver.getSuffixes(t,e);f&&e[`defaultValue${this.options.pluralSeparator}zero`]&&s.indexOf(`${this.options.pluralSeparator}zero`)<0&&s.push(`${this.options.pluralSeparator}zero`),s.forEach((s=>{i([t],o+s,e[`defaultValue${s}`]||m)}))})):i(t,o,m))}p=this.extendTranslation(p,t,e,h,s),r&&p===o&&this.options.appendNamespaceToMissingKey&&(p=`${a}:${o}`),(r||i)&&this.options.parseMissingKeyHandler&&(p="v1"!==this.options.compatibilityAPI?this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${a}:${o}`:o,i?p:void 0):this.options.parseMissingKeyHandler(p))}return i?(h.res=p,h.usedParams=this.getUsedParamsDetails(e),h):p}extendTranslation(t,e,s,i,n){var o=this;if(this.i18nFormat&&this.i18nFormat.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...s},s.lng||this.language||i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!s.skipInterpolation){s.interpolation&&this.interpolator.init({...s,interpolation:{...this.options.interpolation,...s.interpolation}});const r="string"==typeof t&&(s&&s.interpolation&&void 0!==s.interpolation.skipOnVariables?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let a;if(r){const e=t.match(this.interpolator.nestingRegexp);a=e&&e.length}let l=s.replace&&"string"!=typeof s.replace?s.replace:s;if(this.options.interpolation.defaultVariables&&(l={...this.options.interpolation.defaultVariables,...l}),t=this.interpolator.interpolate(t,l,s.lng||this.language,s),r){const e=t.match(this.interpolator.nestingRegexp);a<(e&&e.length)&&(s.nest=!1)}!s.lng&&"v1"!==this.options.compatibilityAPI&&i&&i.res&&(s.lng=i.usedLng),!1!==s.nest&&(t=this.interpolator.nest(t,(function(){for(var t=arguments.length,i=new Array(t),r=0;r1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof t&&(t=[t]),t.forEach((t=>{if(this.isValidLookup(e))return;const a=this.extractFromKey(t,r),l=a.key;s=l;let u=a.namespaces;this.options.fallbackNS&&(u=u.concat(this.options.fallbackNS));const h=void 0!==r.count&&"string"!=typeof r.count,p=h&&!r.ordinal&&0===r.count&&this.pluralResolver.shouldUseIntlApi(),c=void 0!==r.context&&("string"==typeof r.context||"number"==typeof r.context)&&""!==r.context,g=r.lngs?r.lngs:this.languageUtils.toResolveHierarchy(r.lng||this.language,r.fallbackLng);u.forEach((t=>{this.isValidLookup(e)||(o=t,!x[`${g[0]}-${t}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(o)&&(x[`${g[0]}-${t}`]=!0,this.logger.warn(`key "${s}" for languages "${g.join(", ")}" won't get resolved as namespace "${o}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),g.forEach((s=>{if(this.isValidLookup(e))return;n=s;const o=[l];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(o,l,s,t,r);else{let t;h&&(t=this.pluralResolver.getSuffix(s,r.count,r));const e=`${this.options.pluralSeparator}zero`,i=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(h&&(o.push(l+t),r.ordinal&&0===t.indexOf(i)&&o.push(l+t.replace(i,this.options.pluralSeparator)),p&&o.push(l+e)),c){const s=`${l}${this.options.contextSeparator}${r.context}`;o.push(s),h&&(o.push(s+t),r.ordinal&&0===t.indexOf(i)&&o.push(s+t.replace(i,this.options.pluralSeparator)),p&&o.push(s+e))}}let a;for(;a=o.pop();)this.isValidLookup(e)||(i=a,e=this.getResource(s,t,a,r))})))}))})),{res:e,usedKey:s,exactUsedKey:i,usedLng:n,usedNS:o}}isValidLookup(t){return!(void 0===t||!this.options.returnNull&&null===t||!this.options.returnEmptyString&&""===t)}getResource(t,e,s){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(t,e,s,i):this.resourceStore.getResource(t,e,s,i)}getUsedParamsDetails(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],s=t.replace&&"string"!=typeof t.replace;let i=s?t.replace:t;if(s&&void 0!==t.count&&(i.count=t.count),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!s){i={...i};for(const t of e)delete i[t]}return i}static hasDefaultValue(t){const e="defaultValue";for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)&&e===s.substring(0,12)&&void 0!==t[s])return!0;return!1}}function k(t){return t.charAt(0).toUpperCase()+t.slice(1)}class O{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=s.create("languageUtils")}getScriptPartFromCode(t){if(!(t=y(t))||t.indexOf("-")<0)return null;const e=t.split("-");return 2===e.length?null:(e.pop(),"x"===e[e.length-1].toLowerCase()?null:this.formatLanguageCode(e.join("-")))}getLanguagePartFromCode(t){if(!(t=y(t))||t.indexOf("-")<0)return t;const e=t.split("-");return this.formatLanguageCode(e[0])}formatLanguageCode(t){if("string"==typeof t&&t.indexOf("-")>-1){const e=["hans","hant","latn","cyrl","cans","mong","arab"];let s=t.split("-");return this.options.lowerCaseLng?s=s.map((t=>t.toLowerCase())):2===s.length?(s[0]=s[0].toLowerCase(),s[1]=s[1].toUpperCase(),e.indexOf(s[1].toLowerCase())>-1&&(s[1]=k(s[1].toLowerCase()))):3===s.length&&(s[0]=s[0].toLowerCase(),2===s[1].length&&(s[1]=s[1].toUpperCase()),"sgn"!==s[0]&&2===s[2].length&&(s[2]=s[2].toUpperCase()),e.indexOf(s[1].toLowerCase())>-1&&(s[1]=k(s[1].toLowerCase())),e.indexOf(s[2].toLowerCase())>-1&&(s[2]=k(s[2].toLowerCase()))),s.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let e;return t.forEach((t=>{if(e)return;const s=this.formatLanguageCode(t);this.options.supportedLngs&&!this.isSupportedCode(s)||(e=s)})),!e&&this.options.supportedLngs&&t.forEach((t=>{if(e)return;const s=this.getLanguagePartFromCode(t);if(this.isSupportedCode(s))return e=s;e=this.options.supportedLngs.find((t=>t===s?t:t.indexOf("-")<0&&s.indexOf("-")<0?void 0:0===t.indexOf(s)?t:void 0))})),e||(e=this.getFallbackCodes(this.options.fallbackLng)[0]),e}getFallbackCodes(t,e){if(!t)return[];if("function"==typeof t&&(t=t(e)),"string"==typeof t&&(t=[t]),"[object Array]"===Object.prototype.toString.apply(t))return t;if(!e)return t.default||[];let s=t[e];return s||(s=t[this.getScriptPartFromCode(e)]),s||(s=t[this.formatLanguageCode(e)]),s||(s=t[this.getLanguagePartFromCode(e)]),s||(s=t.default),s||[]}toResolveHierarchy(t,e){const s=this.getFallbackCodes(e||this.options.fallbackLng||[],t),i=[],n=t=>{t&&(this.isSupportedCode(t)?i.push(t):this.logger.warn(`rejecting language code not found in supportedLngs: ${t}`))};return"string"==typeof t&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?("languageOnly"!==this.options.load&&n(this.formatLanguageCode(t)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&n(this.getScriptPartFromCode(t)),"currentOnly"!==this.options.load&&n(this.getLanguagePartFromCode(t))):"string"==typeof t&&n(this.formatLanguageCode(t)),s.forEach((t=>{i.indexOf(t)<0&&n(this.formatLanguageCode(t))})),i}}let L=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],w={1:function(t){return Number(t>1)},2:function(t){return Number(1!=t)},3:function(t){return 0},4:function(t){return Number(t%10==1&&t%100!=11?0:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?1:2)},5:function(t){return Number(0==t?0:1==t?1:2==t?2:t%100>=3&&t%100<=10?3:t%100>=11?4:5)},6:function(t){return Number(1==t?0:t>=2&&t<=4?1:2)},7:function(t){return Number(1==t?0:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?1:2)},8:function(t){return Number(1==t?0:2==t?1:8!=t&&11!=t?2:3)},9:function(t){return Number(t>=2)},10:function(t){return Number(1==t?0:2==t?1:t<7?2:t<11?3:4)},11:function(t){return Number(1==t||11==t?0:2==t||12==t?1:t>2&&t<20?2:3)},12:function(t){return Number(t%10!=1||t%100==11)},13:function(t){return Number(0!==t)},14:function(t){return Number(1==t?0:2==t?1:3==t?2:3)},15:function(t){return Number(t%10==1&&t%100!=11?0:t%10>=2&&(t%100<10||t%100>=20)?1:2)},16:function(t){return Number(t%10==1&&t%100!=11?0:0!==t?1:2)},17:function(t){return Number(1==t||t%10==1&&t%100!=11?0:1)},18:function(t){return Number(0==t?0:1==t?1:2)},19:function(t){return Number(1==t?0:0==t||t%100>1&&t%100<11?1:t%100>10&&t%100<20?2:3)},20:function(t){return Number(1==t?0:0==t||t%100>0&&t%100<20?1:2)},21:function(t){return Number(t%100==1?1:t%100==2?2:t%100==3||t%100==4?3:0)},22:function(t){return Number(1==t?0:2==t?1:(t<0||t>10)&&t%10==0?2:3)}};const N=["v1","v2","v3"],$=["v4"],R={zero:0,one:1,two:2,few:3,many:4,other:5};class C{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.languageUtils=t,this.options=e,this.logger=s.create("pluralResolver"),this.options.compatibilityJSON&&!$.includes(this.options.compatibilityJSON)||"undefined"!=typeof Intl&&Intl.PluralRules||(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=function(){const t={};return L.forEach((e=>{e.lngs.forEach((s=>{t[s]={numbers:e.nr,plurals:w[e.fc]}}))})),t}()}addRule(t,e){this.rules[t]=e}getRule(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(y("dev"===t?"en":t),{type:e.ordinal?"ordinal":"cardinal"})}catch(t){return}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}needsPlural(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=this.getRule(t,e);return this.shouldUseIntlApi()?s&&s.resolvedOptions().pluralCategories.length>1:s&&s.numbers.length>1}getPluralFormsOfKey(t,e){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.getSuffixes(t,s).map((t=>`${e}${t}`))}getSuffixes(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=this.getRule(t,e);return s?this.shouldUseIntlApi()?s.resolvedOptions().pluralCategories.sort(((t,e)=>R[t]-R[e])).map((t=>`${this.options.prepend}${e.ordinal?`ordinal${this.options.prepend}`:""}${t}`)):s.numbers.map((s=>this.getSuffix(t,s,e))):[]}getSuffix(t,e){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=this.getRule(t,s);return i?this.shouldUseIntlApi()?`${this.options.prepend}${s.ordinal?`ordinal${this.options.prepend}`:""}${i.select(e)}`:this.getSuffixRetroCompatible(i,e):(this.logger.warn(`no plural rule found for: ${t}`),"")}getSuffixRetroCompatible(t,e){const s=t.noAbs?t.plurals(e):t.plurals(Math.abs(e));let i=t.numbers[s];this.options.simplifyPluralSuffix&&2===t.numbers.length&&1===t.numbers[0]&&(2===i?i="plural":1===i&&(i=""));const n=()=>this.options.prepend&&i.toString()?this.options.prepend+i.toString():i.toString();return"v1"===this.options.compatibilityJSON?1===i?"":"number"==typeof i?`_plural_${i.toString()}`:n():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===t.numbers.length&&1===t.numbers[0]?n():this.options.prepend&&s.toString()?this.options.prepend+s.toString():s.toString()}shouldUseIntlApi(){return!N.includes(this.options.compatibilityJSON)}}function P(t,e,s){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:".",n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],o=function(t,e,s){const i=u(t,s);return void 0!==i?i:u(e,s)}(t,e,s);return!o&&n&&"string"==typeof s&&(o=m(t,s,i),void 0===o&&(o=m(e,s,i))),o}class j{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.logger=s.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||(t=>t),this.init(t)}init(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});const e=t.interpolation;this.escape=void 0!==e.escape?e.escape:g,this.escapeValue=void 0===e.escapeValue||e.escapeValue,this.useRawValueToEscape=void 0!==e.useRawValueToEscape&&e.useRawValueToEscape,this.prefix=e.prefix?p(e.prefix):e.prefixEscaped||"{{",this.suffix=e.suffix?p(e.suffix):e.suffixEscaped||"}}",this.formatSeparator=e.formatSeparator?e.formatSeparator:e.formatSeparator||",",this.unescapePrefix=e.unescapeSuffix?"":e.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":e.unescapeSuffix||"",this.nestingPrefix=e.nestingPrefix?p(e.nestingPrefix):e.nestingPrefixEscaped||p("$t("),this.nestingSuffix=e.nestingSuffix?p(e.nestingSuffix):e.nestingSuffixEscaped||p(")"),this.nestingOptionsSeparator=e.nestingOptionsSeparator?e.nestingOptionsSeparator:e.nestingOptionsSeparator||",",this.maxReplaces=e.maxReplaces?e.maxReplaces:1e3,this.alwaysFormat=void 0!==e.alwaysFormat&&e.alwaysFormat,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(t,e)=>t&&t.source===e?(t.lastIndex=0,t):new RegExp(e,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(t,e,s,i){let n,r,a;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(t){return t.replace(/\$/g,"$$$$")}const h=t=>{if(t.indexOf(this.formatSeparator)<0){const n=P(e,l,t,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(n,void 0,s,{...i,...e,interpolationkey:t}):n}const n=t.split(this.formatSeparator),o=n.shift().trim(),r=n.join(this.formatSeparator).trim();return this.format(P(e,l,o,this.options.keySeparator,this.options.ignoreJSONStructure),r,s,{...i,...e,interpolationkey:o})};this.resetRegExp();const p=i&&i.missingInterpolationHandler||this.options.missingInterpolationHandler,c=i&&i.interpolation&&void 0!==i.interpolation.skipOnVariables?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:t=>u(t)},{regex:this.regexp,safeValue:t=>this.escapeValue?u(this.escape(t)):u(t)}].forEach((e=>{for(a=0;n=e.regex.exec(t);){const s=n[1].trim();if(r=h(s),void 0===r)if("function"==typeof p){const e=p(t,n,i);r="string"==typeof e?e:""}else if(i&&Object.prototype.hasOwnProperty.call(i,s))r="";else{if(c){r=n[0];continue}this.logger.warn(`missed to pass in variable ${s} for interpolating ${t}`),r=""}else"string"==typeof r||this.useRawValueToEscape||(r=o(r));const l=e.safeValue(r);if(t=t.replace(n[0],l),c?(e.regex.lastIndex+=r.length,e.regex.lastIndex-=n[0].length):e.regex.lastIndex=0,a++,a>=this.maxReplaces)break}})),t}nest(t,e){let s,i,n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};function a(t,e){const s=this.nestingOptionsSeparator;if(t.indexOf(s)<0)return t;const i=t.split(new RegExp(`${s}[ ]*{`));let o=`{${i[1]}`;t=i[0],o=this.interpolate(o,n);const r=o.match(/'/g),a=o.match(/"/g);(r&&r.length%2==0&&!a||a.length%2!=0)&&(o=o.replace(/'/g,'"'));try{n=JSON.parse(o),e&&(n={...e,...n})}catch(e){return this.logger.warn(`failed parsing options string in nesting for key ${t}`,e),`${t}${s}${o}`}return delete n.defaultValue,t}for(;s=this.nestingRegexp.exec(t);){let l=[];n={...r},n=n.replace&&"string"!=typeof n.replace?n.replace:n,n.applyPostProcessor=!1,delete n.defaultValue;let u=!1;if(-1!==s[0].indexOf(this.formatSeparator)&&!/{.*}/.test(s[1])){const t=s[1].split(this.formatSeparator).map((t=>t.trim()));s[1]=t.shift(),l=t,u=!0}if(i=e(a.call(this,s[1].trim(),n),n),i&&s[0]===t&&"string"!=typeof i)return i;"string"!=typeof i&&(i=o(i)),i||(this.logger.warn(`missed to resolve ${s[1]} for nesting ${t}`),i=""),u&&(i=l.reduce(((t,e)=>this.format(t,e,r.lng,{...r,interpolationkey:s[1].trim()})),i.trim())),t=t.replace(s[0],i),this.regexp.lastIndex=0}return t}}function E(t){const e={};return function(s,i,n){const o=i+JSON.stringify(n);let r=e[o];return r||(r=t(y(i),n),e[o]=r),r(s)}}class I{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.logger=s.create("formatter"),this.options=t,this.formats={number:E(((t,e)=>{const s=new Intl.NumberFormat(t,{...e});return t=>s.format(t)})),currency:E(((t,e)=>{const s=new Intl.NumberFormat(t,{...e,style:"currency"});return t=>s.format(t)})),datetime:E(((t,e)=>{const s=new Intl.DateTimeFormat(t,{...e});return t=>s.format(t)})),relativetime:E(((t,e)=>{const s=new Intl.RelativeTimeFormat(t,{...e});return t=>s.format(t,e.range||"day")})),list:E(((t,e)=>{const s=new Intl.ListFormat(t,{...e});return t=>s.format(t)}))},this.init(t)}init(t){const e=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=e.formatSeparator?e.formatSeparator:e.formatSeparator||","}add(t,e){this.formats[t.toLowerCase().trim()]=e}addCached(t,e){this.formats[t.toLowerCase().trim()]=E(e)}format(t,e,s){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return e.split(this.formatSeparator).reduce(((t,e)=>{const{formatName:n,formatOptions:o}=function(t){let e=t.toLowerCase().trim();const s={};if(t.indexOf("(")>-1){const i=t.split("(");e=i[0].toLowerCase().trim();const n=i[1].substring(0,i[1].length-1);"currency"===e&&n.indexOf(":")<0?s.currency||(s.currency=n.trim()):"relativetime"===e&&n.indexOf(":")<0?s.range||(s.range=n.trim()):n.split(";").forEach((t=>{if(!t)return;const[e,...i]=t.split(":"),n=i.join(":").trim().replace(/^'+|'+$/g,"");s[e.trim()]||(s[e.trim()]=n),"false"===n&&(s[e.trim()]=!1),"true"===n&&(s[e.trim()]=!0),isNaN(n)||(s[e.trim()]=parseInt(n,10))}))}return{formatName:e,formatOptions:s}}(e);if(this.formats[n]){let e=t;try{const r=i&&i.formatParams&&i.formatParams[i.interpolationkey]||{},a=r.locale||r.lng||i.locale||i.lng||s;e=this.formats[n](t,a,{...o,...i,...r})}catch(t){this.logger.warn(t)}return e}return this.logger.warn(`there was no format function for ${n}`),t}),t)}}class F extends i{constructor(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};super(),this.backend=t,this.store=e,this.services=i,this.languageUtils=i.languageUtils,this.options=n,this.logger=s.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=n.maxParallelReads||10,this.readingCalls=0,this.maxRetries=n.maxRetries>=0?n.maxRetries:5,this.retryTimeout=n.retryTimeout>=1?n.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(i,n.backend,n)}queueLoad(t,e,s,i){const n={},o={},r={},a={};return t.forEach((t=>{let i=!0;e.forEach((e=>{const r=`${t}|${e}`;!s.reload&&this.store.hasResourceBundle(t,e)?this.state[r]=2:this.state[r]<0||(1===this.state[r]?void 0===o[r]&&(o[r]=!0):(this.state[r]=1,i=!1,void 0===o[r]&&(o[r]=!0),void 0===n[r]&&(n[r]=!0),void 0===a[e]&&(a[e]=!0)))})),i||(r[t]=!0)})),(Object.keys(n).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(n),pending:Object.keys(o),toLoadLanguages:Object.keys(r),toLoadNamespaces:Object.keys(a)}}loaded(t,e,s){const i=t.split("|"),n=i[0],o=i[1];e&&this.emit("failedLoading",n,o,e),s&&this.store.addResourceBundle(n,o,s,void 0,void 0,{skipCopy:!0}),this.state[t]=e?-1:2;const r={};this.queue.forEach((s=>{!function(t,e,s,i){const{obj:n,k:o}=a(t,e,Object);n[o]=n[o]||[],i&&(n[o]=n[o].concat(s)),i||n[o].push(s)}(s.loaded,[n],o),function(t,e){void 0!==t.pending[e]&&(delete t.pending[e],t.pendingCount--)}(s,t),e&&s.errors.push(e),0!==s.pendingCount||s.done||(Object.keys(s.loaded).forEach((t=>{r[t]||(r[t]={});const e=s.loaded[t];e.length&&e.forEach((e=>{void 0===r[t][e]&&(r[t][e]=!0)}))})),s.done=!0,s.errors.length?s.callback(s.errors):s.callback())})),this.emit("loaded",r),this.queue=this.queue.filter((t=>!t.done))}read(t,e,s){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.retryTimeout,o=arguments.length>5?arguments[5]:void 0;if(!t.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads)return void this.waitingReads.push({lng:t,ns:e,fcName:s,tried:i,wait:n,callback:o});this.readingCalls++;const r=(r,a)=>{if(this.readingCalls--,this.waitingReads.length>0){const t=this.waitingReads.shift();this.read(t.lng,t.ns,t.fcName,t.tried,t.wait,t.callback)}r&&a&&i{this.read.call(this,t,e,s,i+1,2*n,o)}),n):o(r,a)},a=this.backend[s].bind(this.backend);if(2!==a.length)return a(t,e,r);try{const s=a(t,e);s&&"function"==typeof s.then?s.then((t=>r(null,t))).catch(r):r(null,s)}catch(t){r(t)}}prepareLoading(t,e){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();"string"==typeof t&&(t=this.languageUtils.toResolveHierarchy(t)),"string"==typeof e&&(e=[e]);const n=this.queueLoad(t,e,s,i);if(!n.toLoad.length)return n.pending.length||i(),null;n.toLoad.forEach((t=>{this.loadOne(t)}))}load(t,e,s){this.prepareLoading(t,e,{},s)}reload(t,e,s){this.prepareLoading(t,e,{reload:!0},s)}loadOne(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const s=t.split("|"),i=s[0],n=s[1];this.read(i,n,"read",void 0,void 0,((s,o)=>{s&&this.logger.warn(`${e}loading namespace ${n} for language ${i} failed`,s),!s&&o&&this.logger.log(`${e}loaded namespace ${n} for language ${i}`,o),this.loaded(t,s,o)}))}saveMissing(t,e,s,i,n){let o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},r=arguments.length>6&&void 0!==arguments[6]?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(e))this.logger.warn(`did not save key "${s}" as the namespace "${e}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");else if(null!=s&&""!==s){if(this.backend&&this.backend.create){const a={...o,isUpdate:n},l=this.backend.create.bind(this.backend);if(l.length<6)try{let n;n=5===l.length?l(t,e,s,i,a):l(t,e,s,i),n&&"function"==typeof n.then?n.then((t=>r(null,t))).catch(r):r(null,n)}catch(t){r(t)}else l(t,e,s,i,r,a)}t&&t[0]&&this.store.addResource(t[0],e,s,i)}}}function V(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(t){let e={};if("object"==typeof t[1]&&(e=t[1]),"string"==typeof t[1]&&(e.defaultValue=t[1]),"string"==typeof t[2]&&(e.tDescription=t[2]),"object"==typeof t[2]||"object"==typeof t[3]){const s=t[3]||t[2];Object.keys(s).forEach((t=>{e[t]=s[t]}))}return e},interpolation:{escapeValue:!0,format:t=>t,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function A(t){return"string"==typeof t.ns&&(t.ns=[t.ns]),"string"==typeof t.fallbackLng&&(t.fallbackLng=[t.fallbackLng]),"string"==typeof t.fallbackNS&&(t.fallbackNS=[t.fallbackNS]),t.supportedLngs&&t.supportedLngs.indexOf("cimode")<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),t}function D(){}class U extends i{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;var i;if(super(),this.options=A(t),this.services={},this.logger=s,this.modules={external:[]},i=this,Object.getOwnPropertyNames(Object.getPrototypeOf(i)).forEach((t=>{"function"==typeof i[t]&&(i[t]=i[t].bind(i))})),e&&!this.isInitialized&&!t.isClone){if(!this.options.initImmediate)return this.init(t,e),this;setTimeout((()=>{this.init(t,e)}),0)}}init(){var t=this;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,"function"==typeof e&&(i=e,e={}),!e.defaultNS&&!1!==e.defaultNS&&e.ns&&("string"==typeof e.ns?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));const o=V();function r(t){return t?"function"==typeof t?new t:t:null}if(this.options={...o,...this.options,...A(e)},"v1"!==this.options.compatibilityAPI&&(this.options.interpolation={...o.interpolation,...this.options.interpolation}),void 0!==e.keySeparator&&(this.options.userDefinedKeySeparator=e.keySeparator),void 0!==e.nsSeparator&&(this.options.userDefinedNsSeparator=e.nsSeparator),!this.options.isClone){let e;this.modules.logger?s.init(r(this.modules.logger),this.options):s.init(null,this.options),this.modules.formatter?e=this.modules.formatter:"undefined"!=typeof Intl&&(e=I);const i=new O(this.options);this.store=new v(this.options.resources,this.options);const n=this.services;n.logger=s,n.resourceStore=this.store,n.languageUtils=i,n.pluralResolver=new C(i,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!e||this.options.interpolation.format&&this.options.interpolation.format!==o.interpolation.format||(n.formatter=r(e),n.formatter.init(n,this.options),this.options.interpolation.format=n.formatter.format.bind(n.formatter)),n.interpolator=new j(this.options),n.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},n.backendConnector=new F(r(this.modules.backend),n.resourceStore,n,this.options),n.backendConnector.on("*",(function(e){for(var s=arguments.length,i=new Array(s>1?s-1:0),n=1;n1?s-1:0),n=1;n{t.init&&t.init(this)}))}if(this.format=this.options.interpolation.format,i||(i=D),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const t=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);t.length>0&&"dev"!==t[0]&&(this.options.lng=t[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach((e=>{this[e]=function(){return t.store[e](...arguments)}}));["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach((e=>{this[e]=function(){return t.store[e](...arguments),t}}));const a=n(),l=()=>{const t=(t,e)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),a.resolve(e),i(t,e)};if(this.languages&&"v1"!==this.options.compatibilityAPI&&!this.isInitialized)return t(null,this.t.bind(this));this.changeLanguage(this.options.lng,t)};return this.options.resources||!this.options.initImmediate?l():setTimeout(l,0),a}loadResources(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:D;const s="string"==typeof t?t:this.language;if("function"==typeof t&&(e=t),!this.options.resources||this.options.partialBundledLanguages){if(s&&"cimode"===s.toLowerCase()&&(!this.options.preload||0===this.options.preload.length))return e();const t=[],i=e=>{if(!e)return;if("cimode"===e)return;this.services.languageUtils.toResolveHierarchy(e).forEach((e=>{"cimode"!==e&&t.indexOf(e)<0&&t.push(e)}))};if(s)i(s);else{this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((t=>i(t)))}this.options.preload&&this.options.preload.forEach((t=>i(t))),this.services.backendConnector.load(t,this.options.ns,(t=>{t||this.resolvedLanguage||!this.language||this.setResolvedLanguage(this.language),e(t)}))}else e(null)}reloadResources(t,e,s){const i=n();return t||(t=this.languages),e||(e=this.options.ns),s||(s=D),this.services.backendConnector.reload(t,e,(t=>{i.resolve(),s(t)})),i}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===t.type&&(this.modules.backend=t),("logger"===t.type||t.log&&t.warn&&t.error)&&(this.modules.logger=t),"languageDetector"===t.type&&(this.modules.languageDetector=t),"i18nFormat"===t.type&&(this.modules.i18nFormat=t),"postProcessor"===t.type&&b.addPostProcessor(t),"formatter"===t.type&&(this.modules.formatter=t),"3rdParty"===t.type&&this.modules.external.push(t),this}setResolvedLanguage(t){if(t&&this.languages&&!(["cimode","dev"].indexOf(t)>-1))for(let t=0;t-1)&&this.store.hasLanguageSomeTranslations(e)){this.resolvedLanguage=e;break}}}changeLanguage(t,e){var s=this;this.isLanguageChangingTo=t;const i=n();this.emit("languageChanging",t);const o=t=>{this.language=t,this.languages=this.services.languageUtils.toResolveHierarchy(t),this.resolvedLanguage=void 0,this.setResolvedLanguage(t)},r=(t,n)=>{n?(o(n),this.translator.changeLanguage(n),this.isLanguageChangingTo=void 0,this.emit("languageChanged",n),this.logger.log("languageChanged",n)):this.isLanguageChangingTo=void 0,i.resolve((function(){return s.t(...arguments)})),e&&e(t,(function(){return s.t(...arguments)}))},a=e=>{t||e||!this.services.languageDetector||(e=[]);const s="string"==typeof e?e:this.services.languageUtils.getBestMatchFromCodes(e);s&&(this.language||o(s),this.translator.language||this.translator.changeLanguage(s),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(s)),this.loadResources(s,(t=>{r(t,s)}))};return t||!this.services.languageDetector||this.services.languageDetector.async?!t&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(t):a(this.services.languageDetector.detect()),i}getFixedT(t,e,s){var i=this;const n=function(t,e){let o;if("object"!=typeof e){for(var r=arguments.length,a=new Array(r>2?r-2:0),l=2;l`${o.keyPrefix}${u}${t}`)):o.keyPrefix?`${o.keyPrefix}${u}${t}`:t,i.t(h,o)};return"string"==typeof t?n.lng=t:n.lngs=t,n.ns=e,n.keyPrefix=s,n}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const s=e.lng||this.resolvedLanguage||this.languages[0],i=!!this.options&&this.options.fallbackLng,n=this.languages[this.languages.length-1];if("cimode"===s.toLowerCase())return!0;const o=(t,e)=>{const s=this.services.backendConnector.state[`${t}|${e}`];return-1===s||2===s};if(e.precheck){const t=e.precheck(this,o);if(void 0!==t)return t}return!!this.hasResourceBundle(s,t)||(!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!o(s,t)||i&&!o(n,t)))}loadNamespaces(t,e){const s=n();return this.options.ns?("string"==typeof t&&(t=[t]),t.forEach((t=>{this.options.ns.indexOf(t)<0&&this.options.ns.push(t)})),this.loadResources((t=>{s.resolve(),e&&e(t)})),s):(e&&e(),Promise.resolve())}loadLanguages(t,e){const s=n();"string"==typeof t&&(t=[t]);const i=this.options.preload||[],o=t.filter((t=>i.indexOf(t)<0));return o.length?(this.options.preload=i.concat(o),this.loadResources((t=>{s.resolve(),e&&e(t)})),s):(e&&e(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!t)return"rtl";const e=this.services&&this.services.languageUtils||new O(V());return["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(e.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){return new U(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},arguments.length>1?arguments[1]:void 0)}cloneInstance(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:D;const s=t.forkResourceStore;s&&delete t.forkResourceStore;const i={...this.options,...t,isClone:!0},n=new U(i);void 0===t.debug&&void 0===t.prefix||(n.logger=n.logger.clone(t));return["store","services","language"].forEach((t=>{n[t]=this[t]})),n.services={...this.services},n.services.utils={hasLoadedNamespace:n.hasLoadedNamespace.bind(n)},s&&(n.store=new v(this.store.data,i),n.services.resourceStore=n.store),n.translator=new S(n.services,i),n.translator.on("*",(function(t){for(var e=arguments.length,s=new Array(e>1?e-1:0),i=1;i { + 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) { event.preventDefault(); @@ -40,18 +94,18 @@ function submitLoginForm(event) { const xhr = new XMLHttpRequest(); xhr.open('POST', 'api/v2/auth/login', true); 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.status === 200) && (xhr.responseText === "Ok.")) location.replace(location); 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 !== "") ? 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'); @@ -62,3 +116,11 @@ function submitLoginForm(event) { // clear the field passwordElement.value = ''; } + +document.addEventListener('DOMContentLoaded', () => { + const loginForm = document.getElementById('loginform'); + loginForm.setAttribute('method', 'POST'); + loginForm.addEventListener('submit', submitLoginForm); + + setupI18n(); +}); diff --git a/src/webui/www/webui.qrc b/src/webui/www/webui.qrc index 9cb0e24b2..f3cad5044 100644 --- a/src/webui/www/webui.qrc +++ b/src/webui/www/webui.qrc @@ -423,6 +423,63 @@ public/images/qbittorrent-tray.svg public/images/qbittorrent32.png public/index.html + public/lang/ar.json + public/lang/az@latin.json + public/lang/be.json + public/lang/bg.json + public/lang/ca.json + public/lang/cs.json + public/lang/da.json + public/lang/de.json + public/lang/el.json + public/lang/en.json + public/lang/en_AU.json + public/lang/en_GB.json + public/lang/eo.json + public/lang/es.json + public/lang/et.json + public/lang/eu.json + public/lang/fa.json + public/lang/fi.json + public/lang/fr.json + public/lang/gl.json + public/lang/he.json + public/lang/hi_IN.json + public/lang/hr.json + public/lang/hu.json + public/lang/hy.json + public/lang/id.json + public/lang/is.json + public/lang/it.json + public/lang/ja.json + public/lang/ka.json + public/lang/ko.json + public/lang/lt.json + public/lang/ltg.json + public/lang/lv_LV.json + public/lang/mn_MN.json + public/lang/ms_MY.json + public/lang/nb.json + public/lang/nl.json + public/lang/oc.json + public/lang/pl.json + public/lang/pt_BR.json + public/lang/pt_PT.json + public/lang/ro.json + public/lang/ru.json + public/lang/sk.json + public/lang/sl.json + public/lang/sr.json + public/lang/sv.json + public/lang/th.json + public/lang/tr.json + public/lang/uk.json + public/lang/uz@Latn.json + public/lang/vi.json + public/lang/zh_CN.json + public/lang/zh_HK.json + public/lang/zh_TW.json + public/scripts/lib/i18next.min.js public/scripts/login.js