From 65f74da45b9fe9881105a0c6ccd031a982d1e20b Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 19 Dec 2020 22:41:42 -0500 Subject: [PATCH 1/4] 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 b39fa117e..f3f7c3e60 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 3eefc6cbe..f1c55f412 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 e755d9eed..1ee91f425 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 48838cc8b..8090f2b08 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 683d53a8b..3e50de897 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 7d42456be..2e327fd9e 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 37d78c995..8cc04787f 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 27683f3fb..f427fdfe4 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 874b1d6e9..3fa82906a 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 0336b616d..90732b363 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 5561440c3..ec2de2a4a 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 26522fbc7..629588062 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 1e1fa15b6..000000000 --- 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 17b07266a..5f93ca911 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 c4affb7ee..2c530a2e4 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 143aa19e0..dd6825f2e 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 6c6e52c45..3a9e54d06 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 92c98a44c..df29b2fda 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 a20d8f4ce..72bcc232a 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}} From a991f3dfcf32af476d10a69f7e13f72fefebc525 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 19 Dec 2020 22:47:07 -0500 Subject: [PATCH 2/4] Add translation to required labels for install checks - Remove unused checks loop in install_base template --- src/Module/Install.php | 33 ++++++++++++++++++----------- view/templates/install_base.tpl | 9 -------- view/templates/install_checks.tpl | 10 ++++----- view/templates/install_db.tpl | 7 ++++-- view/templates/install_finished.tpl | 2 +- 5 files changed, 32 insertions(+), 29 deletions(-) diff --git a/src/Module/Install.php b/src/Module/Install.php index 1448d5544..3ad38041e 100644 --- a/src/Module/Install.php +++ b/src/Module/Install.php @@ -186,6 +186,10 @@ class Install extends BaseModule $output .= Renderer::replaceMacros($tpl, [ '$title' => $install_title, '$pass' => DI::l10n()->t('System check'), + '$required' => DI::l10n()->t('Required'), + '$requirement_not_satisfied' => DI::l10n()->t('Requirement not satisfied'), + '$optional_requirement_not_satisfied' => DI::l10n()->t('Optional requirement not satisfied'), + '$ok' => DI::l10n()->t('OK'), '$checks' => self::$installer->getChecks(), '$passed' => $status, '$see_install' => DI::l10n()->t('Please see the file "doc/INSTALL.md".'), @@ -215,12 +219,12 @@ class Install extends BaseModule DI::l10n()->t('Host name'), $configCache->get('config', 'hostname'), DI::l10n()->t('Overwrite this field in case the determinated hostname isn\'t right, otherweise leave it as is.'), - 'required'], + DI::l10n()->t('Required')], '$basepath' => ['system-basepath', DI::l10n()->t("Base path to installation"), $configCache->get('system', 'basepath'), DI::l10n()->t("If the system cannot detect the correct path to your installation, enter the correct path here. This setting should only be set if you are using a restricted system and symbolic links to your webroot."), - 'required'], + DI::l10n()->t('Required')], '$urlpath' => ['system-urlpath', DI::l10n()->t('Sub path of the URL'), $configCache->get('system', 'urlpath'), @@ -239,7 +243,9 @@ class Install extends BaseModule '$info_01' => DI::l10n()->t('In order to install Friendica we need to know how to connect to your database.'), '$info_02' => DI::l10n()->t('Please contact your hosting provider or site administrator if you have questions about these settings.'), '$info_03' => DI::l10n()->t('The database you specify below should already exist. If it does not, please create it before continuing.'), - 'checks' => self::$installer->getChecks(), + '$required' => DI::l10n()->t('Required'), + '$requirement_not_satisfied' => DI::l10n()->t('Requirement not satisfied'), + '$checks' => self::$installer->getChecks(), '$hostname' => $configCache->get('config', 'hostname'), '$ssl_policy' => $configCache->get('system', 'ssl_policy'), '$basepath' => $configCache->get('system', 'basepath'), @@ -248,23 +254,23 @@ class Install extends BaseModule DI::l10n()->t('Database Server Name'), $configCache->get('database', 'hostname'), '', - 'required'], + DI::l10n()->t('Required')], '$dbuser' => ['database-username', DI::l10n()->t('Database Login Name'), $configCache->get('database', 'username'), '', - 'required', + DI::l10n()->t('Required'), 'autofocus'], '$dbpass' => ['database-password', DI::l10n()->t('Database Login Password'), $configCache->get('database', 'password'), DI::l10n()->t("For security reasons the password must not be empty"), - 'required'], + DI::l10n()->t('Required')], '$dbdata' => ['database-database', DI::l10n()->t('Database Name'), $configCache->get('database', 'database'), '', - 'required'], + DI::l10n()->t('Required')], '$lbl_10' => DI::l10n()->t('Please select a default timezone for your website'), '$php_path' => $configCache->get('config', 'php_path'), '$submit' => DI::l10n()->t('Submit') @@ -278,6 +284,7 @@ class Install extends BaseModule $tpl = Renderer::getMarkupTemplate('install_settings.tpl'); $output .= Renderer::replaceMacros($tpl, [ '$title' => $install_title, + '$required' => DI::l10n()->t('Required'), '$checks' => self::$installer->getChecks(), '$pass' => DI::l10n()->t('Site settings'), '$hostname' => $configCache->get('config', 'hostname'), @@ -292,7 +299,7 @@ class Install extends BaseModule DI::l10n()->t('Site administrator email address'), $configCache->get('config', 'admin_email'), DI::l10n()->t('Your account email address must match this in order to use the web admin panel.'), - 'required', 'autofocus', 'email'], + DI::l10n()->t('Required'), 'autofocus', 'email'], '$timezone' => Temporal::getTimezoneField('system-default_timezone', DI::l10n()->t('Please select a default timezone for your website'), $configCache->get('system', 'default_timezone'), @@ -318,10 +325,12 @@ class Install extends BaseModule $tpl = Renderer::getMarkupTemplate('install_finished.tpl'); $output .= Renderer::replaceMacros($tpl, [ - '$title' => $install_title, - '$checks' => self::$installer->getChecks(), - '$pass' => DI::l10n()->t('Installation finished'), - '$text' => $db_return_text . self::whatNext(), + '$title' => $install_title, + '$required' => DI::l10n()->t('Required'), + '$requirement_not_satisfied' => DI::l10n()->t('Requirement not satisfied'), + '$checks' => self::$installer->getChecks(), + '$pass' => DI::l10n()->t('Installation finished'), + '$text' => $db_return_text . self::whatNext(), ]); break; diff --git a/view/templates/install_base.tpl b/view/templates/install_base.tpl index 712488fb7..4907c2585 100644 --- a/view/templates/install_base.tpl +++ b/view/templates/install_base.tpl @@ -7,15 +7,6 @@ {{$info_03}}

    - - {{foreach $checks as $check}} -
    {{$check.title}} - {{if ! $check.status}} - Requirement not satisfied - {{/if}} - {{/foreach}} -
    -
    diff --git a/view/templates/install_checks.tpl b/view/templates/install_checks.tpl index 49ca67059..4574faf06 100644 --- a/view/templates/install_checks.tpl +++ b/view/templates/install_checks.tpl @@ -6,20 +6,20 @@ {{foreach $checks as $check}} {{$check.title nofilter}} {{if $check.status}} - Ok + {{$ok}} {{else}} {{if $check.required}} - Requirement not satisfied + {{$requirement_not_satisfied}} {{else}} - Optional requirement not satisfied + {{$optional_requirement_not_satisfied}} {{/if}} {{/if}} - {{if $check.required}}(required){{/if}} + {{if $check.required}}{{$required}}{{/if}} {{if $check.help}}
    {{$check.help nofilter}}
    {{if $check.error_msg}} -
    {{$check.error_msg.head}}
    {{$check.error_msg.url}}
    +
    {{$check.error_msg.head}}
    {{$check.error_msg.url}}
    {{$check.error_msg.msg}}
    {{/if}} diff --git a/view/templates/install_db.tpl b/view/templates/install_db.tpl index 1a5778cc8..f589223c7 100644 --- a/view/templates/install_db.tpl +++ b/view/templates/install_db.tpl @@ -9,10 +9,13 @@ {{foreach $checks as $check}} - + + {{/foreach}}
    {{$check.title}} +
    {{$check.title}} {{if ! $check.status}} - Requirement not satisfied + {{$requirement_not_satisfied}} {{/if}} +
    diff --git a/view/templates/install_finished.tpl b/view/templates/install_finished.tpl index 8e643b7a1..1d5d391c4 100644 --- a/view/templates/install_finished.tpl +++ b/view/templates/install_finished.tpl @@ -2,7 +2,7 @@

    {{$pass}}

    {{foreach $checks as $check}} -Requirement not satisfied +{{$requirement_not_satisfied}} {{$check.title nofilter}} {{/foreach}} From fbd0cefdf740cf2688cb1df9f041d3996ce157c9 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 19 Dec 2020 22:52:03 -0500 Subject: [PATCH 3/4] Add translation to Yourself option in view as select in profile - Address https://github.com/friendica/friendica/issues/9682 --- src/Module/Profile/Profile.php | 3 ++- view/templates/profile/{index.tpl => profile.tpl} | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) rename view/templates/profile/{index.tpl => profile.tpl} (99%) diff --git a/src/Module/Profile/Profile.php b/src/Module/Profile/Profile.php index b1e0673b2..6b7da3d71 100644 --- a/src/Module/Profile/Profile.php +++ b/src/Module/Profile/Profile.php @@ -231,9 +231,10 @@ class Profile extends BaseProfile ); } - $tpl = Renderer::getMarkupTemplate('profile/index.tpl'); + $tpl = Renderer::getMarkupTemplate('profile/profile.tpl'); $o .= Renderer::replaceMacros($tpl, [ '$title' => DI::l10n()->t('Profile'), + '$yourself' => DI::l10n()->t('Yourself'), '$view_as_contacts' => $view_as_contacts, '$view_as_contact_id' => $view_as_contact_id, '$view_as_contact_alert' => $view_as_contact_alert, diff --git a/view/templates/profile/index.tpl b/view/templates/profile/profile.tpl similarity index 99% rename from view/templates/profile/index.tpl rename to view/templates/profile/profile.tpl index 36b64ffbb..c2cb3ead4 100644 --- a/view/templates/profile/index.tpl +++ b/view/templates/profile/profile.tpl @@ -102,7 +102,7 @@