feat: localize login page

This commit is contained in:
a.tolmachev
2026-04-02 23:45:10 +03:00
parent 2f79eb8f48
commit 581d50c33c
3 changed files with 38 additions and 14 deletions
+7 -3
View File
@@ -1,4 +1,8 @@
(function() {
function tKey(key) {
return window.t ? t(key) : key;
}
function showError(message) {
var errorElement = document.getElementById('login-error');
errorElement.style.display = 'block';
@@ -22,7 +26,7 @@
var password = document.getElementById('password').value;
if (!email || !password) {
showError('Please enter your email and password.');
showError(tKey('login.error.required'));
return;
}
@@ -32,10 +36,10 @@
await window.CrankAuth.login(email, password);
} catch (error) {
if (error && error.status === 401) {
showError('Invalid email or password. Please try again.');
showError(tKey('login.error.invalid'));
return;
}
showError('Unable to sign in right now. Please try again.');
showError(tKey('login.error.generic'));
}
});
});