👽 translate 2 first pages

This commit is contained in:
Baptiste Lemoine 2019-10-01 16:52:36 +02:00
parent 91101f2326
commit 0f2a72f872
7 changed files with 52 additions and 89 deletions

View File

@ -4,17 +4,18 @@
<span class="logo_first">Frama</span> <span class="logo_first">Frama</span>
<span class="logo_second">date</span> <span class="logo_second">date</span>
</h1> </h1>
<i i18n="demo title|introduction header saying just demo @@demo">
Ceci est une démo
</i>
<span class="demo">
{{"config.demo"|translate}}
</span>
<span i18n="@@plural_example">
Updated {minutes, plural, =0 {just now} =1 {one minute ago} other {{{minutes}} minutes ago}}
</span>
<input i18n-placeholder placeholder="placeholder à traduire" i18n="@@demoPlaceholder"/>
</a> </a>
<div id="translate_example">
<div class="lang-choices">
<button class="btn btn-info" (click)="switchLanguage('en')">en</button>
<button class="btn btn-info" (click)="switchLanguage('fr')">fr</button>
</div>
<h1 translate>Title</h1>
<div>
{{ 'Intro' | translate:user }}
</div>
</div>
</header> </header>
<framadate-navigation></framadate-navigation> <framadate-navigation></framadate-navigation>
@ -22,13 +23,3 @@
<router-outlet></router-outlet> <router-outlet></router-outlet>
</main> </main>
<framadate-debugger></framadate-debugger> <framadate-debugger></framadate-debugger>
<div id="translate_example">
<div class="lang-choices">
<button (click)="switchLanguage('en')">en</button>
<button (click)="switchLanguage('fr')">fr</button>
</div>
<h1 translate>Title</h1>
<div>
{{ 'Intro' | translate:user }}
</div>
</div>

View File

