add localisation support
currently only en_GB (TODO: dynamic language pack imports)
This commit is contained in:
parent
970590497f
commit
e326ac858e
17 changed files with 263 additions and 90 deletions
|
@ -1,25 +1,29 @@
|
|||
<script>
|
||||
import Lang from '$lib/lang';
|
||||
|
||||
export let post;
|
||||
|
||||
let open_warned = false;
|
||||
const lang = Lang('en_GB');
|
||||
|
||||
let open = false;
|
||||
</script>
|
||||
|
||||
<div class="post-body">
|
||||
{#if post.warning}
|
||||
<button class="post-warning" on:click|stopPropagation={() => { open_warned = !open_warned }} on:mouseup|stopPropagation>
|
||||
<button class="post-warning" on:click|stopPropagation={() => { open = !open }} on:mouseup|stopPropagation>
|
||||
<strong>
|
||||
{post.warning}
|
||||
<span class="warning-instructions">
|
||||
{#if !open_warned}
|
||||
(click to reveal)
|
||||
<span class="instructions">
|
||||
{#if !open}
|
||||
{lang.string('post.warning.show')}
|
||||
{:else}
|
||||
(click to hide)
|
||||
{lang.string('post.warning.hide')}
|
||||
{/if}
|
||||
</span>
|
||||
</strong>
|
||||
</button>
|
||||
{/if}
|
||||
{#if !post.warning || open_warned}
|
||||
{#if !post.warning || open}
|
||||
{#if post.rich_text}
|
||||
<span class="post-text">{@html post.rich_text}</span>
|
||||
{:else if post.html}
|
||||
|
@ -78,7 +82,7 @@
|
|||
box-shadow: 0 0 8px var(--warn-bg);
|
||||
}
|
||||
|
||||
.post-warning .warning-instructions {
|
||||
.post-warning .instructions {
|
||||
font-weight: normal;
|
||||
opacity: .5;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue