refactor: 💡 move about messages to their own dir (not working)

This commit is contained in:
Christian Kaisermann 2019-11-19 17:14:48 -03:00
parent 408b40cc8c
commit b8ce517455
11 changed files with 59 additions and 31 deletions

View File

@ -1,10 +1,7 @@
{
"title": {
"about": "About",
"index": "Sapper project template!"
},
"about_this_site": "About this site",
"about_content": ["This is the 'about' page. There's not much here."],
"messages": {
"success": "Great success!",
"high_five": "High five",

View File

@ -1,10 +1,7 @@
{
"title": {
"about": "About",
"index": "Sapper project template!"
},
"about_this_site": "About this site",
"about_content": ["This is the 'about' page. There's not much here."],
"messages": {
"success": "Great success!",
"high_five": "High five",

View File

@ -1,10 +1,7 @@
{
"title": {
"about": "Acerca de",
"index": " Plantilla de proyecto Sapper!"
},
"about_this_site": " Acerca de este sitio",
"about_content": ["Esta es la página 'acerca de'. No hay mucho aquí."],
"messages": {
"success": "Gran éxito!",
"high_five": "Cinco altos",

View File

@ -1,10 +1,7 @@
{
"title": {
"about": "Sobre",
"index": "Modelo de projeto em Sapper!"
},
"about_this_site": "Sobre este site",
"about_content": ["Esta é a página 'sobre'. Não há muito aqui."],
"messages": {
"success": "Suuuucesso!",
"high_five": "Toca aqui",

View File

@ -1,5 +1,5 @@
<script context="module">
import { locale, getClientLocale } from 'svelte-i18n'
import { locale, locales, getClientLocale } from 'svelte-i18n'
export async function preload() {
return locale.set(getClientLocale({ default: 'en-US', navigator: true }))
@ -9,7 +9,7 @@
<script>
import Nav from '../components/Nav.svelte'
const locales = {
const localeLabels = {
'pt-BR': 'Português',
'en-US': 'English',
'es-ES': 'Espanõl',
@ -33,8 +33,8 @@
<main>
<select bind:value={$locale}>
{#each Object.entries(locales) as [locale, label]}
<option value={locale}>{label}</option>
{#each $locales as locale}
<option value={locale}>{localeLabels[locale]}</option>
{/each}
</select>
<slot />

View File

@ -1,15 +0,0 @@
<script>
import { _ } from 'svelte-i18n'
</script>
<svelte:head>
<title>{$_('title.about', { default: 'About' })}</title>
</svelte:head>
<h1>{$_('about_this_site', { default: 'About this site' })}</h1>
<p>
{$_('about_content[0]', {
default: "This is the 'about' page. There's not much here.",
})}
</p>

View File

@ -0,0 +1,7 @@
{
"title": {
"about": "About"
},
"about_this_site": "About this site",
"about_content": ["This is the 'about' page. There's not much here."]
}

View File

@ -0,0 +1,7 @@
{
"title": {
"about": "About"
},
"about_this_site": "About this site",
"about_content": ["This is the 'about' page. There's not much here."]
}

View File

@ -0,0 +1,7 @@
{
"title": {
"about": "Acerca de"
},
"about_this_site": " Acerca de este sitio",
"about_content": ["Esta es la página 'acerca de'. No hay mucho aquí."]
}

View File

@ -0,0 +1,7 @@
{
"title": {
"about": "Sobre"
},
"about_this_site": "Sobre este site",
"about_content": ["Esta é a página 'sobre'. Não há muito aqui."]
}

View File

@ -0,0 +1,27 @@
<script context="module">
// import { partial } from 'svelte-i18n'
export async function preload() {
// return partial({
// 'en-US': () => import('./_locales/en-US.json'),
// 'pt-BR': () => import('./_locales/pt-BR.json'),
// 'es-ES': () => import('./_locales/es-ES.json'),
// })
}
</script>
<script>
import { _ } from 'svelte-i18n'
</script>
<svelte:head>
<title>{$_('title.about', { default: 'About' })}</title>
</svelte:head>
<h1>{$_('about_this_site', { default: 'About this site' })}</h1>
<p>
{$_('about_content[0]', {
default: "This is the 'about' page. There's not much here.",
})}
</p>