]> git.mxchange.org Git - friendica.git/commitdiff
Add translation to required labels on input fields
authorHypolite Petovan <hypolite@mrpetovan.com>
Sun, 20 Dec 2020 03:41:42 +0000 (22:41 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Sun, 20 Dec 2020 03:52:45 +0000 (22:52 -0500)
- Normalize display of required label
- Remove unused field_richtext template

19 files changed:
doc/smarty3-templates.md
src/Module/Admin/Blocklist/Server.php
src/Module/Admin/Item/Delete.php
src/Module/Debug/Probe.php
src/Module/Register.php
src/Module/Security/TwoFactor/Verify.php
src/Module/Settings/TwoFactor/Index.php
src/Module/Settings/TwoFactor/Verify.php
view/global.css
view/templates/field/range_percent.tpl
view/templates/field_input.tpl
view/templates/field_password.tpl
view/templates/field_richtext.tpl [deleted file]
view/templates/field_textarea.tpl
view/theme/frio/templates/field_colorinput.tpl
view/theme/frio/templates/field_fileinput.tpl
view/theme/frio/templates/field_input.tpl
view/theme/frio/templates/field_password.tpl
view/theme/frio/templates/field_textarea.tpl

index b39fa117e7f1a715b62d39d31975b530f00c37e9..f3f7c3e608777d68cdba19883338f08c6fe200c7 100644 (file)
@@ -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.
index 3eefc6cbec5f4831a3bb7e1dd4d1b59aba846d52..f1c55f4124c60a9313a0d18aaa0310dbecd64dee 100644 (file)
@@ -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
        <li><code>[&lt;char1&gt;&lt;char2&gt;...]</code>: char1 or char2</li>
 </ul>'),
                        '$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'),
index e755d9eedce803c86c9c8cfcbb4cc9636cc8baf0..1ee91f4250216662f31d7b197fd66b01b9c508b0 100644 (file)
@@ -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")
                ]);
        }
index 48838cc8bbf5202278d048a4201e61380d5c04cc..8090f2b082ea276406a7bf51dc48ffe48e2109e3 100644 (file)
@@ -54,7 +54,7 @@ class Probe extends BaseModule
                                DI::l10n()->t('Lookup address'),
                                $addr,
                                '',
-                               'required'
+                               DI::l10n()->t('Required')
                        ],
                        '$res'  => $res,
                ]);
index 683d53a8b0f00b41c844d898d3d8db30aef36f7a..3e50de8972f732d617fc5c9e7526c0367403911e 100644 (file)
@@ -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,
index 7d42456be3b7ce577162af010d8d9c2193e71a04..2e327fd9e98d118538662e8ae5f2b0ea60456f0a 100644 (file)
@@ -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? <a href="%s">Enter a two-factor recovery code</a>', '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'),
                ]);
        }
index 37d78c995aab68af4a0b1fbefb9d92cf7c0075ab..8cc04787f5efae4345bb85475bbb455403466702 100644 (file)
@@ -125,7 +125,7 @@ class Index extends BaseSettings
                        '$app_specific_passwords_message'   => DI::l10n()->t('<p>These randomly generated passwords allow you to authenticate on apps not supporting two-factor authentication.</p>'),
 
                        '$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'),
index 27683f3fbbaa50453e89dbb8af58398f836e959c..f427fdfe4289b061dfd97316bf39f02c5b3e0666 100644 (file)
@@ -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'),
                ]);
        }
index 874b1d6e98a6bfa1a953509336aa01a317f8e79f..3fa82906a3089d28063d8dde5b469bcd47a38f7e 100644 (file)
@@ -652,3 +652,7 @@ body.dragging, body.dragging * {
        border-left-color: black;
        border-right: none;
 }
+
+span.required {
+       color: #c80000;
+}
index 0336b616d39aab13986963f665766d5210015a07..90732b36364ce9ed5d1c6f288fbe9929b4e2b80c 100644 (file)
@@ -1,6 +1,6 @@
 <div id="id_{{$field.0}}_wrapper" class="form-group field range">
 {{if !isset($label) || $label != false }}
