--- /dev/null
+<script>
+ import { _ } from 'svelte-i18n';
+ export let message = $_('error.generic.message');
+</script>
+
+<div>
+ <h2>{$_('error.generic.title')}</h2>
+ <p>{message}</p>
+</div>
+
+<style>
+ div {
+ background: repeating-linear-gradient( -45deg, red, red 5px, black 5px, black 10px );
+ border: 5px solid red;
+ color: yellow;
+ font-family: 'ヒラギノ角ゴ ProN' , 'Hiragino Kaku Gothic ProN' , '游ゴシック' , '游ゴシック体' , YuGothic , 'Yu Gothic' , 'メイリオ' , Meiryo , 'MS ゴシック' , 'MS Gothic' , HiraKakuProN-W3 , 'TakaoExゴシック' , TakaoExGothic , 'MotoyaLCedar' , 'Droid Sans Japanese' , sans-serif;
+ margin: 0 10px 0 0;
+ padding: 100px 5px;
+ text-align: center;
+ }
+
+ h2, p {
+ background-color: black;
+ font-size: 1em;
+ }
+
+ h2 {
+ text-transform: uppercase;
+ }
+</style>
+
<script>
+ import { _ } from 'svelte-i18n';
import { forums } from '../../stores/forums.js';
+ import ErrorBlock from '../error_block/error_block.svelte';
</script>
<nav title="List of Forums">
+ {#if !$forums.length}
+ <ErrorBlock message={$_('forum_list.error.unavailable')} />
+ {/if}
<ul>
{#each $forums as forum}
<li>
<script>
export let params;
+ import ErrorBlock from '../error_block/error_block.svelte';
</script>
+<ErrorBlock />
<h1>Topic Index.</h1>
<p>This component lists topics for category or tag with id: {params.id}</p>
--- /dev/null
+import { addMessages, getLocaleFromNavigator, init } from 'svelte-i18n';
+
+import en from './translations/en.json';
+
+addMessages('en', en);
+
+init({
+ fallbackLocale: 'en',
+ initialLocale: getLocaleFromNavigator()
+});
--- /dev/null
+{
+ "error": {
+ "generic": {
+ "title": "Error!",
+ "message": "Unknown error has occurred. Panic!"
+ }
+ },
+ "forum_list": {
+ "error": {
+ "unavailable": "Forum list unavailable."
+ }
+ }
+}
<script>
import LightRouter from 'lightrouter';
+ // Initialize localization
+
+ import './config/i18n';
+
+ // Global components
+
import ForumList from './components/forum_list/forum_list.svelte';
import Header from './components/header/header.svelte';
handleChangeFeed(data) {
- console.log(data);
-
// No old value == add
if (!data.old_val) {
- console.log('Adding new data');
return internals.forums.push(data.new_val);
}
const index = internals.forums.findIndex((element) => element.id === data.old_val.id);
if (index > -1) {
- console.log(`Found old data at index ${index}`);
-
if (data.new_val) {
return internals.forums.splice(index, 1, data.new_val || undefined);
}