@ -21,6 +21,7 @@ import {EndConfirmationComponent} from './pages/end-confirmation/end-confirmatio
import {CreateOrRetrieveComponent} from './pages/create-or-retrieve/create-or-retrieve.component'; import {CreateOrRetrieveComponent} from './pages/create-or-retrieve/create-or-retrieve.component';
import {CalendarComponent} from './calendar/calendar.component'; import {CalendarComponent} from './calendar/calendar.component';
import localeFr from '@angular/common/locales/fr'; import localeFr from '@angular/common/locales/fr';
import localeEn from '@angular/common/locales/en';
import {VotingSummaryComponent} from './pages/voting-summary/voting-summary.component'; import {VotingSummaryComponent} from './pages/voting-summary/voting-summary.component';
import {VotingGraphComponent} from './pages/voting-graph/voting-graph.component'; import {VotingGraphComponent} from './pages/voting-graph/voting-graph.component';
import {VotingChoiceComponent} from './pages/voting-choice/voting-choice.component'; import {VotingChoiceComponent} from './pages/voting-choice/voting-choice.component';
@ -43,6 +44,7 @@ export class MyMissingTranslationHandler implements MissingTranslationHandler {
} }
registerLocaleData(localeFr, 'fr'); registerLocaleData(localeFr, 'fr');
registerLocaleData(localeEn, 'en');
export function HttpLoaderFactory(http: HttpClient) { export function HttpLoaderFactory(http: HttpClient) {
return new TranslateHttpLoader(http); return new TranslateHttpLoader(http);
@ -80,7 +82,7 @@ export function HttpLoaderFactory(http: HttpClient) {
provide: MissingTranslationHandler, provide: MissingTranslationHandler,
useClass: MyMissingTranslationHandler, useClass: MyMissingTranslationHandler,
}, },
useDefaultLang: false, // useDefaultLang: false,
loader: { loader: {
provide: TranslateLoader, provide: TranslateLoader,
useFactory: HttpLoaderFactory, useFactory: HttpLoaderFactory,

View File

@ -4,6 +4,9 @@
<h2 i18n> <h2 i18n>
infos de debug infos de debug
</h2> </h2>
<span class="demo">
{{"config.demo"|translate}}
</span>
</strong> </strong>
<ul> <ul>
<li> <li>
@ -24,39 +27,6 @@
</ul> </ul>
</div> </div>
<span i18n>
Choix cornélien syncronisé:
</span>
<!-- todo: factoriser les boutons-->
<button
(click)="config.set('pollType' , 'classic')"
[class.active]="config.pollType == 'classic'"
[disabled]="!formIsValid"
class="btn btn-primary next"
>
<span i18n>
sondage classique
</span>
<span *ngIf="config.pollType == 'classic'">
[x]
</span>
</button>
<button
(click)="selectOption('pollType' ,'dates')"
[class.active]="config.pollType == 'dates'"
[disabled]="!formIsValid"
class="btn btn-primary next"
>
<span i18n>
sondage spécial date
</span>
<span *ngIf="config.pollType == 'dates'">
[x]
</span>
</button>
<button <button
class="btn" class="btn"
i18n i18n

View File

@ -1,2 +1,4 @@
<h1>Ce composant est celui de base pour les pages</h1> <h1>Ce composant est celui de base pour les pages</h1>
<a [routerLink]="'/step/end'" class="btn btn-block" i18n="@@confirm">C'est parfait!</a> <a [routerLink]="'/step/end'" class="btn btn-block" i18n="@@confirm">
{{"config.perfect"|translate}}
</a>

View File

@ -1,13 +1,12 @@
<section class="creation"> <section class="creation">
<h1 i18n> <h1>
Créer un sondage {{"creation.title"|translate}}
</h1> </h1>
<p <p
class="description" class="description"
i18n i18n
> >
Planifiez des rendez-vous avec vos amis ou votre famille ou créez un sondage avec du texte, des images ou des {{"config.title"|translate}}
liens… un sondage quoi !
</p> </p>
<div class="btn-next"> <div class="btn-next">
<a <a
@ -17,7 +16,7 @@
class="text" class="text"
i18n i18n
> >
C'est parti {{"config.letsgo"|translate}}
</span> </span>
<span class="icon right"> <span class="icon right">
> >
@ -26,8 +25,8 @@
</div> </div>
</section> </section>
<section class="recuperation"> <section class="recuperation">
<h1 i18n> <h1>
Où sont mes sondages ? {{"config.find_my_polls"|translate}}
</h1> </h1>
<form <form
action="https://framadate.org/find_polls.php" action="https://framadate.org/find_polls.php"
@ -38,7 +37,7 @@
for="email" for="email"
i18n i18n
> >
Je cherche les sondages qui correspondent à mon mail : {{"config.find_helper"|translate}} :
</label> </label>
<input <input
type="email" type="email"
@ -49,8 +48,7 @@
<input <input
type="submit" type="submit"
class="btn btn-block" class="btn btn-block"
i18n i18n-value="'config.find_button'|translate"
value="Retrouver mes sondages"
/> />
</form> </form>
</section> </section>

View File

@ -2,13 +2,13 @@
<router-outlet></router-outlet> <router-outlet></router-outlet>
<h1 i18n> <h1 i18n>
Pour commencer {{"creation.title"|translate}}
</h1> </h1>
<span <span
class="pre-selector" class="pre-selector"
i18n i18n
> >
Je veux créer un sondage {{"creation.want"|translate}}
</span> </span>
<select <select
id="selector" id="selector"
@ -17,10 +17,10 @@
[(ngModel)]="config.pollType" [(ngModel)]="config.pollType"
> >
<option value="dates"> <option value="dates">
spécial dates {{"creation.kind.date"|translate}}
</option> </option>
<option value="classic"> <option value="classic">
classique {{"creation.kind.classic"|translate}}
</option> </option>
</select> </select>
<span class="post-selector"> <span class="post-selector">
@ -32,7 +32,7 @@
class="title-label" class="title-label"
i18n i18n
> >
Dont le titre sera {{"creation.choose_title"|translate}}
</label> </label>
<input <input
type="text" type="text"
@ -45,7 +45,7 @@
</div> </div>
<div> <div>
<label for="my_name"> <label for="my_name">
Je peux aussi préciser mon nom si je le souhaite : {{"creation.name"|translate}} :
</label> </label>
<input <input
type="text" type="text"
@ -62,7 +62,7 @@
class="title-label" class="title-label"
i18n i18n
> >
et la description serait {{"creation.description"|translate}}
</label> </label>
<textarea <textarea
id="poll_description" id="poll_description"

View File

@ -7,28 +7,28 @@
"config": { "config": {
"demo": "this is a demo", "demo": "this is a demo",
"demo_other": "this is an other demo", "demo_other": "this is an other demo",
"continue": "Continuer", "continue": "Continue",
"perfect": "C'est parfait", "perfect": "That's perfect",
"title": "Créer un sondage", "title": "Create a poll",
"letsgo": "C'est parti'", "letsgo": "Lets go!",
"description": "Planifiez des rendez-vous avec vos amis ou votre famille ou créez un sondage avec du texte, des images ou des liens… un sondage quoi !", "description": "Planifiez des rendez-vous avec vos amis ou votre famille ou créez un sondage avec du texte, des images ou des liens… un sondage quoi !",
"find_my_polls": "Où sont mes sondages ?", "find_my_polls": "Where are my polls ?",
"find_helper": "Je cherche les sondages qui correspondent à mon mail", "find_helper": "I am looking for polls linked to my email",
"find_button": "Retrouver mes sondages" "find_button": "Find my polls"
}, },
"creation": { "creation": {
"title": "Pour commencer ", "title": "To begin with",
"want": "Je veux créer un sondage", "want": "I want to create a poll",
"kind": { "kind": {
"classic": "classique", "classic": "classic",
"date": "spécial dates" "date": "special dates"
}, },
"choose_title": "Dont le titre sera", "choose_title": "Whom title will be",
"choose_title_placeholder": "titre", "choose_title_placeholder": "title",
"name": "Je peux aussi préciser mon nom si je le souhaite", "name": "I can also specify my name if i want",
"name_placeholder": "mon nom", "name_placeholder": "my name",
"description": "et la description serait", "description": "and the description would be",
"description_placeholder": "description" "description_placeholder": "summary of the poll's purpose"
}, },
"dates": { "dates": {
"title": "Config spécialement pour les dates ", "title": "Config spécialement pour les dates ",