fix: allow unsetting language
This commit is contained in:
1 parent
f2b16d5669
commit
21ae0f8272
2 files changed
+15
-5
No files matched your search
@@ -4,17 +4,15 @@
|
|||||||
import type { Community, Post, PostView } from 'lemmy-js-client'
|
import type { Community, Post, PostView } from 'lemmy-js-client'
|
||||||
import { Select, Spinner, Switch, toast } from 'mono-svelte'
|
import { Select, Spinner, Switch, toast } from 'mono-svelte'
|
||||||
import {
|
import {
|
||||||
Check,
|
|
||||||
Icon,
|
Icon,
|
||||||
Photo,
|
Photo,
|
||||||
BookOpen,
|
|
||||||
ArrowPath,
|
ArrowPath,
|
||||||
Sparkles,
|
Sparkles,
|
||||||
ChatBubbleBottomCenterText,
|
ChatBubbleBottomCenterText,
|
||||||
EllipsisHorizontal,
|
|
||||||
Plus,
|
Plus,
|
||||||
Language,
|
Language,
|
||||||
Link,
|
Link,
|
||||||
|
XMark,
|
||||||
} from 'svelte-hero-icons'
|
} from 'svelte-hero-icons'
|
||||||
import { profile } from '$lib/auth.js'
|
import { profile } from '$lib/auth.js'
|
||||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||||
@@ -29,6 +27,7 @@
|
|||||||
import { feature } from '$lib/version'
|
import { feature } from '$lib/version'
|
||||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||||
import ErrorContainer, {
|
import ErrorContainer, {
|
||||||
|
clearErrorScope,
|
||||||
pushError,
|
pushError,
|
||||||
} from '$lib/components/error/ErrorContainer.svelte'
|
} from '$lib/components/error/ErrorContainer.svelte'
|
||||||
import { errorMessage } from '$lib/lemmy/error'
|
import { errorMessage } from '$lib/lemmy/error'
|
||||||
@@ -66,6 +65,9 @@
|
|||||||
alt_text: undefined,
|
alt_text: undefined,
|
||||||
language_id: undefined,
|
language_id: undefined,
|
||||||
}
|
}
|
||||||
|
// weird select menu language handling
|
||||||
|
// @ts-ignore
|
||||||
|
$: if (data.language_id === '') data.language_id = undefined
|
||||||
|
|
||||||
let saveDraft = edit ? false : true
|
let saveDraft = edit ? false : true
|
||||||
let communitySearch = passedCommunity?.name ?? ''
|
let communitySearch = passedCommunity?.name ?? ''
|
||||||
@@ -82,6 +84,7 @@
|
|||||||
data.nsfw = editingPost.nsfw
|
data.nsfw = editingPost.nsfw
|
||||||
data.alt_text = editingPost.alt_text
|
data.alt_text = editingPost.alt_text
|
||||||
data.thumbnail = editingPost.thumbnail_url
|
data.thumbnail = editingPost.thumbnail_url
|
||||||
|
// @ts-ignore
|
||||||
data.language_id = editingPost.language_id.toString()
|
data.language_id = editingPost.language_id.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,6 +109,7 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
async function submit() {
|
async function submit() {
|
||||||
|
clearErrorScope('post-form')
|
||||||
if (!data.community && !edit) {
|
if (!data.community && !edit) {
|
||||||
pushError({
|
pushError({
|
||||||
message: $t('toast.needCommunity'),
|
message: $t('toast.needCommunity'),
|
||||||
@@ -413,6 +417,10 @@
|
|||||||
label={$t('settings.app.lang.title')}
|
label={$t('settings.app.lang.title')}
|
||||||
bind:value={data.language_id}
|
bind:value={data.language_id}
|
||||||
>
|
>
|
||||||
|
<option value={undefined}>
|
||||||
|
<Icon src={XMark} size="16" micro />
|
||||||
|
{$t('form.post.unset')}
|
||||||
|
</option>
|
||||||
{#each $site?.all_languages as language}
|
{#each $site?.all_languages as language}
|
||||||
<option value={language.id.toString()}>{language.name}</option>
|
<option value={language.id.toString()}>{language.name}</option>
|
||||||
{/each}
|
{/each}
|
||||||
|
|||||||
@@ -138,7 +138,8 @@
|
|||||||
"selectFile": "Select a file",
|
"selectFile": "Select a file",
|
||||||
"altText": "Alt Text",
|
"altText": "Alt Text",
|
||||||
"addUrl": "Add URL",
|
"addUrl": "Add URL",
|
||||||
"setLanguage": "Set language"
|
"setLanguage": "Set language",
|
||||||
|
"unset": "Unset"
|
||||||
},
|
},
|
||||||
"profile": {
|
"profile": {
|
||||||
"displayName": "Display name",
|
"displayName": "Display name",
|
||||||
@@ -847,7 +848,8 @@
|
|||||||
"slurs": "Your submission contains a term banned in this instance.",
|
"slurs": "Your submission contains a term banned in this instance.",
|
||||||
"captcha_failed": "Incorrect CAPTCHA answer.",
|
"captcha_failed": "Incorrect CAPTCHA answer.",
|
||||||
"cant_block_local_instance": "You can't block the instance you are actively using.",
|
"cant_block_local_instance": "You can't block the instance you are actively using.",
|
||||||
"invalid_vote_value": "You can't commit voter fraud on Lemmy posts, sorry."
|
"invalid_vote_value": "You can't commit voter fraud on Lemmy posts, sorry.",
|
||||||
|
"language_not_allowed": "That language isn't allowed in this community. Unset it to use the community's default."
|
||||||
},
|
},
|
||||||
"aria": {
|
"aria": {
|
||||||
"pagination": {
|
"pagination": {
|
||||||
|
|||||||
Reference in new issue
Block a user