Fix i18n on User Edit Page

This commit is contained in:
Johannes Rudolph 2022-12-23 03:20:10 +01:00 committed by GitHub
parent 0ae10471d1
commit 737066414e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 100 additions and 45 deletions

View File

@ -35,13 +35,11 @@ function admin_user()
throw_redirect(users_link()); throw_redirect(users_link());
} }
$html .= 'Hallo,<br />' $html .= __('Here you can change the user entry. Under the item \'Arrived\' the angel is marked as present, a yes at Active means that the angel was active.');
. 'hier kannst du den Eintrag &auml;ndern. Unter dem Punkt \'Gekommen\' ' if (config('enable_tshirt_size')) {
. 'wird der Engel als anwesend markiert, ein Ja bei Aktiv bedeutet, ' $html .= ' ' . __('If the angel is active, it can claim a T-shirt. If T-shirt is set to \'Yes\', the angel already got their T-shirt.');
. 'dass der Engel aktiv war und damit ein Anspruch auf ein T-Shirt hat. ' }
. 'Wenn T-Shirt ein \'Ja\' enth&auml;lt, bedeutet dies, dass der Engel ' $html .= '<br /><br />';
. 'bereits sein T-Shirt erhalten hat.<br /><br />' . "\n";
$html .= '<form action="' $html .= '<form action="'
. page_link_to('admin_user', ['action' => 'save', 'id' => $user_id]) . page_link_to('admin_user', ['action' => 'save', 'id' => $user_id])
. '" method="post">' . "\n"; . '" method="post">' . "\n";
@ -50,22 +48,23 @@ function admin_user()
$html .= '<input type="hidden" name="Type" value="Normal">' . "\n"; $html .= '<input type="hidden" name="Type" value="Normal">' . "\n";
$html .= '<tr><td>' . "\n"; $html .= '<tr><td>' . "\n";
$html .= '<table>' . "\n"; $html .= '<table>' . "\n";
$html .= ' <tr><td>Nick</td><td>' . '<input size="40" name="eNick" value="' . $user_source->name . '" class="form-control" maxlength="24"></td></tr>' . "\n"; $html .= ' <tr><td>' . __('Nickname') . '</td><td>' . '<input size="40" name="eNick" value="' . $user_source->name . '" class="form-control" maxlength="24"></td></tr>' . "\n";
$html .= ' <tr><td>Last login</td><td><p class="help-block">' $html .= ' <tr><td>' . __('Last login') . '</td><td><p class="help-block">'
. ($user_source->last_login_at ? $user_source->last_login_at->format('Y-m-d H:i') : '-') . ($user_source->last_login_at ? $user_source->last_login_at->format('Y-m-d H:i') : '-')
. '</p></td></tr>' . "\n"; . '</p></td></tr>' . "\n";
if (config('enable_user_name')) { if (config('enable_user_name')) {
$html .= ' <tr><td>Name</td><td>' . '<input size="40" name="eName" value="' . $user_source->personalData->last_name . '" class="form-control" maxlength="64"></td></tr>' . "\n"; $html .= ' <tr><td>' . __('Prename') . '</td><td>' . '<input size="40" name="eName" value="' . $user_source->personalData->last_name . '" class="form-control" maxlength="64"></td></tr>' . "\n";
$html .= ' <tr><td>Vorname</td><td>' . '<input size="40" name="eVorname" value="' . $user_source->personalData->first_name . '" class="form-control" maxlength="64"></td></tr>' . "\n"; $html .= ' <tr><td>' . __('Last name') . '</td><td>' . '<input size="40" name="eVorname" value="' . $user_source->personalData->first_name . '" class="form-control" maxlength="64"></td></tr>' . "\n";
} }
$html .= ' <tr><td>Handy</td><td>' . '<input type= "tel" size="40" name="eHandy" value="' . $user_source->contact->mobile . '" class="form-control" maxlength="40"></td></tr>' . "\n"; $html .= ' <tr><td>' . __('Mobile') . '</td><td>' . '<input type= "tel" size="40" name="eHandy" value="' . $user_source->contact->mobile . '" class="form-control" maxlength="40"></td></tr>' . "\n";
if (config('enable_dect')) { if (config('enable_dect')) {
$html .= ' <tr><td>DECT</td><td>' . '<input size="40" name="eDECT" value="' . $user_source->contact->dect . '" class="form-control" maxlength="40"></td></tr>' . "\n"; $html .= ' <tr><td>' . __('DECT') . '</td><td>' . '<input size="40" name="eDECT" value="' . $user_source->contact->dect . '" class="form-control" maxlength="40"></td></tr>' . "\n";
} }
if ($user_source->settings->email_human) { if ($user_source->settings->email_human) {
$html .= " <tr><td>email</td><td>" . '<input type="email" size="40" name="eemail" value="' . $user_source->email . '" class="form-control" maxlength="254"></td></tr>' . "\n"; $html .= " <tr><td>" . __('settings.profile.email') . "</td><td>" . '<input type="email" size="40" name="eemail" value="' . $user_source->email . '" class="form-control" maxlength="254"></td></tr>' . "\n";
} }
$html .= ' <tr><td>Size</td><td>' if (config('enable_tshirt_size')) {
$html .= ' <tr><td>' . __('user.shirt_size') . '</td><td>'
. html_select_key( . html_select_key(
'size', 'size',
'eSize', 'eSize',
@ -74,6 +73,7 @@ function admin_user()
__('Please select...') __('Please select...')
) )
. '</td></tr>' . "\n"; . '</td></tr>' . "\n";
}
$options = [ $options = [
'1' => __('Yes'), '1' => __('Yes'),
@ -81,7 +81,7 @@ function admin_user()
]; ];
// Gekommen? // Gekommen?
$html .= ' <tr><td>Gekommen</td><td>' . "\n"; $html .= ' <tr><td>' . __('Arrived') . '</td><td>' . "\n";
if ($user_source->state->arrived) { if ($user_source->state->arrived) {
$html .= __('Yes'); $html .= __('Yes');
} else { } else {
@ -90,7 +90,7 @@ function admin_user()
$html .= '</td></tr>' . "\n"; $html .= '</td></tr>' . "\n";
// Aktiv? // Aktiv?
$html .= ' <tr><td>Aktiv</td><td>' . "\n"; $html .= ' <tr><td>' . __('user.active') . '</td><td>' . "\n";
$html .= html_options('eAktiv', $options, $user_source->state->active) . '</td></tr>' . "\n"; $html .= html_options('eAktiv', $options, $user_source->state->active) . '</td></tr>' . "\n";
// Aktiv erzwingen // Aktiv erzwingen
@ -99,31 +99,32 @@ function admin_user()
$html .= html_options('force_active', $options, $user_source->state->force_active) . '</td></tr>' . "\n"; $html .= html_options('force_active', $options, $user_source->state->force_active) . '</td></tr>' . "\n";
} }
if (config('enable_tshirt_size')) {
// T-Shirt bekommen? // T-Shirt bekommen?
$html .= ' <tr><td>T-Shirt</td><td>' . "\n"; $html .= ' <tr><td>' . __('T-Shirt') . '</td><td>' . "\n";
$html .= html_options('eTshirt', $options, $user_source->state->got_shirt) . '</td></tr>' . "\n"; $html .= html_options('eTshirt', $options, $user_source->state->got_shirt) . '</td></tr>' . "\n";
}
$html .= '</table>' . "\n" . '</td><td></td></tr>'; $html .= '</table>' . "\n" . '</td><td></td></tr>';
$html .= '</td></tr>' . "\n"; $html .= '</td></tr>' . "\n";
$html .= '</table>' . "\n" . '<br />' . "\n"; $html .= '</table>' . "\n" . '<br />' . "\n";
$html .= '<input type="submit" value="Speichern" class="btn btn-primary">'; $html .= '<input type="submit" value="' . __('form.save') . '" class="btn btn-primary">';
$html .= '</form>'; $html .= '</form>';
$html .= '<hr />'; $html .= '<hr />';
$html .= form_info('', __('Please visit the angeltypes page or the users profile to manage users angeltypes.')); $html .= form_info('', __('Please visit the angeltypes page or the users profile to manage the users angeltypes.'));
$html .= 'Hier kannst Du das Passwort dieses Engels neu setzen:<form action="' $html .= ' ' . __('Here you can reset the password of this angel:') . '<form action="'
. page_link_to('admin_user', ['action' => 'change_pw', 'id' => $user_id]) . page_link_to('admin_user', ['action' => 'change_pw', 'id' => $user_id])
. '" method="post">' . "\n"; . '" method="post">' . "\n";
$html .= form_csrf(); $html .= form_csrf();
$html .= '<table>' . "\n"; $html .= '<table>' . "\n";
$html .= ' <tr><td>Passwort</td><td>' . '<input type="password" size="40" name="new_pw" value="" class="form-control" autocomplete="new-password"></td></tr>' . "\n"; $html .= ' <tr><td>' . __('Password') . '</td><td>' . '<input type="password" size="40" name="new_pw" value="" class="form-control" autocomplete="new-password"></td></tr>' . "\n";
$html .= ' <tr><td>Wiederholung</td><td>' . '<input type="password" size="40" name="new_pw2" value="" class="form-control" autocomplete="new-password"></td></tr>' . "\n"; $html .= ' <tr><td>' . __('Confirm password') . '</td><td>' . '<input type="password" size="40" name="new_pw2" value="" class="form-control" autocomplete="new-password"></td></tr>' . "\n";
$html .= '</table>' . "\n" . '<br />' . "\n"; $html .= '</table>' . "\n" . '<br />' . "\n";
$html .= '<input type="submit" value="Speichern" class="btn btn-primary">' . "\n"; $html .= '<input type="submit" value="' . __('form.save') . '" class="btn btn-primary">' . "\n";
$html .= '</form>'; $html .= '</form>';
$html .= '<hr />'; $html .= '<hr />';
@ -143,7 +144,7 @@ function admin_user()
($user_id != $user->id || auth()->can('admin_groups')) ($user_id != $user->id || auth()->can('admin_groups'))
&& ($my_highest_group >= $angel_highest_group || is_null($angel_highest_group)) && ($my_highest_group >= $angel_highest_group || is_null($angel_highest_group))
) { ) {
$html .= 'Hier kannst Du die Benutzergruppen des Engels festlegen:<form action="' $html .= __('Here you can define the user groups of the angel:') . '<form action="'
. page_link_to('admin_user', ['action' => 'save_groups', 'id' => $user_id]) . page_link_to('admin_user', ['action' => 'save_groups', 'id' => $user_id])
. '" method="post">' . "\n"; . '" method="post">' . "\n";
$html .= form_csrf(); $html .= form_csrf();
@ -159,7 +160,7 @@ function admin_user()
$html .= '</div><br>'; $html .= '</div><br>';
$html .= '<input type="submit" value="Speichern" class="btn btn-primary">' . "\n"; $html .= '<input type="submit" value="' . __('form.save') . '" class="btn btn-primary">' . "\n";
$html .= '</form>'; $html .= '</form>';
$html .= '<hr />'; $html .= '<hr />';
@ -213,12 +214,12 @@ function admin_user()
'Set groups of ' . User_Nick_render($angel, true) . ' to: ' 'Set groups of ' . User_Nick_render($angel, true) . ' to: '
. join(', ', $user_groups_info) . join(', ', $user_groups_info)
); );
$html .= success('Benutzergruppen gespeichert.', true); $html .= success(__('User groups saved.'), true);
} else { } else {
$html .= error('Du kannst keine Engel mit mehr Rechten bearbeiten.', true); $html .= error(__('You cannot edit angels with more rights.'), true);
} }
} else { } else {
$html .= error('Du kannst Deine eigenen Rechte nicht bearbeiten.', true); $html .= error(__('You cannot edit your own rights.'), true);
} }
break; break;
@ -236,18 +237,25 @@ function admin_user()
$user_source->name = $nickValidation->getValue(); $user_source->name = $nickValidation->getValue();
} }
$user_source->save(); $user_source->save();
if (config('enable_user_name')) { if (config('enable_user_name')) {
$user_source->personalData->first_name = $request->postData('eVorname'); $user_source->personalData->first_name = $request->postData('eVorname');
$user_source->personalData->last_name = $request->postData('eName'); $user_source->personalData->last_name = $request->postData('eName');
} }
if (config('enable_tshirt_size')) {
$user_source->personalData->shirt_size = $request->postData('eSize'); $user_source->personalData->shirt_size = $request->postData('eSize');
}
$user_source->personalData->save(); $user_source->personalData->save();
$user_source->contact->mobile = $request->postData('eHandy'); $user_source->contact->mobile = $request->postData('eHandy');
$user_source->contact->dect = $request->postData('eDECT'); $user_source->contact->dect = $request->postData('eDECT');
$user_source->contact->save(); $user_source->contact->save();
if (config('enable_tshirt_size')) {
$user_source->state->got_shirt = $request->postData('eTshirt');
}
$user_source->state->active = $request->postData('eAktiv'); $user_source->state->active = $request->postData('eAktiv');
$user_source->state->force_active = $force_active; $user_source->state->force_active = $force_active;
$user_source->state->got_shirt = $request->postData('eTshirt');
$user_source->state->save(); $user_source->state->save();
engelsystem_log( engelsystem_log(
@ -257,7 +265,7 @@ function admin_user()
. ', force-active: ' . $user_source->state->force_active . ', force-active: ' . $user_source->state->force_active
. ', tshirt: ' . $user_source->state->got_shirt . ', tshirt: ' . $user_source->state->got_shirt
); );
$html .= success('Änderung wurde gespeichert...' . "\n", true); $html .= success(__('Changes where saved.') . "\n", true);
break; break;
case 'change_pw': case 'change_pw':
@ -268,10 +276,10 @@ function admin_user()
$user_source = User::find($user_id); $user_source = User::find($user_id);
auth()->setPassword($user_source, $request->postData('new_pw')); auth()->setPassword($user_source, $request->postData('new_pw'));
engelsystem_log('Set new password for ' . User_Nick_render($user_source, true)); engelsystem_log('Set new password for ' . User_Nick_render($user_source, true));
$html .= success('Passwort neu gesetzt.', true); $html .= success(__('Password reset done.'), true);
} else { } else {
$html .= error( $html .= error(
'Die Eingaben müssen übereinstimmen und dürfen nicht leer sein!', __('The entries must match and must not be empty!'),
true true
); );
} }

