i18n: add support for rtl
This commit is contained in:
1 parent
37a7218bef
commit
ad3b9e5f36
5 files changed
+49
-29
No files matched your search
@@ -68,7 +68,11 @@
|
||||
|
||||
<svelte:window bind:innerWidth={screenWidth} />
|
||||
|
||||
<div class="shell {$$props.class}" style={colorsToVars($colors)}>
|
||||
<div
|
||||
{...$$restProps}
|
||||
class="shell {$$props.class}"
|
||||
style={colorsToVars($colors)}
|
||||
>
|
||||
<slot />
|
||||
<div
|
||||
class="
|
||||
|
||||
@@ -581,7 +581,11 @@
|
||||
"fi": "Finnish",
|
||||
"pt": "Portuguese",
|
||||
"auto": "Auto",
|
||||
"credits": "Credits"
|
||||
"credits": "Credits",
|
||||
"useRtl": {
|
||||
"title": "Use RTL layout",
|
||||
"description": "Use an RTL layout for RTL languages."
|
||||
}
|
||||
},
|
||||
"view": {
|
||||
"title": "Post style",
|
||||
|
||||
@@ -89,6 +89,7 @@ interface Settings {
|
||||
showHidden: boolean
|
||||
}
|
||||
language: string | null
|
||||
useRtl: boolean
|
||||
translator: string | undefined
|
||||
}
|
||||
|
||||
@@ -156,6 +157,7 @@ export const defaultSettings: Settings = {
|
||||
showHidden: false,
|
||||
},
|
||||
language: env.PUBLIC_LANGUAGE ?? null,
|
||||
useRtl: false,
|
||||
translator: env.PUBLIC_TRANSLATOR ?? undefined,
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
import { site } from '$lib/lemmy.js'
|
||||
import ExpandableImage from '$lib/components/ui/ExpandableImage.svelte'
|
||||
import { LINKED_INSTANCE_URL } from '$lib/instance'
|
||||
import { locale } from '$lib/translations'
|
||||
|
||||
nProgress.configure({
|
||||
minimum: 0.4,
|
||||
@@ -105,6 +106,7 @@
|
||||
Skip Navigation
|
||||
</Button>
|
||||
<Shell
|
||||
dir={$locale == 'he' && $userSettings.useRtl ? 'rtl' : 'ltr'}
|
||||
class="min-h-screen {$userSettings.font == 'inter'
|
||||
? 'font-inter'
|
||||
: $userSettings.font == 'system'
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
import { DOMAIN_REGEX_FORMS, removeItem } from '$lib/util.js'
|
||||
import Section from './Section.svelte'
|
||||
import ToggleSetting from './ToggleSetting.svelte'
|
||||
import { locales, t } from '$lib/translations'
|
||||
import { locale, locales, t } from '$lib/translations'
|
||||
import { defaultLinks, iconOfLink } from '$lib/components/ui/navbar/link'
|
||||
|
||||
let pin: string = ''
|
||||
@@ -135,32 +135,40 @@
|
||||
</Section>
|
||||
|
||||
<Section title={$t('settings.app.title')}>
|
||||
<Setting>
|
||||
<span slot="title" class="inline-flex items-center gap-2">
|
||||
{$t('settings.app.lang.title')}
|
||||
<Badge>{$t('settings.beta')}</Badge>
|
||||
</span>
|
||||
<p slot="description">
|
||||
{$t('settings.app.lang.description')}
|
||||
<Note>
|
||||
{$t('settings.app.lang.note')}
|
||||
</Note>
|
||||
<Link href="/translators" highlight class="text-base font-semibold">
|
||||
{$t('settings.app.lang.credits')}
|
||||
</Link>
|
||||
</p>
|
||||
<Select bind:value={$userSettings.language}>
|
||||
<option value={null}>{$t('settings.app.lang.auto')}</option>
|
||||
{#each $locales as locale}
|
||||
<option value={locale}>
|
||||
{$t(`settings.app.lang.${locale}`, { default: locale })}
|
||||
</option>
|
||||
{/each}
|
||||
{#if $userSettings.debugInfo}
|
||||
<option value="dev">Raw Strings</option>
|
||||
{/if}
|
||||
</Select>
|
||||
</Setting>
|
||||
<div class="flex flex-col gap-2">
|
||||
<Setting>
|
||||
<span slot="title" class="inline-flex items-center gap-2">
|
||||
{$t('settings.app.lang.title')}
|
||||
<Badge>{$t('settings.beta')}</Badge>
|
||||
</span>
|
||||
<p slot="description">
|
||||
{$t('settings.app.lang.description')}
|
||||
<Note>
|
||||
{$t('settings.app.lang.note')}
|
||||
</Note>
|
||||
<Link href="/translators" highlight class="text-base font-semibold">
|
||||
{$t('settings.app.lang.credits')}
|
||||
</Link>
|
||||
</p>
|
||||
<Select bind:value={$userSettings.language}>
|
||||
<option value={null}>{$t('settings.app.lang.auto')}</option>
|
||||
{#each $locales as locale}
|
||||
<option value={locale}>
|
||||
{$t(`settings.app.lang.${locale}`, { default: locale })}
|
||||
</option>
|
||||
{/each}
|
||||
{#if $userSettings.debugInfo}
|
||||
<option value="dev">Raw Strings</option>
|
||||
{/if}
|
||||
</Select>
|
||||
</Setting>
|
||||
{#if $locale == 'he'}
|
||||
<ToggleSetting
|
||||
bind:checked={$userSettings.useRtl}
|
||||
title={$t('settings.app.lang.useRtl.title')}
|
||||
></ToggleSetting>
|
||||
{/if}
|
||||
</div>
|
||||
<Setting>
|
||||
<span slot="title">{$t('settings.app.view.title')}</span>
|
||||
<ViewSelect showLabel={false} />
|
||||
|
||||
Reference in new issue
Block a user