Add missing I18n in viewManager
This commit is contained in:
parent
7deda1c835
commit
eda8e83d07
|
@ -1,6 +1,13 @@
|
||||||
{
|
{
|
||||||
"name": "English",
|
"name": "English",
|
||||||
"locale": "en",
|
"locale": "en",
|
||||||
|
"global": {
|
||||||
|
"searchbar_placeholder": "Search for Books",
|
||||||
|
"menu_login": "Log In",
|
||||||
|
"menu_logout": "Log Out",
|
||||||
|
"footer_repo": "Repo",
|
||||||
|
"footer_chat": "Chat"
|
||||||
|
},
|
||||||
"home": {
|
"home": {
|
||||||
"logged_out_subtitle": "All the Book Buzz in Once Place",
|
"logged_out_subtitle": "All the Book Buzz in Once Place",
|
||||||
"logged_out_track_books": "Keep track of books you've read, want to read, and are currently reading.",
|
"logged_out_track_books": "Keep track of books you've read, want to read, and are currently reading.",
|
||||||
|
|
|
@ -2,11 +2,13 @@ import html from 'choo/html';
|
||||||
|
|
||||||
import headerImage from '../../dev/images/header.png';
|
import headerImage from '../../dev/images/header.png';
|
||||||
|
|
||||||
|
import { I18n } from '../i18n';
|
||||||
import { homeView } from './home';
|
import { homeView } from './home';
|
||||||
import { loginView } from './login';
|
import { loginView } from './login';
|
||||||
import { searchView } from './search';
|
import { searchView } from './search';
|
||||||
|
|
||||||
export const viewManager = (state, emit) => {
|
export const viewManager = (state, emit) => {
|
||||||
|
const i18n = new I18n(state);
|
||||||
// In viewManager all we are doing is checking the app's state
|
// In viewManager all we are doing is checking the app's state
|
||||||
// and passing the state and emit to the relevant view.
|
// and passing the state and emit to the relevant view.
|
||||||
let htmlContent = html`<div>loading</div>`;
|
let htmlContent = html`<div>loading</div>`;
|
||||||
|
@ -42,13 +44,15 @@ export const viewManager = (state, emit) => {
|
||||||
|
|
||||||
<div class="menu">
|
<div class="menu">
|
||||||
<label style="display: inline-block;">
|
<label style="display: inline-block;">
|
||||||
<input type="text" name="search" placeholder="Search" onchange=${e => {
|
<input type="text" name="search"
|
||||||
console.log(encodeURIComponent(e.target.value.trim()));
|
placeholder=${i18n.__('global.searchbar_placeholder')}
|
||||||
emit('pushState', '/search?for=' + encodeURIComponent(e.target.value.trim()));
|
onchange=${e => {
|
||||||
}}>
|
emit('pushState', '/search?for=' + encodeURIComponent(e.target.value.trim()));
|
||||||
|
}}
|
||||||
|
>
|
||||||
</label>
|
</label>
|
||||||
<a href="/login" class="pseudo button">Log In</a>
|
<a href="/login" class="pseudo button">${i18n.__('global.menu_login')}</a>
|
||||||
<a href="/logout" class="pseudo button">Log Out</a>
|
<a href="/logout" class="pseudo button">${i18n.__('global.menu_logout')}</a>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
|
@ -60,8 +64,12 @@ export const viewManager = (state, emit) => {
|
||||||
<footer>
|
<footer>
|
||||||
<nav>
|
<nav>
|
||||||
<div class="links">
|
<div class="links">
|
||||||
<a href="https://gitlab.com/Alamantus/Readlebee" class="pseudo button">Repo</a>
|
<a href="https://gitlab.com/Alamantus/Readlebee" class="pseudo button">
|
||||||
<a href="https://gitter.im/Readlebee/community" class="pseudo button">Chat</a>
|
${i18n.__('global.footer_repo')}
|
||||||
|
</a>
|
||||||
|
<a href="https://gitter.im/Readlebee/community" class="pseudo button">
|
||||||
|
${i18n.__('global.footer_chat')}
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
Loading…
Reference in New Issue