-       <label for="{{$field.0}}_range" id="label_{{$field.0}}">{{$field.1 nofilter}}{{if $field.4}}<span class="required"> {{$field.4}}</span>{{/if}}</label>
+       <label for="{{$field.0}}_range" id="label_{{$field.0}}">{{$field.1}}{{if $field.4}} <span class="required" title="{{$field.4}}">*</span>{{/if}}</label>
 {{/if}}
        <div class="row">
                <div class="col-xs-9">
@@ -8,7 +8,7 @@
                </div>
                <div class="col-xs-3">
                        <div class="input-group">
-                               <input type="text" class="form-control input-sm" name="{{$field.0}}" id="{{$field.0}}" value="{{$field.2}}" onchange="{{$field.0}}_range.value = this.value" oninput="{{$field.0}}_range.value = this.value" aria-describedby="{{$field.0}}_tip">
+                               <input type="text" class="form-control input-sm" name="{{$field.0}}" id="{{$field.0}}" value="{{$field.2}}"{{if $field.4}} required{{/if}} onchange="{{$field.0}}_range.value = this.value" oninput="{{$field.0}}_range.value = this.value" aria-describedby="{{$field.0}}_tip">
                                <span class="input-group-addon image-select">%</span>
                        </div>
                </div>
index 5561440c3d189c7d5ed960daedcbce26b6e3cb24..ec2de2a4ab0f95eee979fd9a7e58df9a18d6cbe2 100644 (file)
@@ -1,7 +1,7 @@
        
        <div class="field input" id="wrapper_{{$field.0}}">
-               <label for="id_{{$field.0}}">{{$field.1}}</label>
-               <input{{if $field.6}} type="{{$field.6}}"{{else}} type="text"{{/if}} name="{{$field.0}}" id="id_{{$field.0}}" value="{{$field.2}}"{{if $field.4 eq 'required'}} required{{/if}}{{if $field.5 eq "autofocus"}} autofocus{{elseif $field.5}} {{$field.5 nofilter}}{{/if}} aria-describedby="{{$field.0}}_tip">
+               <label for="id_{{$field.0}}">{{$field.1}}{{if $field.4}} <span class="required" title="{{$field.4}}">*</span>{{/if}}</label>
+               <input type="{{$field.6|default:'text'}}" name="{{$field.0}}" id="id_{{$field.0}}" value="{{$field.2}}"{{if $field.4}} required{{/if}}{{if $field.5 eq "autofocus"}} autofocus{{elseif $field.5}} {{$field.5 nofilter}}{{/if}} aria-describedby="{{$field.0}}_tip">
        {{if $field.3}}
                <span class="field_help" role="tooltip" id="{{$field.0}}_tip">{{$field.3 nofilter}}</span>
        {{/if}}
index 26522fbc783180adce58558abe158d84aa301d76..6295880621f3c747f48422ea5b90bcb792341a00 100644 (file)
@@ -1,8 +1,8 @@
        
-       <div class='field password' id='wrapper_{{$field.0}}'>
-               <label for='id_{{$field.0}}'>{{$field.1}}</label>
-               <input type='password' name='{{$field.0}}' id='id_{{$field.0}}' value="{{$field.2 nofilter}}"{{if $field.4 eq 'required'}} required{{/if}}{{if $field.5 eq 'autofocus'}} autofocus{{/if}} aria-describedby='{{$field.0}}_tip'>
+       <div class="field password" id="wrapper_{{$field.0}}">
+               <label for="id_{{$field.0}}">{{$field.1}}{{if $field.4}} <span class="required" title="{{$field.4}}">*</span>{{/if}}</label>
+               <input type="password" name="{{$field.0}}" id="id_{{$field.0}}" value="{{$field.2 nofilter}}"{{if $field.4}} required{{/if}}{{if $field.5 eq "autofocus"}} autofocus{{/if}} aria-describedby="{{$field.0}}_tip">
                {{if $field.3}}
-               <span class='field_help' role='tooltip' id='{{$field.0}}_tip'>{{$field.3 nofilter}}</span>
+               <span class="field_help" role="tooltip" id="{{$field.0}}_tip">{{$field.3 nofilter}}</span>
                {{/if}}
        </div>
