[New] Added localization, currently english (en) and german (de) are supported.
This commit is contained in:
parent
117cadaf16
commit
f5b6000a0d
|
@ -24,6 +24,7 @@
|
|||
"paper-button": "PolymerElements/paper-button#^1.0.13",
|
||||
"iron-a11y-keys": "PolymerElements/iron-a11y-keys#^1.0.6",
|
||||
"paper-input": "PolymerElements/paper-input#^1.1.17",
|
||||
"iron-ajax": "PolymerElements/iron-ajax#^1.4.3"
|
||||
"iron-ajax": "PolymerElements/iron-ajax#^1.4.3",
|
||||
"strolch-localize-behavior": "strolch-localize-behavior#^1.0.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
"en": {
|
||||
"pleaseLogin": "Please login to {appTitle}",
|
||||
"username": "Username",
|
||||
"password": "Password",
|
||||
"login": "Login",
|
||||
"reset": "Reset",
|
||||
"passwordReset": "Password Reset",
|
||||
"passwordResetDesc": "To reset your password, enter your username",
|
||||
"passwordResetInitiated": "The reset has been initiated for your account. Please check your e-mail inbox as there should be an e-mail with a reset code. The code in the e-mail will be valid for one hour.",
|
||||
"passwordResetCode": "Please enter the code here:",
|
||||
"passwordResetNew": "Type in a new password and please repeat it",
|
||||
"passwordResetDone": "Your password has been reset. Please login by navigating to the login dialog.",
|
||||
"code": "Code",
|
||||
"repeat": "Repeat",
|
||||
"send": "Send"
|
||||
},
|
||||
"de": {
|
||||
"pleaseLogin": "Melden Sie sich bei {appTitle} an",
|
||||
"username": "Nutzername",
|
||||
"password": "Passwort",
|
||||
"login": "Anmelden",
|
||||
"reset": "Zurücksetzen",
|
||||
"passwordReset": "Passwort zurücksetzen",
|
||||
"passwordResetDesc": "Geben Sie Ihren Nutzernamen ein, um ihr Passwort zurückzusetzen",
|
||||
"passwordResetInitiated": "Der Passwort-Reset wurde eingeleitet. Bitte überprüfen Sie ihren E-Mail Eingang, dieser sollte nun eine E-Mail mit dem Bestätigungs-Code enthalten. Dieser ist für eine Stunde gültig.",
|
||||
"passwordResetCode": "Bitte geben Sie den Code hier ein:",
|
||||
"passwordResetNew": "Geben Sie ein neues Passwort ein und wiederholen Sie es",
|
||||
"passwordResetDone": "Ihr Passwort wurde zurückgesetzt. Bitte loggen Sie sich im Login-Dialog ein.",
|
||||
"code": "Code",
|
||||
"repeat": "Wiederholen",
|
||||
"send": "Absenden"
|
||||
}
|
||||
}
|
|
@ -7,6 +7,7 @@
|
|||
<link rel="import" href="../../bower_components/paper-button/paper-button.html">
|
||||
<link rel="import" href="../../bower_components/iron-a11y-keys/iron-a11y-keys.html">
|
||||
<link rel="import" href="../../bower_components/iron-ajax/iron-ajax.html">
|
||||
<link rel="import" href="../../bower_components/strolch-localize-behavior/strolch-localize-behavior.html">
|
||||
|
||||
<dom-module id="strolch-wc-auth">
|
||||
|
||||
|
@ -44,101 +45,99 @@
|
|||
|
||||
<div id="authForm" class="centered">
|
||||
<iron-a11y-keys id="a11y" keys="enter" on-keys-pressed="_submitForm"></iron-a11y-keys>
|
||||
<paper-card heading="Login">
|
||||
<paper-card heading="{{localize('login')}}">
|
||||
<div class="card-content">
|
||||
<p>Please login to [[appTitle]]</p>
|
||||
<p>{{localize('pleaseLogin', 'appTitle', appTitle)}}</p>
|
||||
<paper-input id="username"
|
||||
bind-value="{{username}}"
|
||||
label="Username"
|
||||
label="{{localize('username')}}"
|
||||
required
|
||||
autofocus="true"
|
||||
auto-validate></paper-input>
|
||||
|
||||
<paper-input id="password"
|
||||
bind-value="{{password}}"
|
||||
label="Password"
|
||||
label="{{localize('password')}}"
|
||||
required
|
||||
type="password"
|
||||
auto-validate></paper-input>
|
||||
</div>
|
||||
<div class="card-actions">
|
||||
<paper-button on-tap="_showResetForm">Reset</paper-button>
|
||||
<paper-button on-tap="_submitForm">Login</paper-button>
|
||||
<paper-button on-tap="_showResetForm">{{localize('reset')}}</paper-button>
|
||||
<paper-button on-tap="_submitForm">{{localize('login')}}</paper-button>
|
||||
</div>
|
||||
</paper-card>
|
||||
</div>
|
||||
|
||||
<div id="initiateResetForm" class="centered" hidden>
|
||||
<iron-a11y-keys id="a11y" keys="enter" on-keys-pressed="_initiateReset"></iron-a11y-keys>
|
||||
<paper-card heading="Password Reset">
|
||||
<paper-card heading="{{localize('passwordReset')}}">
|
||||
<div class="card-content">
|
||||
<p>To reset your password, enter your username</p>
|
||||
<p>{{localize('passwordResetDesc')}}</p>
|
||||
<paper-input id="usernameReset"
|
||||
bind-value="{{username}}"
|
||||
label="Username"
|
||||
label="{{localize('username')}}"
|
||||
required
|
||||
autofocus="true"
|
||||
auto-validate></paper-input>
|
||||
</div>
|
||||
<div class="card-actions">
|
||||
<paper-button on-tap="_initiateReset">Reset</paper-button>
|
||||
<paper-button on-tap="_initiateReset">{{localize('reset')}}</paper-button>
|
||||
</div>
|
||||
</paper-card>
|
||||
</div>
|
||||
|
||||
<div id="resetInitiated" class="centered" hidden>
|
||||
<iron-a11y-keys id="a11y" keys="enter" on-keys-pressed="_validateChallenge"></iron-a11y-keys>
|
||||
<paper-card heading="Password Reset">
|
||||
<paper-card heading="{{localize('passwordReset')}}">
|
||||
<div class="card-content">
|
||||
<p>The reset has been initiated for your account. Please check your e-mail inbox as there should
|
||||
be an e-mail with a reset code. The code in the e-mail will be valid for one hour.</p>
|
||||
|
||||
<p>Please enter the code here:</p>
|
||||
<p>{{localize('passwordResetInitiated')}}</p>
|
||||
<p>{{localize('passwordResetCode')}}</p>
|
||||
<paper-input id="code"
|
||||
bind-value="{{code}}"
|
||||
label="Code"
|
||||
label="{{localize('code')}}"
|
||||
required
|
||||
autofocus="true"
|
||||
auto-validate></paper-input>
|
||||
</div>
|
||||
<div class="card-actions">
|
||||
<paper-button on-tap="_validateChallenge">Send</paper-button>
|
||||
<paper-button on-tap="_validateChallenge">{{localize('send')}}</paper-button>
|
||||
</div>
|
||||
</paper-card>
|
||||
</div>
|
||||
|
||||
<div id="resetForm" class="centered" hidden>
|
||||
<iron-a11y-keys id="a11y" keys="enter" on-keys-pressed="_doReset"></iron-a11y-keys>
|
||||
<paper-card heading="Password Reset">
|
||||
<paper-card heading="{{localize('passwordReset')}}">
|
||||
<div class="card-content">
|
||||
<p>Type in a new password and please repeat it</p>
|
||||
<p>{{localize('passwordResetNew')}}</p>
|
||||
<paper-input id="password1"
|
||||
bind-value="{{password1}}"
|
||||
label="Password"
|
||||
label="{{localize('password')}}"
|
||||
required
|
||||
type="password"
|
||||
auto-validate></paper-input>
|
||||
<paper-input id="password2"
|
||||
bind-value="{{password2}}"
|
||||
label="Repeat"
|
||||
label="{{localize('repeat')}}"
|
||||
required
|
||||
type="password"
|
||||
auto-validate></paper-input>
|
||||
</div>
|
||||
<div class="card-actions">
|
||||
<paper-button on-tap="_doReset">Reset</paper-button>
|
||||
<paper-button on-tap="_doReset">{{localize('reset')}}</paper-button>
|
||||
</div>
|
||||
</paper-card>
|
||||
</div>
|
||||
|
||||
<div id="passwordResetDone" class="centered" hidden>
|
||||
<iron-a11y-keys id="a11y" keys="enter" on-keys-pressed="_toLogin"></iron-a11y-keys>
|
||||
<paper-card heading="Password Reset">
|
||||
<paper-card heading="{{localize('passwordReset')}}">
|
||||
<div class="card-content">
|
||||
<p>Your password has been reset. Please login by navigating to the login dialog.</p>
|
||||
<p>{{localize('passwordResetDone')}}</p>
|
||||
</div>
|
||||
<div class="card-actions">
|
||||
<paper-button on-tap="_showLoginForm">Login</paper-button>
|
||||
<paper-button on-tap="_showLoginForm">{{localize('login')}}</paper-button>
|
||||
</div>
|
||||
</paper-card>
|
||||
</div>
|
||||
|
@ -165,6 +164,10 @@
|
|||
|
||||
is: 'strolch-wc-auth',
|
||||
|
||||
behaviors: [
|
||||
StrolchLocalizeBehavior
|
||||
],
|
||||
|
||||
properties: {
|
||||
app: {
|
||||
type: Object
|
||||
|
@ -199,6 +202,14 @@
|
|||
// do nothing
|
||||
},
|
||||
|
||||
attached: function () {
|
||||
// this component has its own locales resources to load
|
||||
this.loadResources(this.resolveUrl("./locales.json"));
|
||||
|
||||
// default the language to english, if there is none given by the app
|
||||
if(!this.language) this.language = "en";
|
||||
},
|
||||
|
||||
reload: function () {
|
||||
|
||||
this.username = '';
|
||||
|
|
Loading…
Reference in New Issue