Add missing I18n in viewManager

This commit is contained in:
Robbie Antenesse 2019-09-16 12:09:44 -06:00
parent 7deda1c835
commit eda8e83d07
2 changed files with 23 additions and 8 deletions

View File

@ -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.",

View File

@ -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>