Fix translations of messages in LoginScreen widget

To be translatable messages should be marked with '@i18n' and
present in "i18n_messages" dictionary.

Fixes: https://pagure.io/freeipa/issue/7619
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
Reviewed-By: Serhii Tsymbaliuk <stsymbal@redhat.com>
This commit is contained in:
Stanislav Levin 2018-07-06 11:56:26 +03:00 committed by Serhii Tsymbaliuk
parent 30bcad4ce3
commit d5c0bae9f4
2 changed files with 143 additions and 36 deletions

View File

@ -53,32 +53,35 @@ define(['dojo/_base/declare',
expired_msg: "Your session has expired. Please re-login.",
form_auth_msg: "<i class=\"fa fa-info-circle\"></i> To log in with <strong>username and password</strong>, enter them in the corresponding fields, then click Login.",
form_auth_msg: "<i class=\"fa fa-info-circle\"></i> To log in with " +
"<strong>username and password</strong>, enter them in the " +
"corresponding fields, then click Login.",
kerberos_msg: "<i class=\"fa fa-info-circle\"></i> To log in with <strong>Kerberos</strong>, please make sure you" +
" have valid tickets (obtainable via kinit) and " +
"<a href='http://${host}/ipa/config/ssbrowser.html'>configured</a>" +
" the browser correctly, then click Login. ",
cert_msg: "<i class=\"fa fa-info-circle\"></i> To log in with <strong>certificate</strong>," +
" please make sure you have valid personal certificate. ",
kerberos_msg: "<i class=\"fa fa-info-circle\"></i> To log in with " +
"<strong>Kerberos</strong>, please make sure you" +
" have valid tickets (obtainable via kinit) and <a href=" +
"'http://${host}/ipa/config/ssbrowser.html'>configured</a>" +
" the browser correctly, then click Login. ",
cert_msg: "<i class=\"fa fa-info-circle\"></i> To log in with " +
"<strong>certificate</strong>, please make sure you have valid " +
"personal certificate. ",
form_auth_failed: "Login failed due to an unknown reason. ",
form_auth_failed: "Login failed due to an unknown reason",
krb_auth_failed: "Authentication with Kerberos failed",
cert_auth_failed: "Authentication with personal certificate failed",
password_expired: "Your password has expired. Please enter a new password.",
password_expired: "Your password has expired. Please enter a new " +
"password.",
password_change_complete: "Password change complete",
denied: "Sorry you are not allowed to access this service.",
krbprincipal_expired: "Kerberos Principal you entered is expired",
krbprincipal_expired: "Kerberos Principal you entered is expired.",
invalid_password: "The password or username you entered is incorrect",
invalid_password: "The password you entered is incorrect. ",
user_locked: "The user account you entered is locked. ",
user_locked: "The user account you entered is locked",
//nodes:
login_btn_node: null,
@ -136,7 +139,8 @@ define(['dojo/_base/declare',
this.reset_btn_node = IPA.button({
name: 'reset',
label: text.get('@i18n:buttons.reset_password', "Reset Password"),
label: text.get('@i18n:buttons.reset_password',
"Reset Password"),
'class': 'btn-primary btn-lg',
click: this.on_confirm.bind(this)
})[0];
@ -145,7 +149,8 @@ define(['dojo/_base/declare',
this.reset_and_login_btn_node = IPA.button({
name: 'reset_and_login',
label: text.get('@i18n:buttons.reset_password_and_login', "Reset Password and Login"),
label: text.get('@i18n:buttons.reset_password_and_login',
"Reset Password and Log in"),
'class': 'btn-primary btn-lg',
click: this.on_confirm.bind(this)
})[0];
@ -480,21 +485,81 @@ define(['dojo/_base/declare',
constructor: function(spec) {
spec = spec || {};
this.expired_msg = text.get(spec.expired_msg || '@i18n:ajax.401.message',
this.expired_msg);
this.expired_msg = text.get(
spec.expired_msg || '@i18n:ajax.401.message',
this.expired_msg
);
this.form_auth_msg = text.get(spec.form_auth_msg || '@i18n:login.form_auth',
this.form_auth_msg);
this.form_auth_msg = text.get(
spec.form_auth_msg || '@i18n:login.form_auth',
this.form_auth_msg
);
this.kerberos_msg = text.get(spec.kerberos_msg || '@i18n:login.krb_auth_msg',
this.kerberos_msg);
this.kerberos_msg = text.get(
spec.kerberos_msg || '@i18n:login.krb_auth_msg',
this.kerberos_msg
);
this.kerberos_msg = this.kerberos_msg.replace('${host}', window.location.hostname);
this.cert_msg = text.get(
spec.cert_msg || '@i18n:login.cert_msg',
this.cert_msg
);
this.password_change_complete = text.get(spec.password_change_complete ||
'@i18n:password.password_change_complete', this.password_change_complete);
this.redirect_msg = text.get(
spec.redirect_msg || '@i18n:login.redirect_msg',
this.redirect_msg
);
this.krb_auth_failed = text.get(spec.krb_auth_failed, this.krb_auth_failed);
this.continue_msg = text.get(
spec.continue_msg || '@i18n:login.continue_msg',
this.continue_msg
);
this.kerberos_msg = this.kerberos_msg.replace(
'${host}', window.location.hostname
);
this.password_change_complete = text.get(
spec.password_change_complete ||
'@i18n:password.password_change_complete',
this.password_change_complete
);
this.form_auth_failed = text.get(
spec.form_auth_failed || '@i18n:login.form_auth_failed',
this.form_auth_failed
);
this.krb_auth_failed = text.get(
spec.krb_auth_failed || '@i18n:login.krb_auth_failed',
this.krb_auth_failed
);
this.cert_auth_failed = text.get(
spec.cert_auth_failed || '@i18n:login.cert_auth_failed',
this.cert_auth_failed
);
this.password_expired = text.get(
spec.password_expired || '@i18n:password.password_expired',
this.password_expired
);
this.krbprincipal_expired = text.get(
spec.krbprincipal_expired ||
'@i18n:login.krbprincipal_expired',
this.krbprincipal_expired
);
this.invalid_password = text.get(
spec.invalid_password || '@i18n:password.invalid_password',
this.invalid_password
);
this.user_locked = text.get(
spec.user_locked || '@i18n:login.user_locked',
this.user_locked
);
this.field_specs = LoginScreen.field_specs;
}
@ -513,7 +578,10 @@ define(['dojo/_base/declare',
$type: 'password',
name: 'password',
label: text.get('@i18n:login.password', "Password"),
placeholder: text.get('@i18n:login.password_and_otp', 'Password or Password+One-Time-Password'),
placeholder: text.get(
'@i18n:login.password_and_otp',
'Password or Password+One-Time-Password'
),
show_errors: false,
undo: false
},
@ -527,8 +595,14 @@ define(['dojo/_base/declare',
{
name: 'current_password',
$type: 'password',
label: text.get('@i18n:login.current_password', "Current Password"),
placeholder: text.get('@i18n:login.current_password', "Current Password"),
label: text.get(
'@i18n:password.current_password',
"Current Password"
),
placeholder: text.get(
'@i18n:password.current_password',
"Current Password"
),
show_errors: false,
undo: false
},
@ -536,7 +610,10 @@ define(['dojo/_base/declare',
name: 'otp',
$type: 'password',
label: text.get('@i18n:password.otp', "OTP"),
placeholder: text.get('@i18n:password.otp_long', 'One-Time-Password'),
placeholder: text.get(
'@i18n:password.otp_long',
'One-Time-Password'
),
show_errors: false,
undo: false
},
@ -544,8 +621,14 @@ define(['dojo/_base/declare',
name: 'new_password',
$type: 'password',
required: true,
label: text.get('@i18n:password.new_password)', "New Password"),
placeholder: text.get('@i18n:password.new_password)', "New Password"),
label: text.get(
'@i18n:password.new_password',
"New Password"
),
placeholder: text.get(
'@i18n:password.new_password',
"New Password"
),
show_errors: false,
undo: false
},
@ -553,8 +636,14 @@ define(['dojo/_base/declare',
name: 'verify_password',
$type: 'password',
required: true,
label: text.get('@i18n:password.verify_password', "Verify Password"),
placeholder: text.get('@i18n:password.new_password)', "New Password"),
label: text.get(
'@i18n:password.verify_password',
"Verify Password"
),
placeholder: text.get(
'@i18n:password.new_password',
"New Password"
),
validators: [{
$type: 'same_password',
other_field: 'new_password'

View File

@ -241,7 +241,8 @@ class i18n_messages(Command):
"remove": _("Delete"),
"remove_hold": _("Remove hold"),
"reset": _("Reset"),
"reset_password_and_login": _("Reset Password and Login"),
"reset_password": _("Reset Password"),
"reset_password_and_login": _("Reset Password and Log in"),
"restore": _("Restore"),
"retry": _("Retry"),
"revert": _("Revert"),
@ -342,11 +343,21 @@ class i18n_messages(Command):
},
"login": {
"authenticating": _("Authenticating"),
"cert_auth_failed": _(
"Authentication with personal certificate failed"),
"cert_msg": _(
"<i class=\"fa fa-info-circle\"></i> To log in with "
"<strong>certificate</strong>, please make sure you have "
"valid personal certificate. "
),
"continue_msg": _("Continue to next page"),
"form_auth": _(
"<i class=\"fa fa-info-circle\"></i> To log in with "
"<strong>username and password</strong>, enter them in the "
"corresponding fields, then click 'Log in'."),
"form_auth_failed": _("Login failed due to an unknown reason"),
"header": _("Logged In As"),
"krb_auth_failed": _("Authentication with Kerberos failed"),
"krb_auth_msg": _(
"<i class=\"fa fa-info-circle\"></i> To log in with "
"<strong>Kerberos</strong>, please make sure you have valid "
@ -354,6 +365,8 @@ class i18n_messages(Command):
"ipa/config/ssbrowser.html'>configured</a> the browser "
"correctly, then click 'Log in'."),
"loading": _("Loading"),
"krbprincipal_expired": _(
"Kerberos Principal you entered is expired"),
"loading_md": _("Loading data"),
"login": _("Log in"),
"login_certificate": _("Log In Using Certificate"),
@ -362,9 +375,11 @@ class i18n_messages(Command):
"logout_error": _("Log out error"),
"password": _("Password"),
"password_and_otp": _("Password or Password+One-Time-Password"),
"redirect_msg": _("You will be redirected in ${count}s"),
"sync_otp_token": _("Sync OTP Token"),
"synchronizing": _("Synchronizing"),
"username": _("Username"),
"user_locked": _("The user account you entered is locked"),
},
"measurement_units": {
"number_of_passwords": _("number of passwords"),
@ -930,7 +945,8 @@ class i18n_messages(Command):
"current_password_required": _("Current password is required"),
"expires_in": _("Your password expires in ${days} days."),
"first_otp": _("First OTP"),
"invalid_password": _("The password or username you entered is incorrect."),
"invalid_password": _(
"The password or username you entered is incorrect"),
"new_password": _("New Password"),
"new_password_required": _("New password is required"),
"otp": _("OTP"),
@ -942,6 +958,8 @@ class i18n_messages(Command):
"password": _("Password"),
"password_and_otp": _("Password or Password+One-Time-Password"),
"password_change_complete": _("Password change complete"),
"password_expired": _(
"Your password has expired. Please enter a new password."),
"password_must_match": _("Passwords must match"),
"reset_failure": _("Password reset was not successful."),
"reset_password": _("Reset Password"),