diff options
author | Jonas Kohl | 2024-09-16 11:31:53 +0200 |
---|---|---|
committer | Jonas Kohl | 2024-09-16 11:31:53 +0200 |
commit | 38f03c375eafdb6b95190729479c6fa0d721b400 (patch) | |
tree | 637616799ed5e20c72d8d7be7a78e72a11826cfa /src/application/views/view_user.php | |
parent | cb9b87997993702131ca24d4d0e1fd45ef64805c (diff) |
More i18n
Diffstat (limited to 'src/application/views/view_user.php')
-rw-r--r-- | src/application/views/view_user.php | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/src/application/views/view_user.php b/src/application/views/view_user.php index 79b57d2..536cc33 100644 --- a/src/application/views/view_user.php +++ b/src/application/views/view_user.php @@ -12,15 +12,11 @@ $canEdit = ($user->id === $GLOBALS["currentUser"]?->id && $user->hasPermission(U $isOwnProfile = $user->id === $GLOBALS["currentUser"]?->id; -$sIsOwn_your = ""; -if ($isOwnProfile) - $sIsOwn_your = " your"; - $sUserPossessive = ""; if ($isOwnProfile) - $sUserPossessive = "Your"; + $sUserPossessive = "Your posts"; else - $sUserPossessive = $user->displayName . "'s"; + $sUserPossessive = "%display_name%'s posts"; $dateJoined = DateTime::createFromImmutable($user->created); $dateJoined->setTime(0, 0, 0, 0); @@ -30,9 +26,11 @@ $dateJoined->setTime(0, 0, 0, 0); <img class="pull-left margin-right" src="?_action=profilepicture&user=<?= htmlentities(urlencode($user->id)) ?>"> <span class="h1"><?= htmlentities($user->displayName) ?></span> <?php if ($isOwnProfile): ?> - <span class="label label-primary">You</span> + <span class="label label-primary"><?= __("You") ?></span> <?php endif; ?><br> - @<?= htmlentities($user->name) ?> • <span class="text-muted">Member since <span class="_date"><?= htmlentities($dateJoined->format("c")); ?></span></span> + @<?= htmlentities($user->name) ?> • <span class="text-muted"><?= __("Member since %join_date%", [ + "join_date" => '<span class="_date">' . htmlentities($dateJoined->format("c")) . '</span>', + ]) ?></span> </div> <?php if ($canEdit): ?> @@ -40,7 +38,9 @@ $dateJoined->setTime(0, 0, 0, 0); <div class="col-md-9"> <?php endif; ?> -<h3><?= $sUserPossessive ?> posts</h3> +<h3><?= __($sUserPossessive, [ + "display_name" => $user->displayName, +]) ?></h3> <?php if (count($posts) > 0): ?> <div class="post-container"> @@ -49,19 +49,22 @@ $dateJoined->setTime(0, 0, 0, 0); <?php foreach ($posts as $post): if ($post->deleted) continue; ?> <a href="?_action=viewtopic&topic=<?= htmlentities(urlencode($post->topicId)) ?>#post-<?= htmlentities(urlencode($post->id)) ?>" class="list-group-item"> <?= htmlentities(StringUtils::truncate(strip_tags(renderPost($post->content)), 100)) ?><br> - <span class="text-muted">posted on <span class="_time"><?= htmlentities($post->postDate->format("c")) ?></span> in <em><?= htmlentities($topics[$post->topicId]?->title ?? "unknown") ?></em></span> + <span class="text-muted"><?= __("posted on %post_date% in %topic%", [ + "post_date" => '<span class="_time">' . htmlentities($post->postDate->format("c")) . '</span>', + "topic" => '<em>' . htmlentities($topics[$post->topicId]?->title ?? "unknown") . '</em>', + ]) ?></span> </a> <?php endforeach; ?> </div> </div> <div class="post-container-controls"> - <button class="btn btn-default">Show all posts</button> + <button class="btn btn-default"><?= __("Show all posts") ?></button> </div> </div> <?php else: ?> <div class="well icon-well text-info margin-top margin-bottom"> <span class="glyphicon glyphicon-info-sign color-info" aria-hidden="true"></span> - <em>This user has not posted anything yet</em> + <em><?= __("This user has not posted anything yet") ?></em> </div> <?php endif; ?> @@ -69,7 +72,7 @@ $dateJoined->setTime(0, 0, 0, 0); </div> <div class="col-md-3"> -<h3>Edit<?= $sIsOwn_your ?> profile</h3> +<h3><?= __("Edit profile") ?></h3> <?php if (($_formError = RequestUtils::getAndClearFormError()) !== null) { _view("alert_error", ["message" => $_formError]); @@ -77,24 +80,24 @@ if (($_formError = RequestUtils::getAndClearFormError()) !== null) { ?> <form action="<?= htmlentities($_SERVER["REQUEST_URI"]) ?>" method="post" enctype="multipart/form-data"> <div class="form-group"> - <label for="i_display_name">Display name:</label> + <label for="i_display_name"><?= __("Display name:") ?></label> <input required class="form-control" type="text" name="display_name" id="i_display_name" value="<?= htmlentities($user->displayName) ?>"> </div> <div class="form-group"> - <label for="i_name">Login name:</label> + <label for="i_name"><?= __("Username:") ?></label> <?php if ($lastNameChangeTooRecent): ?> <input required class="form-control" type="text" id="i_name" value="<?= htmlentities($user->name) ?>" disabled> - <small class="text-danger"><strong>You can only change your username every 30 days!</strong></small> + <small class="text-danger"><strong><?= __("You can only change your username every 30 days!") ?></strong></small> <?php else: ?> <input required class="form-control" type="text" name="name" id="i_name" value="<?= htmlentities($user->name) ?>"> <?php endif; ?> </div> <div class="form-group"> - <label for="i_email">Email address:</label> + <label for="i_email"><?= __("Email address:") ?></label> <input required class="form-control" type="email" id="i_email" value="<?= htmlentities($user->email) ?>" disabled> </div> <div class="form-group"> - <label>Profile picture:</label> + <label><?= __("Profile picture:") ?></label> <?php $_checkbox_disabled = empty($user->profilePicture); $_checkbox_disabled_class = $_checkbox_disabled ? " disabled text-muted" : ""; @@ -102,29 +105,29 @@ $_checkbox_disabled_class = $_checkbox_disabled ? " disabled text-muted" : ""; <div class="radio margin-top-0 <?= $_checkbox_disabled_class ?>"> <label> <input type="radio" name="pfp_action" id="pfp_action_1" value="keep"<?= !empty($user->profilePicture) ? ' checked' : ' disabled' ?>> - Keep current profile picture + <?= __("Keep current profile picture") ?> </label> </div> <div class="radio"> <label> <input type="radio" name="pfp_action" id="pfp_action_2" value="remove"<?= empty($user->profilePicture) ? ' checked' : '' ?>> <?php if (empty($user->profilePicture)): ?> - No profile picture + <?= __("No profile picture") ?> <?php else: ?> - Remove profile picture + <?= __("Remove profile picture") ?> <?php endif; ?> </label> </div> <div class="radio"> <label> <input type="radio" name="pfp_action" value="replace" id="pfp_action_3"> - Upload new profile picture + <?= __("Upload new profile picture") ?> </label> </div> <input type="file" name="pfp" id="i_pfp" accept="image/png,image/jpeg" class="margin-left-3x"> </div> <div class="form-group"> - <button type="submit" class="btn btn-success">Save changes</button> + <button type="submit" class="btn btn-success"><?= __("Save changes") ?></button> </div> </form> </div> |