i18n: localize profile menu
This commit is contained in:
1 parent
c4236fa124
commit
0f0e34d347
5 files changed
+180
-17
No files matched your search
@@ -35,6 +35,7 @@
|
|||||||
import { userSettings } from '$lib/settings'
|
import { userSettings } from '$lib/settings'
|
||||||
import { site } from '$lib/lemmy'
|
import { site } from '$lib/lemmy'
|
||||||
import SiteCard from '$lib/components/lemmy/SiteCard.svelte'
|
import SiteCard from '$lib/components/lemmy/SiteCard.svelte'
|
||||||
|
import { t } from '$lib/translations'
|
||||||
|
|
||||||
let showInstance = false
|
let showInstance = false
|
||||||
</script>
|
</script>
|
||||||
@@ -59,7 +60,7 @@
|
|||||||
class="w-10 h-10 rounded-full ring-1 ring-slate-200 dark:ring-zinc-700
|
class="w-10 h-10 rounded-full ring-1 ring-slate-200 dark:ring-zinc-700
|
||||||
transition-all bg-slate-50 dark:bg-zinc-900 relative
|
transition-all bg-slate-50 dark:bg-zinc-900 relative
|
||||||
hover:dark:brightness-125 hover:brightness {$$props.buttonClass}"
|
hover:dark:brightness-125 hover:brightness {$$props.buttonClass}"
|
||||||
aria-label="Profile"
|
title={$t('profile.profile')}
|
||||||
slot="target"
|
slot="target"
|
||||||
>
|
>
|
||||||
{#if $profile?.user}
|
{#if $profile?.user}
|
||||||
@@ -93,15 +94,16 @@
|
|||||||
{$profile?.user?.local_user_view?.person.name}
|
{$profile?.user?.local_user_view?.person.name}
|
||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
<MenuDivider>Profile</MenuDivider>
|
<MenuDivider>{$t('nav.menu.label')}</MenuDivider>
|
||||||
{/if}
|
{/if}
|
||||||
{#if $profile?.user}
|
{#if $profile?.user}
|
||||||
<MenuButton link href="/profile">
|
<MenuButton link href="/profile">
|
||||||
<Icon src={UserCircle} mini width={16} slot="prefix" /> Profile
|
<Icon src={UserCircle} mini width={16} slot="prefix" />
|
||||||
|
{$t('profile.profile')}
|
||||||
</MenuButton>
|
</MenuButton>
|
||||||
<MenuButton link href="/inbox">
|
<MenuButton link href="/inbox">
|
||||||
<Icon src={Inbox} mini width={16} slot="prefix" />
|
<Icon src={Inbox} mini width={16} slot="prefix" />
|
||||||
Inbox
|
{$t('profile.inbox')}
|
||||||
{#if $profile.user.notifications.inbox > 0}
|
{#if $profile.user.notifications.inbox > 0}
|
||||||
<Badge color="red-subtle" class="text-xs ml-auto font-bold !py-0.5">
|
<Badge color="red-subtle" class="text-xs ml-auto font-bold !py-0.5">
|
||||||
{$profile.user.notifications.inbox}
|
{$profile.user.notifications.inbox}
|
||||||
@@ -109,18 +111,19 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</MenuButton>
|
</MenuButton>
|
||||||
<MenuButton link href="/saved">
|
<MenuButton link href="/saved">
|
||||||
<Icon src={Bookmark} mini width={16} slot="prefix" /> Saved
|
<Icon src={Bookmark} mini width={16} slot="prefix" />
|
||||||
|
{$t('profile.saved')}
|
||||||
</MenuButton>
|
</MenuButton>
|
||||||
{/if}
|
{/if}
|
||||||
<MenuButton link href="/accounts">
|
<MenuButton link href="/accounts">
|
||||||
<Icon src={UserGroup} mini width={16} slot="prefix" />
|
<Icon src={UserGroup} mini width={16} slot="prefix" />
|
||||||
Accounts
|
{$t('account.accounts')}
|
||||||
</MenuButton>
|
</MenuButton>
|
||||||
<hr class="dark:opacity-10 w-[90%] my-2 mx-auto" />
|
<hr class="dark:opacity-10 w-[90%] my-2 mx-auto" />
|
||||||
<MenuDivider>App</MenuDivider>
|
<MenuDivider>{$t('nav.menu.app')}</MenuDivider>
|
||||||
<MenuButton link href="/settings">
|
<MenuButton link href="/settings">
|
||||||
<Icon src={Cog6Tooth} mini width={16} slot="prefix" />
|
<Icon src={Cog6Tooth} mini width={16} slot="prefix" />
|
||||||
Settings
|
{$t('nav.menu.settings')}
|
||||||
</MenuButton>
|
</MenuButton>
|
||||||
<MenuButton class="!py-0">
|
<MenuButton class="!py-0">
|
||||||
<Icon
|
<Icon
|
||||||
@@ -135,20 +138,20 @@
|
|||||||
size="16"
|
size="16"
|
||||||
slot="prefix"
|
slot="prefix"
|
||||||
/>
|
/>
|
||||||
<span>Color Scheme</span>
|
<span>{$t('nav.menu.colorscheme.label')}</span>
|
||||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||||
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
||||||
<div class="contents" on:click|stopPropagation={() => {}}>
|
<div class="contents" on:click|stopPropagation={() => {}}>
|
||||||
<Select bind:value={$legacyTheme} class="ml-auto my-auto w-24" size="sm">
|
<Select bind:value={$legacyTheme} class="ml-auto my-auto w-24" size="sm">
|
||||||
<option value="system">System</option>
|
<option value="system">{$t('nav.menu.colorscheme.system')}</option>
|
||||||
<option value="light">Light</option>
|
<option value="light">{$t('nav.menu.colorscheme.label')}</option>
|
||||||
<option value="dark">Dark</option>
|
<option value="dark">{$t('nav.menu.colorscheme.dark')}</option>
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
</MenuButton>
|
</MenuButton>
|
||||||
<MenuButton href="/theme">
|
<MenuButton href="/theme">
|
||||||
<Icon src={Swatch} size="16" mini slot="prefix" />
|
<Icon src={Swatch} size="16" mini slot="prefix" />
|
||||||
Theme
|
{$t('nav.menu.theme')}
|
||||||
</MenuButton>
|
</MenuButton>
|
||||||
{#if $userSettings.debugInfo}
|
{#if $userSettings.debugInfo}
|
||||||
<MenuButton link href="/util">
|
<MenuButton link href="/util">
|
||||||
@@ -174,7 +177,7 @@
|
|||||||
<Button
|
<Button
|
||||||
on:click={() => (showInstance = !showInstance)}
|
on:click={() => (showInstance = !showInstance)}
|
||||||
color="tertiary"
|
color="tertiary"
|
||||||
title="Instance"
|
title={$t('nav.menu.instance')}
|
||||||
size="square-md"
|
size="square-md"
|
||||||
>
|
>
|
||||||
<Icon src={ServerStack} size="16" mini />
|
<Icon src={ServerStack} size="16" mini />
|
||||||
@@ -182,7 +185,7 @@
|
|||||||
<Button
|
<Button
|
||||||
color="tertiary"
|
color="tertiary"
|
||||||
href="https://buymeacoffee.com/xylight"
|
href="https://buymeacoffee.com/xylight"
|
||||||
title="Donate"
|
title={$t('nav.menu.donate')}
|
||||||
size="square-md"
|
size="square-md"
|
||||||
>
|
>
|
||||||
<Icon src={Heart} size="16" mini />
|
<Icon src={Heart} size="16" mini />
|
||||||
@@ -190,12 +193,17 @@
|
|||||||
<Button
|
<Button
|
||||||
color="tertiary"
|
color="tertiary"
|
||||||
href="https://github.com/Xyphyn/Photon"
|
href="https://github.com/Xyphyn/Photon"
|
||||||
title="GitHub"
|
title={$t('nav.menu.source')}
|
||||||
size="square-md"
|
size="square-md"
|
||||||
>
|
>
|
||||||
<Icon src={CodeBracketSquare} size="16" mini />
|
<Icon src={CodeBracketSquare} size="16" mini />
|
||||||
</Button>
|
</Button>
|
||||||
<Button color="tertiary" href="/about" title="About" size="square-md">
|
<Button
|
||||||
|
color="tertiary"
|
||||||
|
href="/about"
|
||||||
|
title={$t('nav.menu.about')}
|
||||||
|
size="square-md"
|
||||||
|
>
|
||||||
<Icon src={InformationCircle} size="16" mini />
|
<Icon src={InformationCircle} size="16" mini />
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,142 @@
|
|||||||
|
{
|
||||||
|
"profile": {
|
||||||
|
"profile": "Profil",
|
||||||
|
"inbox": "Boîte de réception",
|
||||||
|
"saved": "Enregistré",
|
||||||
|
"subscribed": "Abonné"
|
||||||
|
},
|
||||||
|
"nav": {
|
||||||
|
"home": "Accueil",
|
||||||
|
"admin": "Admin",
|
||||||
|
"moderation": "Modération",
|
||||||
|
"communities": "Explorer",
|
||||||
|
"search": "Rechercher",
|
||||||
|
"create": {
|
||||||
|
"label": "Créer",
|
||||||
|
"post": "Post",
|
||||||
|
"community": "Communauté",
|
||||||
|
"logingate": "Vous devez vous connecter pour créer du contenu."
|
||||||
|
},
|
||||||
|
"menu": {
|
||||||
|
"label": "Profil",
|
||||||
|
"app": "App",
|
||||||
|
"settings": "Paramètres",
|
||||||
|
"colorscheme": {
|
||||||
|
"label": "Schéma de couleurs",
|
||||||
|
"system": "Système",
|
||||||
|
"dark": "Sombre",
|
||||||
|
"light": "Clair"
|
||||||
|
},
|
||||||
|
"theme": "Thème",
|
||||||
|
"about": "À propos",
|
||||||
|
"source": "Source",
|
||||||
|
"donate": "Faire un don",
|
||||||
|
"instance": "Instance"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"account": {
|
||||||
|
"login": "Se connecter",
|
||||||
|
"logout": "Se déconnecter",
|
||||||
|
"signup": "S'inscrire",
|
||||||
|
"accounts": "Comptes",
|
||||||
|
"changeinstance": "Changer d'instance"
|
||||||
|
},
|
||||||
|
"filter": {
|
||||||
|
"location": {
|
||||||
|
"label": "Lieu",
|
||||||
|
"all": "Tout",
|
||||||
|
"local": "Local",
|
||||||
|
"subscribed": "Abonné",
|
||||||
|
"moderator": "Modérateur"
|
||||||
|
},
|
||||||
|
"sort": {
|
||||||
|
"label": "Trier",
|
||||||
|
"active": "Actif",
|
||||||
|
"hot": "Populaire",
|
||||||
|
"top": {
|
||||||
|
"label": "Top",
|
||||||
|
"time": {
|
||||||
|
"label": "Temps",
|
||||||
|
"all": "Tout",
|
||||||
|
"9months": "9 Mois",
|
||||||
|
"6months": "6 Mois",
|
||||||
|
"3months": "3 Mois",
|
||||||
|
"month": "Mois",
|
||||||
|
"week": "Semaine",
|
||||||
|
"day": "Jour",
|
||||||
|
"12hours": "12 Heures",
|
||||||
|
"6hours": "6 Heures",
|
||||||
|
"hour": "Heure"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"new": "Nouveau",
|
||||||
|
"old": "Ancien",
|
||||||
|
"controversial": "Controversé",
|
||||||
|
"scaled": "Adapté",
|
||||||
|
"mostcomments": "Commentaires",
|
||||||
|
"newcomments": "Nouvelles réponses"
|
||||||
|
},
|
||||||
|
"view": {
|
||||||
|
"label": "Vue",
|
||||||
|
"cozy": "Cosy",
|
||||||
|
"list": "Liste",
|
||||||
|
"compact": "Compact",
|
||||||
|
"legacy": "Ancien"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"form": {
|
||||||
|
"username": "Nom d'utilisateur",
|
||||||
|
"instance": "URL de l'instance",
|
||||||
|
"password": "Mot de passe",
|
||||||
|
"2fa": "Code 2FA",
|
||||||
|
"forgotpassword": "Mot de passe oublié",
|
||||||
|
"submit": "Soumettre"
|
||||||
|
},
|
||||||
|
"routes": {
|
||||||
|
"frontpage": {
|
||||||
|
"title": "Page d'accueil",
|
||||||
|
"footer": "{{users:number}} {{users; 1:utilisateur; default:utilisateurs;}} actif(s)"
|
||||||
|
},
|
||||||
|
"modlog": "Modlog",
|
||||||
|
"instances": "Instances",
|
||||||
|
"legal": "Légal"
|
||||||
|
},
|
||||||
|
"cards": {
|
||||||
|
"site": {
|
||||||
|
"about": "À propos",
|
||||||
|
"stats": "Statistiques",
|
||||||
|
"admins": "Admins"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"content": {
|
||||||
|
"users": "Utilisateurs",
|
||||||
|
"posts": "Posts",
|
||||||
|
"communities": "Communautés"
|
||||||
|
},
|
||||||
|
"post": {
|
||||||
|
"actions": {
|
||||||
|
"comments": "Commentaires",
|
||||||
|
"save": "Enregistrer",
|
||||||
|
"unsave": "Désénregistrer",
|
||||||
|
"more": {
|
||||||
|
"label": "Plus d'actions",
|
||||||
|
"edit": "Éditer",
|
||||||
|
"creator": "Créateur",
|
||||||
|
"actions": "Actions",
|
||||||
|
"markRead": "Marquer comme lu",
|
||||||
|
"markUnread": "Marquer comme non lu",
|
||||||
|
"share": "Partager",
|
||||||
|
"crosspost": "Crossposter",
|
||||||
|
"delete": "Supprimer",
|
||||||
|
"restore": "Restaurer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"moderation": {
|
||||||
|
"report": "Signaler"
|
||||||
|
},
|
||||||
|
"common": {
|
||||||
|
"back": "Retour",
|
||||||
|
"next": "Suivant"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
import type { CommentSortType, SortType } from 'lemmy-js-client'
|
import type { CommentSortType, SortType } from 'lemmy-js-client'
|
||||||
import { writable } from 'svelte/store'
|
import { writable } from 'svelte/store'
|
||||||
import { env } from '$env/dynamic/public'
|
import { env } from '$env/dynamic/public'
|
||||||
|
import { locale } from './translations'
|
||||||
|
import { browser } from '$app/environment'
|
||||||
|
|
||||||
console.log('Using the following default settings from the environment:')
|
console.log('Using the following default settings from the environment:')
|
||||||
console.log(env)
|
console.log(env)
|
||||||
@@ -168,4 +170,9 @@ userSettings.subscribe((settings) => {
|
|||||||
if (typeof window != 'undefined') {
|
if (typeof window != 'undefined') {
|
||||||
localStorage.setItem('settings', JSON.stringify(settings))
|
localStorage.setItem('settings', JSON.stringify(settings))
|
||||||
}
|
}
|
||||||
|
if (settings.language) {
|
||||||
|
locale.set(settings.language)
|
||||||
|
} else {
|
||||||
|
if (browser) locale.set(navigator?.language)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
@@ -7,6 +7,11 @@ const config: Config = {
|
|||||||
key: '',
|
key: '',
|
||||||
loader: async () => (await import('./i18n/en.json')).default,
|
loader: async () => (await import('./i18n/en.json')).default,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
locale: 'fr',
|
||||||
|
key: '',
|
||||||
|
loader: async () => (await import('./i18n/fr.json')).default,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
fallbackLocale: 'en',
|
fallbackLocale: 'en',
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,7 @@
|
|||||||
<span class="flex flex-row items-center gap-1">
|
<span class="flex flex-row items-center gap-1">
|
||||||
<Icon src={ChartBar} size="16" mini />
|
<Icon src={ChartBar} size="16" mini />
|
||||||
{$t('routes.frontpage.footer', {
|
{$t('routes.frontpage.footer', {
|
||||||
|
// @ts-ignore
|
||||||
users: $site?.site_view.counts.users_active_day ?? '??',
|
users: $site?.site_view.counts.users_active_day ?? '??',
|
||||||
})}
|
})}
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
Reference in new issue
Block a user