From 65f74da45b9fe9881105a0c6ccd031a982d1e20b Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 19 Dec 2020 22:41:42 -0500 Subject: [PATCH] Add translation to required labels on input fields - Normalize display of required label - Remove unused field_richtext template --- doc/smarty3-templates.md | 8 ++++---- src/Module/Admin/Blocklist/Server.php | 8 ++++---- src/Module/Admin/Item/Delete.php | 2 +- src/Module/Debug/Probe.php | 2 +- src/Module/Register.php | 2 +- src/Module/Security/TwoFactor/Verify.php | 2 +- src/Module/Settings/TwoFactor/Index.php | 2 +- src/Module/Settings/TwoFactor/Verify.php | 2 +- view/global.css | 4 ++++ view/templates/field/range_percent.tpl | 4 ++-- view/templates/field_input.tpl | 4 ++-- view/templates/field_password.tpl | 8 ++++---- view/templates/field_richtext.tpl | 9 --------- view/templates/field_textarea.tpl | 4 ++-- view/theme/frio/templates/field_colorinput.tpl | 5 ++--- view/theme/frio/templates/field_fileinput.tpl | 5 ++--- view/theme/frio/templates/field_input.tpl | 4 ++-- view/theme/frio/templates/field_password.tpl | 4 ++-- view/theme/frio/templates/field_textarea.tpl | 4 ++-- 19 files changed, 38 insertions(+), 45 deletions(-) delete mode 100644 view/templates/field_richtext.tpl diff --git a/doc/smarty3-templates.md b/doc/smarty3-templates.md index b39fa117e7..f3f7c3e608 100644 --- a/doc/smarty3-templates.md +++ b/doc/smarty3-templates.md @@ -87,7 +87,7 @@ Field parameter: 1. Label for the input box, 2. Current value of the variable, 3. Help text for the input box, -4. if set to "required" modern browser will check that this input box is filled when submitting the form, +4. Should be set to the translation of "Required" to mark this field as required, 5. if set to "autofocus" modern browser will put the cursur into this box once the page is loaded, 6. if set, it will be used for the input type, default is `text` (possible types: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#%3Cinput%3E_types). @@ -122,7 +122,7 @@ Field parameter: 1. Label for the field, 2. Value for the field, e.g. the old password, 3. Help text for the input field, -4. if set to "required" modern browser will check that this field is filled out, +4. Should be set to the translation of "Required" to mark this field as required, 5. if set to "autofocus" modern browser will put the cursor automatically into this input field. ### field_radio.tpl @@ -176,5 +176,5 @@ Field parameter: 0. Name of the input field, 1. Label for the input box, 2. Current text for the box, -3. Help text for the input box. -4. if set to "required" modern browser will check that this input box is filled when submitting the form, +3. Help text for the input box, +4. Should be set to the translation of "Required" to mark this field as required. diff --git a/src/Module/Admin/Blocklist/Server.php b/src/Module/Admin/Blocklist/Server.php index 3eefc6cbec..f1c55f4124 100644 --- a/src/Module/Admin/Blocklist/Server.php +++ b/src/Module/Admin/Blocklist/Server.php @@ -76,8 +76,8 @@ class Server extends BaseAdmin if (is_array($blocklist)) { foreach ($blocklist as $id => $b) { $blocklistform[] = [ - 'domain' => ["domain[$id]", DI::l10n()->t('Blocked server domain pattern'), $b['domain'], '', 'required', '', ''], - 'reason' => ["reason[$id]", DI::l10n()->t("Reason for the block"), $b['reason'], '', 'required', '', ''], + 'domain' => ["domain[$id]", DI::l10n()->t('Blocked server domain pattern'), $b['domain'], '', DI::l10n()->t('Required'), '', ''], + 'reason' => ["reason[$id]", DI::l10n()->t("Reason for the block"), $b['reason'], '', DI::l10n()->t('Required'), '', ''], 'delete' => ["delete[$id]", DI::l10n()->t("Delete server domain pattern") . ' (' . $b['domain'] . ')', false, DI::l10n()->t("Check to delete this entry from the blocklist")] ]; } @@ -96,8 +96,8 @@ class Server extends BaseAdmin
  • [<char1><char2>...]: char1 or char2
  • '), '$addtitle' => DI::l10n()->t('Add new entry to block list'), - '$newdomain' => ['newentry_domain', DI::l10n()->t('Server Domain Pattern'), '', DI::l10n()->t('The domain pattern of the new server to add to the block list. Do not include the protocol.'), 'required', '', ''], - '$newreason' => ['newentry_reason', DI::l10n()->t('Block reason'), '', DI::l10n()->t('The reason why you blocked this server domain pattern.'), 'required', '', ''], + '$newdomain' => ['newentry_domain', DI::l10n()->t('Server Domain Pattern'), '', DI::l10n()->t('The domain pattern of the new server to add to the block list. Do not include the protocol.'), DI::l10n()->t('Required'), '', ''], + '$newreason' => ['newentry_reason', DI::l10n()->t('Block reason'), '', DI::l10n()->t('The reason why you blocked this server domain pattern.'), DI::l10n()->t('Required'), '', ''], '$submit' => DI::l10n()->t('Add Entry'), '$savechanges' => DI::l10n()->t('Save changes to the blocklist'), '$currenttitle' => DI::l10n()->t('Current Entries in the Blocklist'), diff --git a/src/Module/Admin/Item/Delete.php b/src/Module/Admin/Item/Delete.php index e755d9eedc..1ee91f4250 100644 --- a/src/Module/Admin/Item/Delete.php +++ b/src/Module/Admin/Item/Delete.php @@ -67,7 +67,7 @@ class Delete extends BaseAdmin '$submit' => DI::l10n()->t('Delete this Item'), '$intro1' => DI::l10n()->t('On this page you can delete an item from your node. If the item is a top level posting, the entire thread will be deleted.'), '$intro2' => DI::l10n()->t('You need to know the GUID of the item. You can find it e.g. by looking at the display URL. The last part of http://example.com/display/123456 is the GUID, here 123456.'), - '$deleteitemguid' => ['deleteitemguid', DI::l10n()->t("GUID"), '', DI::l10n()->t("The GUID of the item you want to delete."), 'required', 'autofocus'], + '$deleteitemguid' => ['deleteitemguid', DI::l10n()->t("GUID"), '', DI::l10n()->t("The GUID of the item you want to delete."), DI::l10n()->t('Required'), 'autofocus'], '$form_security_token' => self::getFormSecurityToken("admin_deleteitem") ]); } diff --git a/src/Module/Debug/Probe.php b/src/Module/Debug/Probe.php index 48838cc8bb..8090f2b082 100644 --- a/src/Module/Debug/Probe.php +++ b/src/Module/Debug/Probe.php @@ -54,7 +54,7 @@ class Probe extends BaseModule DI::l10n()->t('Lookup address'), $addr, '', - 'required' + DI::l10n()->t('Required') ], '$res' => $res, ]); diff --git a/src/Module/Register.php b/src/Module/Register.php index 683d53a8b0..3e50de8972 100644 --- a/src/Module/Register.php +++ b/src/Module/Register.php @@ -132,7 +132,7 @@ class Register extends BaseModule $o = Renderer::replaceMacros($tpl, [ '$invitations' => DI::config()->get('system', 'invitation_only'), '$permonly' => intval(DI::config()->get('config', 'register_policy')) === self::APPROVE, - '$permonlybox' => ['permonlybox', DI::l10n()->t('Note for the admin'), '', DI::l10n()->t('Leave a message for the admin, why you want to join this node'), 'required'], + '$permonlybox' => ['permonlybox', DI::l10n()->t('Note for the admin'), '', DI::l10n()->t('Leave a message for the admin, why you want to join this node'), DI::l10n()->t('Required')], '$invite_desc' => DI::l10n()->t('Membership on this site is by invitation only.'), '$invite_label' => DI::l10n()->t('Your invitation code: '), '$invite_id' => $invite_id, diff --git a/src/Module/Security/TwoFactor/Verify.php b/src/Module/Security/TwoFactor/Verify.php index 7d42456be3..2e327fd9e9 100644 --- a/src/Module/Security/TwoFactor/Verify.php +++ b/src/Module/Security/TwoFactor/Verify.php @@ -82,7 +82,7 @@ class Verify extends BaseModule '$errors_label' => DI::l10n()->tt('Error', 'Errors', count(self::$errors)), '$errors' => self::$errors, '$recovery_message' => DI::l10n()->t('Don’t have your phone? Enter a two-factor recovery code', '2fa/recovery'), - '$verify_code' => ['verify_code', DI::l10n()->t('Please enter a code from your authentication app'), '', '', 'required', 'autofocus placeholder="000000"', 'tel'], + '$verify_code' => ['verify_code', DI::l10n()->t('Please enter a code from your authentication app'), '', '', DI::l10n()->t('Required'), 'autofocus placeholder="000000"', 'tel'], '$verify_label' => DI::l10n()->t('Verify code and complete login'), ]); } diff --git a/src/Module/Settings/TwoFactor/Index.php b/src/Module/Settings/TwoFactor/Index.php index 37d78c995a..8cc04787f5 100644 --- a/src/Module/Settings/TwoFactor/Index.php +++ b/src/Module/Settings/TwoFactor/Index.php @@ -125,7 +125,7 @@ class Index extends BaseSettings '$app_specific_passwords_message' => DI::l10n()->t('

    These randomly generated passwords allow you to authenticate on apps not supporting two-factor authentication.

    '), '$action_title' => DI::l10n()->t('Actions'), - '$password' => ['password', DI::l10n()->t('Current password:'), '', DI::l10n()->t('You need to provide your current password to change two-factor authentication settings.'), 'required', 'autofocus'], + '$password' => ['password', DI::l10n()->t('Current password:'), '', DI::l10n()->t('You need to provide your current password to change two-factor authentication settings.'), DI::l10n()->t('Required'), 'autofocus'], '$enable_label' => DI::l10n()->t('Enable two-factor authentication'), '$disable_label' => DI::l10n()->t('Disable two-factor authentication'), '$recovery_codes_label' => DI::l10n()->t('Show recovery codes'), diff --git a/src/Module/Settings/TwoFactor/Verify.php b/src/Module/Settings/TwoFactor/Verify.php index 27683f3fbb..f427fdfe42 100644 --- a/src/Module/Settings/TwoFactor/Verify.php +++ b/src/Module/Settings/TwoFactor/Verify.php @@ -138,7 +138,7 @@ class Verify extends BaseSettings '$holder' => $holder, '$secret' => $secret, - '$verify_code' => ['verify_code', DI::l10n()->t('Please enter a code from your authentication app'), '', '', 'required', 'autofocus placeholder="000000"'], + '$verify_code' => ['verify_code', DI::l10n()->t('Please enter a code from your authentication app'), '', '', DI::l10n()->t('Required'), 'autofocus placeholder="000000"'], '$verify_label' => DI::l10n()->t('Verify code and enable two-factor authentication'), ]); } diff --git a/view/global.css b/view/global.css index 874b1d6e98..3fa82906a3 100644 --- a/view/global.css +++ b/view/global.css @@ -652,3 +652,7 @@ body.dragging, body.dragging * { border-left-color: black; border-right: none; } + +span.required { + color: #c80000; +} diff --git a/view/templates/field/range_percent.tpl b/view/templates/field/range_percent.tpl index 0336b616d3..90732b3636 100644 --- a/view/templates/field/range_percent.tpl +++ b/view/templates/field/range_percent.tpl @@ -1,6 +1,6 @@
    {{if !isset($label) || $label != false }} - + {{/if}}
    @@ -8,7 +8,7 @@
    - + %
    diff --git a/view/templates/field_input.tpl b/view/templates/field_input.tpl index 5561440c3d..ec2de2a4ab 100644 --- a/view/templates/field_input.tpl +++ b/view/templates/field_input.tpl @@ -1,7 +1,7 @@
    - - + + {{if $field.3}} {{$field.3 nofilter}} {{/if}} diff --git a/view/templates/field_password.tpl b/view/templates/field_password.tpl index 26522fbc78..6295880621 100644 --- a/view/templates/field_password.tpl +++ b/view/templates/field_password.tpl @@ -1,8 +1,8 @@ -
    - - +
    + + {{if $field.3}} - {{$field.3 nofilter}} + {{$field.3 nofilter}} {{/if}}
    diff --git a/view/templates/field_richtext.tpl b/view/templates/field_richtext.tpl deleted file mode 100644 index 1e1fa15b65..0000000000 --- a/view/templates/field_richtext.tpl +++ /dev/null @@ -1,9 +0,0 @@ - - -
    - - - {{if $field.3}} - {{$field.3 nofilter}} - {{/if}} -
    diff --git a/view/templates/field_textarea.tpl b/view/templates/field_textarea.tpl index 17b07266a9..5f93ca9111 100644 --- a/view/templates/field_textarea.tpl +++ b/view/templates/field_textarea.tpl @@ -1,7 +1,7 @@
    - - + + {{if $field.3}} {{$field.3 nofilter}} {{/if}} diff --git a/view/theme/frio/templates/field_colorinput.tpl b/view/theme/frio/templates/field_colorinput.tpl index c4affb7eeb..2c530a2e46 100644 --- a/view/theme/frio/templates/field_colorinput.tpl +++ b/view/theme/frio/templates/field_colorinput.tpl @@ -1,10 +1,9 @@
    - +
    - - {{if $field.4}}{{$field.4}}{{/if}} +
    {{if $field.3}} {{$field.3 nofilter}} diff --git a/view/theme/frio/templates/field_fileinput.tpl b/view/theme/frio/templates/field_fileinput.tpl index 143aa19e0f..dd6825f2ee 100644 --- a/view/theme/frio/templates/field_fileinput.tpl +++ b/view/theme/frio/templates/field_fileinput.tpl @@ -1,9 +1,8 @@
    - +
    - - {{if $field.4}}{{$field.4}}{{/if}} +
    {{if $field.3}} diff --git a/view/theme/frio/templates/field_input.tpl b/view/theme/frio/templates/field_input.tpl index 6c6e52c454..3a9e54d06a 100644 --- a/view/theme/frio/templates/field_input.tpl +++ b/view/theme/frio/templates/field_input.tpl @@ -1,9 +1,9 @@
    {{if !isset($label) || $label != false }} - + {{/if}} - + {{if $field.3}} {{$field.3 nofilter}} {{/if}} diff --git a/view/theme/frio/templates/field_password.tpl b/view/theme/frio/templates/field_password.tpl index 92c98a44c1..df29b2fda2 100644 --- a/view/theme/frio/templates/field_password.tpl +++ b/view/theme/frio/templates/field_password.tpl @@ -1,7 +1,7 @@
    - - + + {{if $field.3}} {{$field.3 nofilter}} {{/if}} diff --git a/view/theme/frio/templates/field_textarea.tpl b/view/theme/frio/templates/field_textarea.tpl index a20d8f4ce7..72bcc232a1 100644 --- a/view/theme/frio/templates/field_textarea.tpl +++ b/view/theme/frio/templates/field_textarea.tpl @@ -1,8 +1,8 @@
    {{if $field.1}} - + {{/if}} - + {{if $field.3}} {{$field.3 nofilter}} {{/if}}