refactored translations, preparing sending of document

This commit is contained in:
2025-07-17 13:03:49 +02:00
parent 7616aa9581
commit dc8de9707a
38 changed files with 430 additions and 390 deletions

View File

@@ -35,13 +35,13 @@
{#if connections.length>0}
<fieldset tabindex="0">
<legend>{t('user.connected_services')}</legend>
<legend>{t('connected_services')}</legend>
<table>
<thead>
<tr>
<th>{t('user.service')}</th>
<th>{t('user.foreign_id')}</th>
<th>{t('user.actions')}</th>
<th>{t('service')}</th>
<th>{t('foreign_id')}</th>
<th>{t('actions')}</th>
</tr>
</thead>
<tbody>
@@ -50,7 +50,7 @@
<td>{connection.service_id}</td>
<td>{connection.foreign_id}</td>
<td>
<button onclick={() => unlink(connection)}>{t('user.unlink')}</button>
<button onclick={() => unlink(connection)}>{t('unlink')}</button>
</td>
</tr>
{/each}

View File

@@ -6,7 +6,7 @@
let oldPass = $state("");
let newPass = $state("");
let repeat = $state("");
let caption = $state(t('user.update'));
let caption = $state(t('update'));
let oldEmpty = $derived(!/\S/.test(oldPass));
let newEmpty = $derived(!/\S/.test(newPass));
@@ -20,7 +20,7 @@
}
async function submit(){
caption = t('user.data_sent');
caption = t('data_sent');
const url = `${location.protocol}//${location.host.replace('5173','8080')}/api/user/password`;
const data = {
old: oldPass,
@@ -33,9 +33,9 @@
});
if (resp.ok){
caption = t('user.saved');
caption = t('saved');
} else {
caption = t('user.failed');
caption = t('failed');
}
}
</script>
@@ -47,27 +47,27 @@
</style>
<fieldset class="overlay">
<legend>{t('user.edit_password')}</legend>
<legend>{t('edit_password')}</legend>
<label>
<input type="password" bind:value={oldPass} /> {t('user.old_password')}
<input type="password" bind:value={oldPass} /> {t('old_password')}
{#if oldEmpty}
<span class="error">{t('user.must_not_be_empty')}</span>
<span class="error">{t('must_not_be_empty')}</span>
{/if}
</label>
<label>
<input type="password" bind:value={newPass} /> {t('user.new_password')}
<input type="password" bind:value={newPass} /> {t('new_password')}
{#if newEmpty}
<span class="error">{t('user.must_not_be_empty')}</span>
<span class="error">{t('must_not_be_empty')}</span>
{/if}
</label>
<label>
<input type="password" bind:value={repeat} /> {t('user.repeat_new_password')}
<input type="password" bind:value={repeat} /> {t('repeat_new_password')}
{#if mismatch}
<span class="error">{t('user.mismatch')}</span>
<span class="error">{t('mismatch')}</span>
{/if}
</label>
<button onclick={submit} disabled={sent||oldEmpty||newEmpty||mismatch}>{caption}</button>
<button onclick={abort} disabled={sent}>{t('user.abort')}</button>
<button onclick={abort} disabled={sent}>{t('abort')}</button>
{#if error}
<span class="error">{error}</span>
{/if}

View File

@@ -5,8 +5,8 @@
let { serviceName } = $props();
let service = $state({})
let caption = $state(t('user.save_service'));
let message = $state(t('user.loading_data'));
let caption = $state(t('save_service'));
let message = $state(t('loading_data'));
let router = useTinyRouter();
let disabled = $state(false);
@@ -23,7 +23,7 @@
});
async function update(){
caption = t('user.data_sent');
caption = t('data_sent');
const url = `${location.protocol}//${location.host.replace('5173','8080')}/api/user/oidc/${serviceName}`;
const resp = await fetch(url,{
credentials: 'include',
@@ -31,7 +31,7 @@
body: JSON.stringify(service)
});
if (resp.ok){
caption = t('user.saved');
caption = t('saved');
router.navigate('/user');
} else {
caption = await resp.text();
@@ -41,30 +41,30 @@
</script>
<fieldset>
<legend>{t('user.edit_service',serviceName)}</legend>
<legend>{t('edit_service',serviceName)}</legend>
{#if service.name || !serviceName}
<table>
<tbody>
<tr>
<th>{t('user.name')}</th>
<th>{t('name')}</th>
<td>
<input type="text" bind:value={service.name} />
</td>
</tr>
<tr>
<th>{t('user.client_id')}</th>
<th>{t('client_id')}</th>
<td>
<input type="text" bind:value={service.client_id} />
</td>
</tr>
<tr>
<th>{t('user.client_secret')}</th>
<th>{t('client_secret')}</th>
<td>
<input type="text" bind:value={service.client_secret} />
</td>
</tr>
<tr>
<th>{t('user.base_url')}</th>
<th>{t('base_url')}</th>
<td>
<input type="text" bind:value={service.url} />
</td>
@@ -72,7 +72,7 @@
</tbody>
</table>
<button onclick={update} {disabled}>{caption}</button>
<button onclick={() => router.navigate('/user')} {disabled}>{t('user.abort')}</button>
<button onclick={() => router.navigate('/user')} {disabled}>{t('abort')}</button>
{:else}
{message}
{/if}

View File

@@ -12,8 +12,8 @@
let editUser = $state(null);
let options = $state([]);
let sent = $state(false);
let caption = $state(t('user.save_user'));
let message = $state(t('user.loading_data'));
let caption = $state(t('save_user'));
let message = $state(t('loading_data'));
onMount(async () => {
let url = `${location.protocol}//${location.host.replace('5173','8080')}/themes.json`;
@@ -44,7 +44,7 @@
async function save(ev){
ev.preventDefault();
sent = true;
caption = t('user.data_sent');
caption = t('data_sent');
let method = 'PATCH';
let url = null;
if (user_id) {
@@ -59,54 +59,54 @@
body: JSON.stringify(editUser)
});
if (resp.ok){
caption = t('user.saved');
caption = t('saved');
checkUser();
router.navigate('/user');
} else {
caption = t('user.failed');
caption = t('failed');
sent = false;
}
}
</script>
<fieldset>
<legend>{t('user.editing',user_id?user_id:'')}</legend>
<legend>{t('editing',user_id?user_id:'')}</legend>
{#if editUser}
<form onsubmit={save}>
<table>
<tbody>
{#if editUser.id}
<tr>
<th>{t('user.id')}</th>
<th>{t('id')}</th>
<td>{editUser.id}</td>
</tr>
{/if}
<tr>
<th>{t('user.name')}</th>
<th>{t('name')}</th>
<td>
<input type="text" bind:value={editUser.name} />
</td>
</tr>
<tr>
<th>{t('user.email')}</th>
<th>{t('email')}</th>
<td>
<input type="text" bind:value={editUser.email} />
</td>
</tr>
<tr>
<th>{t('user.language')}</th>
<th>{t('language')}</th>
<td>
<input type="text" bind:value={editUser.language} />
</td>
</tr>
<tr>
<th>{t('user.password')}</th>
<th>{t('password')}</th>
<td>
<input type="password" bind:value={editUser.password} />
</td>
</tr>
<tr>
<th>{t('user.theme')}</th>
<th>{t('theme')}</th>
<td>
<select bind:value={editUser.theme}>
{#each options as entry,i}

View File

@@ -33,19 +33,19 @@
<fieldset tabindex="0">
<legend>
{t('user.list')}
{t('list')}
{#if user.permissions.includes('CREATE_USERS')}
<button onclick={() => router.navigate('/user/create')}>{t('user.create_new')}</button>
<button onclick={() => router.navigate('/user/create')}>{t('create_new')}</button>
{/if}
</legend>
<table>
<thead>
<tr>
<th>{t('user.id')}</th>
<th>{t('user.name')}</th>
<th>{t('user.email')}</th>
<th>{t('user.language')}</th>
<th>{t('user.actions')}</th>
<th>{t('id')}</th>
<th>{t('name')}</th>
<th>{t('email')}</th>
<th>{t('language')}</th>
<th>{t('actions')}</th>
</tr>
</thead>
<tbody>
@@ -57,10 +57,10 @@
<td>{u.language}</td>
<td>
{#if user.permissions.includes('IMPERSONATE')}
<button onclick={() => impersonate(u.id)}>{t('user.impersonate')}</button>
<button onclick={() => impersonate(u.id)}>{t('impersonate')}</button>
{/if}
{#if user.permissions.includes('UPDATE_USERS')}
<button onclick={() => router.navigate(`/user/${u.id}/edit`)}>{t('user.edit')}</button>
<button onclick={() => router.navigate(`/user/${u.id}/edit`)}>{t('edit')}</button>
{/if}
</td>
</tr>

View File

@@ -45,16 +45,16 @@
<fieldset tabindex="0">
<legend>
{t('user.login_services')}
{t('login_services')}
{#if user.permissions.includes('MANAGE_LOGIN_SERVICES')}
<button onclick={() => router.navigate('/user/oidc/add')}>{t('user.add_login_service')}</button>
<button onclick={() => router.navigate('/user/oidc/add')}>{t('add_login_service')}</button>
{/if}
</legend>
<table>
<thead>
<tr>
<th>{t('user.service')}</th>
<th>{t('user.actions')}</th>
<th>{t('service')}</th>
<th>{t('actions')}</th>
</tr>
</thead>
<tbody>
@@ -62,10 +62,10 @@
<tr>
<td>{service}</td>
<td>
<button onclick={() => connect(service)}>{t('user.connect_service')}</button>
<button onclick={() => connect(service)}>{t('connect_service')}</button>
{#if user.permissions.includes('MANAGE_LOGIN_SERVICES')}
<button onclick={() => router.navigate(`/user/oidc/edit/${service}`)}>{t('user.edit')}</button>
<button onclick={() => drop(service)}>{t('user.delete')}</button>
<button onclick={() => router.navigate(`/user/oidc/edit/${service}`)}>{t('edit')}</button>
<button onclick={() => drop(service)}>{t('delete')}</button>
{/if}
</td>
</tr>

View File

@@ -6,7 +6,7 @@
const router = useTinyRouter();
let message = $state(t('user.processing_code'));
let message = $state(t('processing_code'));
onMount(async () => {
let params = new URLSearchParams(location.search);

View File

@@ -11,53 +11,53 @@
</script>
<fieldset>
<legend>
{t('user.your_profile')}
<button onclick={() => router.navigate(`/user/${user.id}/edit`)}>{t('user.edit')}</button>
<button onclick={() => router.navigate(`/message/settings`)}>{t('messages.settings')}</button>
{t('your_profile')}
<button onclick={() => router.navigate(`/user/${user.id}/edit`)}>{t('edit')}</button>
<button onclick={() => router.navigate(`/message/settings`)}>{t('settings')}</button>
</legend>
<table>
<tbody>
<tr>
<th>{t('user.id')}</th>
<th>{t('id')}</th>
<td>{user.id}</td>
</tr>
<tr>
<th>{t('user.name')}</th>
<th>{t('name')}</th>
<td>{user.name}</td>
</tr>
<tr>
<th>{t('user.login')}</th>
<th>{t('login')}</th>
<td>{user.login}</td>
</tr>
<tr>
<th>{t('user.email')}</th>
<th>{t('email')}</th>
<td>{user.email}</td>
</tr>
<tr>
<th>{t('user.language')}</th>
<th>{t('language')}</th>
<td>{user.language}</td>
</tr>
<tr>
<th>{t('user.theme')}</th>
<th>{t('theme')}</th>
<td>{user.theme}</td>
</tr>
<tr>
<th>{t('user.password')}</th>
<th>{t('password')}</th>
<td>
{#if editPassword}
<EditPassword bind:editPassword={editPassword} />
{:else}
<button onclick={() => editPassword = true}>{t('user.edit_password')}</button>
<button onclick={() => editPassword = true}>{t('edit_password')}</button>
{/if}
</td>
</tr>
<tr>
<th>{t('user.permissions')}</th>
<th>{t('permissions')}</th>
<td>
<ul>
{#each user.permissions as permission,i}
<li>{t('user.'+permission)}</li>
<li>{t(permission)}</li>
{/each}
</ul>
</td>

View File

@@ -4,7 +4,7 @@
import { useTinyRouter } from 'svelte-tiny-router';
let mail = "";
let caption = t('user.send_mail');
let caption = t('send_mail');
let error = null;
const router = useTinyRouter();
@@ -16,7 +16,7 @@
body : mail
});
if (resp.ok) {
caption = t('user.data_sent');
caption = t('data_sent');
} else {
caption = await resp.text();
}
@@ -58,10 +58,10 @@
<form onsubmit={submit}>
<fieldset>
<legend>{t('user.reset_pw')}</legend>
<legend>{t('reset_pw')}</legend>
<label>
<input type="email" bind:value={mail}/>
{t('user.enter_email')}
{t('enter_email')}
</label>
<button type="submit">{caption}</button>
{#if error}

View File

@@ -14,7 +14,7 @@
}
</script>
<h1>{t('user.user_module')}</h1>
<h1>{t('user_module')}</h1>
<Profile />
<Services />