View File

@ -2706,6 +2706,53 @@ msgstr ""
"Bitte eine DECT-Telefonnummer in den Einstellungen eingeben. Wenn du noch " "Bitte eine DECT-Telefonnummer in den Einstellungen eingeben. Wenn du noch "
"keine Nummer hast, bitte einfach \"-\" angeben." "keine Nummer hast, bitte einfach \"-\" angeben."
msgid ""
"Here you can change the user entry. Under the item 'Arrived' the angel is marked as present, "
"a yes at Active means that the angel was active."
msgstr ""
"Hier kannst du den Benutzer Eintrag ändern. Unter dem Punkt 'Angekommen' wird der Engel als anwesend markiert, "
"ein Ja bei Aktiv bedeutet, dass der Engel aktiv war."
msgid ""
"If the angel is active, it can claim a T-shirt. If T-shirt is set to 'Yes', the angel already got their T-shirt."
msgstr ""
"Ist der Engel Aktiv, hat er damit Anspruch auf ein T-Shirt. Wenn T-Shirt ein 'Ja' enthält, bedeutet dies, "
"dass der Engel bereits sein T-Shirt erhalten hat."
msgid ""
"If the angel was Active, this entitles him to a T-shirt. If T-shirt contains a 'Ja', "
"it means that the angel has already received his T-shirt."
msgstr ""
"War der Engel Aktiv, hat er damit Anspruch auf ein T-Shirt. Wenn T-Shirt ein 'Ja' enthält, "
"bedeutet dies, dass der Engel bereits sein T-Shirt erhalten hat."
msgid "Please visit the angeltypes page or the users profile to manage the users angeltypes."
msgstr "Bitte besuche die Seite Engeltypen oder das Benutzerprofil, um die Engeltypen des Benutzers zu verwalten."
msgid "Here you can reset the password of this angel:"
msgstr "Hier kannst du das Passwort für diesen Engel zurücksetzen:"
msgid "Here you can define the user groups of the angel:"
msgstr "Hier kannst du die Benutzergruppen des Engels definieren:"
msgid "User groups saved."
msgstr "Benutzergruppen gespeichert."
msgid "You cannot edit angels with more rights."
msgstr "Du kannst keine Engel mit mehr Rechten bearbeiten."
msgid "You cannot edit your own rights."
msgstr "Du kannst deine eigenen Rechte nicht bearbeiten."
msgid "Changes where saved."
msgstr "Änderung wurde gespeichert."
msgid "Password reset done."
msgstr "Passwort zurückgesetzt."
msgid "The entries must match and must not be empty!"
msgstr "Die Einträge müssen übereinstimmen und dürfen nicht leer sein!"
#: src/Middleware/LegacyMiddleware.php:83 #: src/Middleware/LegacyMiddleware.php:83
msgid "page.404.text" msgid "page.404.text"
msgstr "" msgstr ""