Added Locales to the webextention
Build LinkLog Development Image / development-image (push) Successful in 9s

This commit is contained in:
2026-08-26 12:14:30 +02:00
parent f0ae526a96
commit 3fdf146498
12 changed files with 229 additions and 51 deletions
+10 -8
View File
@@ -11,6 +11,8 @@ const existingTags = document.getElementById('existing-tags');
const newTagsInput = document.getElementById('new-tags');
const feedLink = document.getElementById('feed-link');
const t = window.linklogI18n;
function setStatus(message, isError = false) {
statusEl.textContent = message;
statusEl.classList.remove('hidden');
@@ -42,14 +44,14 @@ async function updateFeedLink() {
async function loadExistingTags() {
const settings = await getSettings();
if (!settings.backendUrl || !settings.accessToken) {
existingTags.textContent = 'Sign in to select existing tags.';
existingTags.textContent = t('signInToSelectTags');
return;
}
const response = await fetch(`${settings.backendUrl}/api/tags`, {
headers: {'Authorization': `Bearer ${settings.accessToken}`},
});
if (!response.ok) {
existingTags.textContent = 'Could not load existing tags.';
existingTags.textContent = t('loadTagsFailed');
return;
}
const tags = await response.json();
@@ -96,14 +98,14 @@ async function populateCurrentTab() {
async function handleSubmit(event) {
event.preventDefault();
setStatus('Submitting...', false);
setStatus(t('submitting'), false);
const settings = await getSettings();
const token = settings.accessToken;
const backendUrl = settings.backendUrl;
if (!token || !backendUrl) {
setStatus('Please configure the backend URL and log in first.', true);
setStatus(t('configureAndLogIn'), true);
browser.runtime.openOptionsPage();
return;
}
@@ -125,18 +127,18 @@ async function handleSubmit(event) {
});
if (response.status === 401) {
setStatus('Session expired. Re-authenticate in settings.', true);
setStatus(t('sessionExpired'), true);
browser.runtime.openOptionsPage();
return;
}
if (!response.ok) {
throw new Error('Submission failed');
throw new Error(t('submissionFailed'));
}
setStatus('Link saved successfully');
setStatus(t('linkSaved'));
} catch (error) {
setStatus('Submission failed. Check your backend connection.', true);
setStatus(t('submissionFailedConnection'), true);
}
}