diff --git a/view/templates/field_richtext.tpl b/view/templates/field_richtext.tpl
deleted file mode 100644 (file)
index 1e1fa15..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-
-       
-       <div class='field richtext'>
-               <label for='id_{{$field.0}}'>{{$field.1}}</label>
-               <textarea name='{{$field.0}}' id='id_{{$field.0}}' class="fieldRichtext" aria-describedby='{{$field.0}}_tip'>{{$field.2 nofilter}}</textarea>
-               {{if $field.3}}
-               <span class="field_help" role="tooltip" id="{{$field.0}}_tip">{{$field.3 nofilter}}</span>
-               {{/if}}
-       </div>
index 17b07266a9c22c85a85714d489cdac7813ce0107..5f93ca91117afb542983742e4c8cc02d45153116 100644 (file)
@@ -1,7 +1,7 @@
 
        <div class="field textarea">
-               <label for="id_{{$field.0}}">{{$field.1}}</label>
-               <textarea name="{{$field.0}}" id="id_{{$field.0}}" aria-describedby="{{$field.0}}_tip"{{if $field.4 eq 'required'}} required{{/if}}>{{$field.2}}</textarea>
+               <label for="id_{{$field.0}}">{{$field.1}}{{if $field.4}} <span class="required" title="{{$field.4}}">*</span>{{/if}}</label>
+               <textarea name="{{$field.0}}" id="id_{{$field.0}}"{{if $field.4}} required{{/if}} aria-describedby="{{$field.0}}_tip">{{$field.2}}</textarea>
        {{if $field.3}}
                <span class="field_help" role="tooltip" id="{{$field.0}}_tip">{{$field.3 nofilter}}</span>
        {{/if}}
index c4affb7eeb4328c787cc2706b4d981335e113695..2c530a2e4616879a949dc846c20c0b95a335d8fb 100644 (file)
@@ -1,10 +1,9 @@
 
 <div class="form-group field input color">
-       <label for="id_{{$field.0}}" id="label_{{$field.0}}">{{$field.1}}</label>
+       <label for="id_{{$field.0}}" id="label_{{$field.0}}">{{$field.1}}{{if $field.4}} <span class="required" title="{{$field.4}}">*</span>{{/if}}</label>
        <div class="input-group" id="{{$field.0}}">
                <span class="input-group-addon"><i></i></span>
-               <input class="form-control color" name="{{$field.0}}" id="id_{{$field.0}}" type="text" value="{{$field.2 nofilter}}" aria-describedby="{{$field.0}}_tip">
-               {{if $field.4}}<span class="required">{{$field.4}}</span>{{/if}}
+               <input class="form-control color" name="{{$field.0}}" id="id_{{$field.0}}" type="text" value="{{$field.2 nofilter}}"{{if $field.4}} required{{/if}} aria-describedby="{{$field.0}}_tip">
        </div>
        {{if $field.3}}
        <span class="help-block" id="{{$field.0}}_tip" role="tooltip">{{$field.3 nofilter}}</span>
index 143aa19e0fd3706416a2e3d90c62a7add7387ad0..dd6825f2ee1917898eaa366f4b89a3054ff7825d 100644 (file)
@@ -1,9 +1,8 @@
 
 <div class="form-group field input file">
-       <label for="id_{{$field.0}}" id="label_{{$field.0}}">{{$field.1}}</label>
+       <label for="id_{{$field.0}}" id="label_{{$field.0}}">{{$field.1}}{{if $field.4}} <span class="required" title="{{$field.4}}">*</span>{{/if}}</label>
        <div class="input-group" id="{{$field.0}}">
-               <input class="form-control file" name="{{$field.0}}" id="id_{{$field.0}}" type="text" value="{{$field.2 nofilter}}" aria-describedby="{{$field.0}}_tip">
-               {{if $field.4}}<span class="required">{{$field.4}}</span>{{/if}}
+               <input class="form-control file" name="{{$field.0}}" id="id_{{$field.0}}" type="text" value="{{$field.2 nofilter}}"{{if $field.4}} required{{/if}} aria-describedby="{{$field.0}}_tip">
                <span class="input-group-addon image-select"><i class="fa fa-picture-o"></i></span>
        </div>
        {{if $field.3}}
index 6c6e52c454a7f5ccc25dc72f302dabb8271d3c3c..3a9e54d06a67edaa70f591bbccd675f36c267046 100644 (file)
@@ -1,9 +1,9 @@
 
        <div id="id_{{$field.0}}_wrapper" class="form-group field input">
        {{if !isset($label) || $label != false }}
