Make some i18n for trans text

Add some i18n for trans text, include python/html/js files.

Change-Id: I4dedfc385978896816945b0373ff41c5eaf63c7d
Partial-Bug: #1610542
This commit is contained in:
zhurong 2016-08-06 22:58:23 +08:00
parent a968b69b9c
commit b365322631
4 changed files with 14 additions and 14 deletions

View File

@ -186,7 +186,7 @@ class UpdatableFieldsForm(forms.Form):
if hasattr(field, 'update'):
field.update(self.initial, form=self, request=request)
if not field.required:
field.widget.attrs['placeholder'] = 'Optional'
field.widget.attrs['placeholder'] = _('Optional')
class ServiceConfigurationForm(UpdatableFieldsForm):

View File

@ -48,11 +48,11 @@ $(function() {
var $newEnvTr = $('<tr class="new_env">' +
'<td id="input_create_env" class="normal_column row" colspan="2"></td>' +
'<td class="normal_column">New</td>' +
'<td class="normal_column">' + gettext("New") + '</td>' +
'<td class="actions_column">' +
'<div class="btn-group">' +
'<button id="confirm_create_env" class="btn btn-primary">Create</button>' +
'<button id="cancel_create_env" class="btn btn-default">Cancel</button>' +
'<button id="confirm_create_env" class="btn btn-primary">' + gettext("Create") + '</button>' +
'<button id="cancel_create_env" class="btn btn-default">' + gettext("Cancel") + '</button>' +
'</div></td></tr>');
$name.appendTo($newEnvTr.find('td#input_create_env'));
@ -80,7 +80,7 @@ $(function() {
$newEnvTr.remove();
hideSpinner();
horizon.alert('error',
'There was an error submitting the form. Please try again.');
gettext("There was an error submitting the form. Please try again."));
},
success: function(data, status, xhr) {
if ( data === '' ) {

View File

@ -40,7 +40,7 @@ $(function() {
var password = $this.closest(".form-field,.form-group").prev().find("input").val();
var confirmPassword = $this.val();
var div = $this.closest(".form-field,.form-group");
mainCheck(div, password, confirmPassword, "Passwords do not match");
mainCheck(div, password, confirmPassword, gettext("Passwords do not match"));
}
function checkStrengthRemoveErrIfMatches(event) {
@ -51,29 +51,29 @@ $(function() {
var confirmPassword = $('#' + confirmPassId).val();
var div = $this.closest(".form-field,.form-group").next();
if (confirmPassword.length) {
mainCheck(div, password, confirmPassword, "Passwords do not match");
mainCheck(div, password, confirmPassword, gettext("Passwords do not match"));
}
var text = "Your password should have at least";
var text = gettext("Your password should have at least");
var meetRequirements = true;
if (password.length < 7) {
text += " 7 characters";
text += gettext(" 7 characters");
meetRequirements = false;
}
if (password.match(/[A-Z]+/) === null) {
text += " 1 capital letter";
text += gettext(" 1 capital letter");
meetRequirements = false;
}
if (password.match(/[a-z]+/) === null) {
text += " 1 non-capital letter";
text += gettext(" 1 non-capital letter");
meetRequirements = false;
}
if (password.match(/[0-9]+/) === null) {
text += " 1 digit";
text += gettext(" 1 digit");
meetRequirements = false;
}
if (password.match(/[!@#$%^&*()_+|\/.,~?><:{}-]+/) === null) {
text += " 1 special character";
text += gettext(" 1 special character");
meetRequirements = false;
}

View File

@ -72,7 +72,7 @@
<div class="form-group has-feedback">
<input class="form-control"
value="{{ search }}" type="text"
name="search" placeholder="Filter">
name="search" placeholder="{% trans 'Filter' %}">
<span class="fa fa-search form-control-feedback search-icon"></span>
</div>
<div class="form-group">