Make default form fields translatable

This commit is contained in:
Jay Trees 2022-03-22 16:40:02 +01:00
parent 3042fb3878
commit 1604a1834c
2 changed files with 86 additions and 29 deletions

View file

@ -96,6 +96,36 @@ $(function() {
$.fn.toast.settings.showIcon = true; $.fn.toast.settings.showIcon = true;
$.fn.toast.settings.title = text.modal_success_title; $.fn.toast.settings.title = text.modal_success_title;
/** Form Prompts */
$.fn.form.settings.prompt = {
empty : text.form_prompt.empty,
checked : text.form_prompt.checked,
email : text.form_prompt.email,
url : text.form_prompt.url,
regExp : text.form_prompt.regExp,
integer : text.form_prompt.integer,
decimal : text.form_prompt.decimal,
number : text.form_prompt.number,
is : text.form_prompt.is,
isExactly : text.form_prompt.isExactly,
not : text.form_prompt.not,
notExactly : text.form_prompt.notExactly,
contain : text.form_prompt.contain,
containExactly : text.form_prompt.containExactly,
doesntContain : text.form_prompt.doesntContain,
doesntContainExactly : text.form_prompt.doesntContainExactly,
minLength : text.form_prompt.minLength,
length : text.form_prompt.length,
exactLength : text.form_prompt.exactLength,
maxLength : text.form_prompt.maxLength,
match : text.form_prompt.match,
different : text.form_prompt.different,
creditCard : text.form_prompt.creditCard,
minCount : text.form_prompt.minCount,
exactCount : text.form_prompt.exactCount,
maxCount : text.form_prompt.maxCount,
};
/** /**
* Menu * Menu
*/ */

View file

@ -238,7 +238,7 @@ class Page
modal_warning_approve : '<?= __('Understood') ?>', modal_warning_approve : '<?= __('Understood') ?>',
modal_success_title : '<?= __('Success') ?>', modal_success_title : '<?= __('Success') ?>',
modal_wishlist_warning_approve: '<?= __('Close this tab') ?>', modal_wishlist_warning_approve : '<?= __('Close this tab') ?>',
modal_wishlist_warning_deny : '<?= __('Show wishlist anyway') ?>', modal_wishlist_warning_deny : '<?= __('Show wishlist anyway') ?>',
modal_wishlist_delete_title : '<?= __('Really delete?') ?>', modal_wishlist_delete_title : '<?= __('Really delete?') ?>',
modal_wishlist_delete : '<?= sprintf(__('Do you really want to delete the wishlist %s?'), '<strong>WISHLIST_NAME</strong>') ?>', modal_wishlist_delete : '<?= sprintf(__('Do you really want to delete the wishlist %s?'), '<strong>WISHLIST_NAME</strong>') ?>',
@ -268,6 +268,33 @@ class Page
toast_clipboard_error_title : '<?= __('Error') ?>', toast_clipboard_error_title : '<?= __('Error') ?>',
toast_clipboard_error : '<?= __('Unable to copy to clipboard. There is likely a permission issue.') ?>', toast_clipboard_error : '<?= __('Unable to copy to clipboard. There is likely a permission issue.') ?>',
toast_clipboard_success : '<?= __('Link copied to clipboard.') ?>', toast_clipboard_success : '<?= __('Link copied to clipboard.') ?>',
form_prompt_empty : '<?= __('{name} must have a value') ?>',
form_prompt_checked : '<?= __('{name} must be checked') ?>',
form_prompt_email : '<?= __('{name} must be a valid e-mail') ?>',
form_prompt_url : '<?= __('{name} must be a valid url') ?>',
form_prompt_regExp : '<?= __('{name} is not formatted correctly') ?>',
form_prompt_integer : '<?= __('{name} must be an integer') ?>',
form_prompt_decimal : '<?= __('{name} must be a decimal number') ?>',
form_prompt_number : '<?= __('{name} must be set to a number') ?>',
form_prompt_is : '<?= __('{name} must be \'{ruleValue}\'') ?>',
form_prompt_isExactly : '<?= __('{name} must be exactly \'{ruleValue}\'') ?>',
form_prompt_not : '<?= __('{name} cannot be set to \'{ruleValue}\'') ?>',
form_prompt_notExactly : '<?= __('{name} cannot be set to exactly \'{ruleValue}\'') ?>',
form_prompt_contain : '<?= __('{name} cannot contain \'{ruleValue}\'') ?>',
form_prompt_containExactly : '<?= __('{name} cannot contain exactly \'{ruleValue}\'') ?>',
form_prompt_doesntContain : '<?= __('{name} must contain \'{ruleValue}\'') ?>',
form_prompt_doesntContainExactly : '<?= __('{name} must contain exactly \'{ruleValue}\'') ?>',
form_prompt_minLength : '<?= __('{name} must be at least {ruleValue} characters') ?>',
form_prompt_length : '<?= __('{name} must be at least {ruleValue} characters') ?>',
form_prompt_exactLength : '<?= __('{name} must be exactly {ruleValue} characters') ?>',
form_prompt_maxLength : '<?= __('{name} cannot be longer than {ruleValue} characters') ?>',
form_prompt_match : '<?= __('{name} must match {ruleValue} field') ?>',
form_prompt_different : '<?= __('{name} must have a different value than {ruleValue} field') ?>',
form_prompt_creditCard : '<?= __('{name} must be a valid credit card number') ?>',
form_prompt_minCount : '<?= __('{name} must have at least {ruleValue} choices') ?>',
form_prompt_exactCount : '<?= __('{name} must have exactly {ruleValue} choices') ?>',
form_prompt_maxCount : '<?= __('{name} must have {ruleValue} or less choices') ?>',
}; };
</script> </script>
<?php <?php