Skip to content

Commit

Permalink
Update parser-default example
Browse files Browse the repository at this point in the history
  • Loading branch information
jarda-svoboda committed Jul 11, 2023
1 parent f8944dc commit 70dba68
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"title_built-in": "Vestavěné modifikátory",
"title_custom": "Vlastní modifikátory",
"title_dynamic_default": "Proměnná výchozí hodnota",
"title_direct_input": "Přímý vstup",
"placeholder_simple": "Toto je {{placeholder}}",
"placeholder_default": "Toto je {{placeholder; default:výchozí hodnota.}}",
"modifier_eq_string": "{{value; male:On; female:Ona; default:Někdo}} má psa.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"title_built-in": "Built-in Modifiers",
"title_custom": "Custom Modifiers",
"title_dynamic_default": "Dynamic default",
"title_direct_input": "Direct input",
"placeholder_simple": "This is {{placeholder}}",
"placeholder_default": "This is {{placeholder; default:a default value.}}",
"modifier_eq_string": "{{value; male:He; female:She; default:No one}} has a dog.",
Expand Down
17 changes: 12 additions & 5 deletions examples/parser-default/src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import { locale, t } from '$lib/translations';
$: number = 10;
$: count = 1000;
const initTime = Date.now();
$: now = initTime;
Expand All @@ -14,6 +13,8 @@
const currency = 100;
const currencyRatio = { en: 1, cs: 22.4 };
$: direct = 'hardcoded';
</script>

<h1>{$t('content.title_placeholders')}</h1>
Expand All @@ -23,13 +24,14 @@

<h1>{$t('content.title_built-in')}</h1>
<div>
{$t('content.modifier_number', { count })}<br />
<button on:click="{() => {if (count) count -= 1;}}">–</button>
<button on:click="{() => {count += 1;}}">+</button>
{$t('content.modifier_number', { count: number })}<br />
<br>
<input type="number" bind:value="{number}" />
<button on:click="{() => {number -= 1;}}">–</button>
<button on:click="{() => {number += 1;}}">+</button>
</div>
<br />
<div>
<input type="number" bind:value="{number}" /><br />
{$t('content.modifier_eq', { value: number })}<br />
{$t('content.modifier_ne', { value: number })}<br />
{$t('content.modifier_lt', { value: number })}<br />
Expand Down Expand Up @@ -57,3 +59,8 @@
<button on:click="{() => {error = undefined;}}">(undefined)</button>
<br />
<p>{$t(`content.error.${error}`, { default: $t('content.error.default') })} ({error})</p>

<h1>{$t('content.title_direct_input')}</h1>
<button on:click="{() => {direct = 'hardcoded';}}">Hardcoded</button>
<button on:click="{() => {direct = 'dynamic';}}">Dynamic</button>
<p>{$t('This input is {{ value; }}!', { value: direct })}</p>

0 comments on commit 70dba68

Please sign in to comment.