Added Locales to the webextention
Build LinkLog Development Image / development-image (push) Successful in 9s
Build LinkLog Development Image / development-image (push) Successful in 9s
This commit is contained in:
@@ -12,6 +12,8 @@ const session = document.getElementById('logged-in');
|
||||
const sessionSummary = document.getElementById('session-summary');
|
||||
const signOutButton = document.getElementById('sign-out');
|
||||
|
||||
const t = window.linklogI18n;
|
||||
|
||||
function setStatus(message, isError = false) {
|
||||
statusEl.textContent = message;
|
||||
statusEl.classList.remove('hidden');
|
||||
@@ -43,7 +45,7 @@ async function loadSettings() {
|
||||
}
|
||||
|
||||
function showLoggedIn(username, backendUrl) {
|
||||
sessionSummary.textContent = `${username} logged in at ${backendUrl}`;
|
||||
sessionSummary.textContent = t('loggedInAt', [username, backendUrl]);
|
||||
session.classList.remove('hidden');
|
||||
form.classList.add('hidden');
|
||||
}
|
||||
@@ -64,7 +66,7 @@ async function saveSettingsAndLogin(event) {
|
||||
const password = passwordInput.value;
|
||||
|
||||
if (!backendUrl || !username || !password) {
|
||||
setStatus('Please fill in all fields', true);
|
||||
setStatus(t('fillAllFields'), true);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -76,7 +78,7 @@ async function saveSettingsAndLogin(event) {
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('Login failed');
|
||||
throw new Error(t('loginFailed'));
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
@@ -91,9 +93,9 @@ async function saveSettingsAndLogin(event) {
|
||||
|
||||
showLoggedIn(data.user?.username || username, backendUrl);
|
||||
passwordInput.value = '';
|
||||
setStatus('Logged in successfully');
|
||||
setStatus(t('loggedInSuccessfully'));
|
||||
} catch (error) {
|
||||
setStatus('Unable to log in. Check backend URL and credentials.', true);
|
||||
setStatus(t('unableToLogIn'), true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +110,7 @@ async function signOut() {
|
||||
}
|
||||
await clearSession();
|
||||
showLoggedOut();
|
||||
setStatus('Signed out');
|
||||
setStatus(t('signedOut'));
|
||||
}
|
||||
|
||||
form.addEventListener('submit', saveSettingsAndLogin);
|
||||
|
||||
Reference in New Issue
Block a user