-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feature/misc-project-setup
- Loading branch information
Showing
19 changed files
with
1,044 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Action } from "redux"; | ||
|
||
export const SET_LOCALE = "SET_LOCALE"; | ||
|
||
export interface ILocaleAction extends Action { | ||
locale: string; | ||
} | ||
|
||
export function setLocale(locale: string): ILocaleAction { | ||
return { | ||
type: SET_LOCALE, | ||
locale, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { Store } from "redux"; | ||
import "reflect-metadata"; | ||
|
||
import { Container, inject, injectable } from "inversify"; | ||
import getDecorators from "inversify-inject-decorators"; | ||
|
||
import { Translator } from "./i18n/translator"; | ||
import { IAppState } from "./reducers/app"; | ||
import { store } from "./store/memory"; | ||
|
||
let container = new Container(); | ||
container.bind<Translator>(Translator).toSelf(); | ||
container.bind<Store<IAppState>>("store").toConstantValue(store); | ||
|
||
let { | ||
lazyInject, | ||
lazyInjectNamed, | ||
lazyInjectTagged, | ||
lazyMultiInject, | ||
} = getDecorators(container); | ||
|
||
export { | ||
container, | ||
lazyInject, | ||
lazyInjectNamed, | ||
lazyInjectTagged, | ||
lazyMultiInject, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
interface IBook { | ||
identifier: string; | ||
title: string; | ||
language: string; | ||
creator: string; | ||
size: number; | ||
physicalPageNb: number; | ||
coverUrl: string; | ||
} | ||
|
||
export class Book { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"books": [ | ||
{ | ||
"title":"" | ||
|
||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import * as i18n from "i18next"; | ||
import { injectable} from "inversify"; | ||
import * as path from "path"; | ||
|
||
import * as enCatalog from "../resources/locales/en.json"; | ||
import * as frCatalog from "../resources/locales/fr.json"; | ||
|
||
i18n.init({ | ||
resources: { | ||
en: { | ||
translation: enCatalog, | ||
}, | ||
fr: { | ||
translation: frCatalog, | ||
}, | ||
}, | ||
}); | ||
|
||
@injectable() | ||
export class Translator { | ||
private locale: string = "en"; | ||
|
||
public getLocale(): string { | ||
return this.locale; | ||
} | ||
|
||
public setLocale(locale: string) { | ||
this.locale = locale; | ||
i18n.changeLanguage(this.locale); | ||
} | ||
|
||
public translate(message: string): string { | ||
return i18n.t(message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { combineReducers } from "redux"; | ||
import { i18n, I18NState } from "./i18n"; | ||
|
||
export interface IAppState { | ||
i18n: I18NState; | ||
} | ||
|
||
export const app = combineReducers({ | ||
i18n, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { ILocaleAction, SET_LOCALE } from "./../actions/i18n"; | ||
|
||
export interface I18NState { | ||
locale: string; | ||
} | ||
|
||
const initialState: I18NState = { | ||
locale: "fr", | ||
}; | ||
|
||
export function i18n( | ||
state: I18NState = initialState, | ||
action: ILocaleAction, | ||
): I18NState { | ||
switch (action.type) { | ||
case SET_LOCALE: | ||
state.locale = action.locale; | ||
return state; | ||
default: | ||
return state; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"library": { | ||
"heading": "Your library" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"library": { | ||
"heading": "Votre bibliothèque" | ||
} | ||
} |
Oops, something went wrong.