#17 Label improvements multi-language

This commit is contained in:
mauriziovitale84
2016-05-13 16:35:07 +01:00
parent f68dfadce3
commit 66272dd703
4 changed files with 44 additions and 28 deletions
+18 -10
View File
@@ -1,11 +1,19 @@
{
"title" : "Welcome",
"login" : "Login",
"username" : "Username",
"password" : "Password",
"input-required-message": "Required",
"input-min-message": "Your username needs to be at least 4 characters.",
"login-button": "Login",
"login-error-message": "You have entered an invalid username or password",
"login-success-message": "Login successful"
}
"LOGIN": {
"LABEL": {
"LOGIN": "Login",
"USERNAME": "Username",
"PASSWORD": "Password"
},
"MESSAGES": {
"USERNAME-REQUIRED": "Required",
"USERNAME-MIN": "Your username needs to be at least 4 characters.",
"PASSWORD-REQUIRED": "Required",
"LOGIN-ERROR": "You have entered an invalid username or password",
"LOGIN-SUCCESS": "Login successful"
},
"BUTTON": {
"LOGIN": "Login"
}
}
}
+17 -9
View File
@@ -1,11 +1,19 @@
{
"title" : "Benvenuto",
"login" : "Autenticazione",
"username" : "Nome utente",
"password" : "Password",
"input-required-message": "Campo obbligatorio",
"input-min-message": "Inserire un nome utente di 4 caratteri minimo.",
"login-button": "Accedi",
"login-error-message": "Nome utente o password non validi",
"login-success-message": "Login effettuata con successo"
"LOGIN": {
"LABEL": {
"LOGIN": "Autenticazione",
"USERNAME": "Nome utente",
"PASSWORD": "Password"
},
"MESSAGES": {
"USERNAME-REQUIRED": "Campo obbligatorio",
"USERNAME-MIN": "Inserire un nome utente di minimo 4 caratteri.",
"PASSWORD-REQUIRED": "Campo obbligatorio",
"LOGIN-ERROR": "Nome utente o password non validi",
"LOGIN-SUCCESS": "Login effettuata con successo"
},
"BUTTON": {
"LOGIN": "Accedi"
}
}
}
@@ -1,11 +1,11 @@
<div class="login-card-wide mdl-card mdl-shadow--4dp">
<form [ngFormModel]="form" (submit)="onSubmit(form.value, $event)">
<div class="mdl-card__title">
<h2 class="mdl-card__title-text ">{{'login' | translate }}</h2>
<h2 class="mdl-card__title-text ">{{'LOGIN.LABEL.LOGIN' | translate }}</h2>
</div>
<div class="mdl-card__supporting-text">
<div [ngClass]="{'is-invalid': isErrorStyle(form.controls.username)}" class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label ">
<label for="username" class="mdl-textfield__label">{{'username' | translate }}</label>
<label for="username" class="mdl-textfield__label">{{'LOGIN.LABEL.USERNAME' | translate }}</label>
<input type="text" class="mdl-textfield__input" id="username" data-automation-id="username" ngControl="username" tabindex="1" />
<span class="mdl-tooltip mdl-tooltip--validation" for="username" *ngIf="formError.username">
<span id="username-error" data-automation-id="username-error">{{formError.username | translate }}</span>
@@ -13,7 +13,7 @@
</div>
<div [ngClass]="{'is-invalid': isErrorStyle(form.controls.password)}" class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<label for="password" class="mdl-textfield__label">{{'password' | translate }}</label>
<label for="password" class="mdl-textfield__label">{{'LOGIN.LABEL.PASSWORD' | translate }}</label>
<input type="password" class="mdl-textfield__input" id="password" data-automation-id="password" ngControl="password" tabindex="2" />
<span class="mdl-tooltip mdl-tooltip--validation" for="password" *ngIf="formError.password">
<span id="password-required" data-automation-id="password-required">{{formError.password | translate }}</span>
@@ -21,9 +21,9 @@
</div>
</div>
<div class="mdl-card__actions mdl-card--border">
<button type="submit" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--colored" data-automation-id="login-button" [disabled]="!form.valid">{{'login-button' | translate }}</button>
<div *ngIf="error" id="login-error" data-automation-id="login-error" class="mdl-card__supporting-text" style="color: red;">{{'login-error-message' | translate }}</div>
<div *ngIf="success" id="login-success" data-automation-id="login-success" class="mdl-card__supporting-text" style="color: blue;">{{'login-success-message' | translate }}</div>
<button type="submit" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--colored" data-automation-id="login-button" [disabled]="!form.valid">{{'LOGIN.BUTTON.LOGIN' | translate }}</button>
<div *ngIf="error" id="login-error" data-automation-id="login-error" class="mdl-card__supporting-text" style="color: red;">{{'LOGIN.MESSAGES.LOGIN-ERROR' | translate }}</div>
<div *ngIf="success" id="login-success" data-automation-id="login-success" class="mdl-card__supporting-text" style="color: blue;">{{'LOGIN.MESSAGES.LOGIN-SUCCESS' | translate }}</div>
</div>
<div class="mdl-card__menu">
<div class="mdl-spinner mdl-js-spinner"></div>
@@ -73,11 +73,11 @@ export class AlfrescoLoginComponent {
this._message = {
'username': {
'required': 'input-required-message',
'minlength': 'input-min-message'
'required': 'LOGIN.MESSAGES.USERNAME-REQUIRED',
'minlength': 'LOGIN.MESSAGES.USERNAME-MIN'
},
'password': {
'required': 'input-required-message'
'required': 'LOGIN.MESSAGES.PASSWORD-REQUIRED'
}
};
this.translationInit(translate);