-               <label for="id_{{$field.0}}" id="label_{{$field.0}}">{{$field.1 nofilter}}{{if $field.4}}<span class="required"> {{$field.4}}</span>{{/if}}</label>
+               <label for="id_{{$field.0}}" id="label_{{$field.0}}">{{$field.1 nofilter}}{{if $field.4}} <span class="required" title="{{$field.4}}">*</span>{{/if}}</label>
        {{/if}}
-               <input class="form-control" name="{{$field.0}}" id="id_{{$field.0}}"{{if $field.6}} type="{{$field.6}}"{{else}} type="text"{{/if}} value="{{$field.2}}"{{if $field.4 eq "required"}} required{{/if}}{{if $field.5 eq "autofocus"}} autofocus{{elseif $field.5}} {{$field.5 nofilter}}{{/if}} aria-describedby="{{$field.0}}_tip">
+               <input class="form-control" name="{{$field.0}}" id="id_{{$field.0}}" type="{{$field.6|default:'text'}}" value="{{$field.2}}"{{if $field.4}} required{{/if}}{{if $field.5 eq "autofocus"}} autofocus{{elseif $field.5}} {{$field.5 nofilter}}{{/if}} aria-describedby="{{$field.0}}_tip">
        {{if $field.3}}
                <span class="help-block" id="{{$field.0}}_tip" role="tooltip">{{$field.3 nofilter}}</span>
        {{/if}}
index 92c98a44c1e9a8cfc2aba805d39f92f1455e92cd..df29b2fda264bf62d2ed94949d00ca09373b1fa7 100644 (file)
@@ -1,7 +1,7 @@
 
 <div id="id_{{$field.0}}_wrapper" class="form-group field input password">
-       <label for="id_{{$field.0}}" id="label_{{$field.0}}">{{$field.1}}{{if $field.4}}<span class="required"> {{$field.4}}</span>{{/if}}</label>
-       <input class="form-control" name="{{$field.0}}" id="id_{{$field.0}}" type="password" value="{{$field.2 nofilter}}" {{if $field.4 eq "required"}} required{{/if}}{{if $field.5 eq "autofocus"}} autofocus{{elseif $field.5}} {{$field.5}}{{/if}} aria-describedby="{{$field.0}}_tip">
+       <label for="id_{{$field.0}}" id="label_{{$field.0}}">{{$field.1}}{{if $field.4}} <span class="required" title="{{$field.4}}">*</span>{{/if}}</label>
+       <input class="form-control" name="{{$field.0}}" id="id_{{$field.0}}" type="password" value="{{$field.2 nofilter}}" {{if $field.4}} required{{/if}}{{if $field.5 eq "autofocus"}} autofocus{{elseif $field.5}} {{$field.5}}{{/if}} aria-describedby="{{$field.0}}_tip">
        {{if $field.3}}
        <span class="help-block" id="{{$field.0}}_tip" role="tooltip">{{$field.3 nofilter}}</span>
        {{/if}}
index a20d8f4ce73dbef7f40573269167332aee6b1dcf..72bcc232a1dc7ae0fa7751d2aec4490ca38f0f38 100644 (file)
@@ -1,8 +1,8 @@
        <div class="form-group field textarea">
        {{if $field.1}}
-               <label for="id_{{$field.0}}">{{$field.1}}</label>
+               <label for="id_{{$field.0}}">{{$field.1}}{{if $field.4}} <span class="required" title="{{$field.4}}">*</span>{{/if}}</label>
        {{/if}}
-               <textarea class="form-control text-autosize" name="{{$field.0}}" id="id_{{$field.0}}" {{if $field.4}}{{$field.4 nofilter}}{{/if}} aria-describedby="{{$field.0}}_tip">{{$field.2}}</textarea>
+               <textarea class="form-control text-autosize" name="{{$field.0}}" id="id_{{$field.0}}"{{if $field.4}} required{{/if}} aria-describedby="{{$field.0}}_tip">{{$field.2}}</textarea>
        {{if $field.3}}
                <span class="help-block" id="{{$field.0}}_tip" role="tooltip">{{$field.3 nofilter}}</span>
        {{/if}}