Make translatable

This commit is contained in:
Jay Trees 2022-03-22 10:58:02 +01:00
parent ee974c2b61
commit 3856a80747
13 changed files with 159 additions and 198 deletions

View file

@ -8,7 +8,7 @@
use wishthis\Page; use wishthis\Page;
$page = new Page(__FILE__, 'Home'); $page = new Page(__FILE__, __('Home'));
$page->header(); $page->header();
$page->bodyStart(); $page->bodyStart();
$page->navigation(); $page->navigation();
@ -48,7 +48,9 @@ $page->navigation();
<div class="ui segment"> <div class="ui segment">
<h2 class="ui header"><?= __('Why wishthis?') ?></h2> <h2 class="ui header"><?= __('Why wishthis?') ?></h2>
<p><?= sprintf(__('wishthis is free and open source software. With free I don\'t just mean, you don\'t have to pay money to use it, but you are also not paying with your personal information and behaviour. Not only can anybody %sview and verify its code%s, I also encourage you to do so.'), '<a href="https://github.com/grandeljay/wishthis" title="wishthis source code" target="_blank">', '</a>') ?></p> <p><?= sprintf(
__('wishthis is free and open source software. With free I don\'t just mean, you don\'t have to pay money to use it, but you are also not paying with your personal information and behaviour. Not only can anybody %sview and verify its code%s, I also encourage you to do so.'), '<a href="https://github.com/grandeljay/wishthis" title="wishthis source code" target="_blank">', '</a>'
) ?></p>
<p><?= __('As a non-commercial project it remains') ?></p> <p><?= __('As a non-commercial project it remains') ?></p>
<div class="ui list"> <div class="ui list">

View file

@ -13,7 +13,7 @@ if ($options && $options->getOption('isInstalled')) {
die(); die();
} }
$page = new Page(__FILE__, 'Install'); $page = new Page(__FILE__, __('Install'));
$page->header(); $page->header();
$page->bodyStart(); $page->bodyStart();
@ -27,36 +27,36 @@ switch ($step) {
<div class="ui hidden divider"></div> <div class="ui hidden divider"></div>
<div class="ui container"> <div class="ui container">
<div class="ui segment"> <div class="ui segment">
<h1 class="ui header">Install</h1> <h1 class="ui header"><?= $page->title ?></h1>
<h2 class="ui header">Step <?= $step ?></h2> <h2 class="ui header"><?= sprintf(__('Step %d'), $step) ?></h2>
<p>Welcome to the wishthis installer.</p> <p><?= __('Welcome to the wishthis installer.') ?></p>
<p>wishthis needs a database to function properly. Please enter your credentials.</p> <p><?= __('wishthis needs a database to function properly. Please enter your credentials.') ?></p>
<form class="ui form" action="/?page=install" method="post"> <form class="ui form" action="/?page=install" method="post">
<input type="hidden" name="install" value="true" /> <input type="hidden" name="install" value="true" />
<input type="hidden" name="step" value="<?= $step + 1; ?>" /> <input type="hidden" name="step" value="<?= $step + 1; ?>" />
<div class="field"> <div class="field">
<label>Host</label> <label><?= __('Host') ?></label>
<input type="text" name="DATABASE_HOST" placeholder="localhost" value="localhost" /> <input type="text" name="DATABASE_HOST" placeholder="localhost" value="localhost" />
</div> </div>
<div class="field"> <div class="field">
<label>Name</label> <label><?= __('Name') ?></label>
<input type="text" name="DATABASE_NAME" placeholder="wishthis" value="wishthis" /> <input type="text" name="DATABASE_NAME" placeholder="wishthis" value="wishthis" />
</div> </div>
<div class="field"> <div class="field">
<label>Username</label> <label><?= __('Username') ?></label>
<input type="text" name="DATABASE_USER" placeholder="root" value="root" /> <input type="text" name="DATABASE_USER" placeholder="root" value="root" />
</div> </div>
<div class="field"> <div class="field">
<label>Password</label> <label><?= __('Password') ?></label>
<input type="text" name="DATABASE_PASSWORD" /> <input type="text" name="DATABASE_PASSWORD" />
</div> </div>
<input class="ui primary button" type="submit" value="Continue" /> <input class="ui primary button" type="submit" value="<?= __('Continue') ?>" />
</form> </form>
</div> </div>
</div> </div>
@ -94,15 +94,15 @@ switch ($step) {
<div class="ui hidden divider"></div> <div class="ui hidden divider"></div>
<div class="ui container"> <div class="ui container">
<div class="ui segment"> <div class="ui segment">
<h1 class="ui header">Install</h1> <h1 class="ui header"><?= $page->title ?></h1>
<h2 class="ui header">Step <?= $step ?></h2> <h2 class="ui header"><?= sprintf(__('Step %d'), $step) ?></h2>
<p>Click Continue to test the database connection.</p> <p><?= __('Click Continue to test the database connection.') ?></p>
<form class="ui form" action="?page=install" method="post"> <form class="ui form" action="?page=install" method="post">
<input type="hidden" name="install" value="true" /> <input type="hidden" name="install" value="true" />
<input type="hidden" name="step" value="<?= $step + 1; ?>" /> <input type="hidden" name="step" value="<?= $step + 1; ?>" />
<input class="ui primary button" type="submit" value="Continue" /> <input class="ui primary button" type="submit" value="<?= __('Continue') ?>" />
</form> </form>
</div> </div>
</div> </div>
@ -198,8 +198,8 @@ switch ($step) {
<div class="ui hidden divider"></div> <div class="ui hidden divider"></div>
<div class="ui container"> <div class="ui container">
<div class="ui segment"> <div class="ui segment">
<h1 class="ui header">Success</h1> <h1 class="ui header"><?= __('Success') ?></h1>
<p><a class="ui primary button" href="/?page=register">Register</a></p> <p><a class="ui primary button" href="/?page=register"><?= __('Register') ?></a></p>
</div> </div>
</div> </div>
</main> </main>

View file

@ -8,7 +8,7 @@
use wishthis\Page; use wishthis\Page;
$page = new Page(__FILE__, 'Login as', 100); $page = new Page(__FILE__, __('Login as'), 100);
if (isset($_POST['email'])) { if (isset($_POST['email'])) {
$email = $_POST['email']; $email = $_POST['email'];
@ -35,9 +35,9 @@ $page->navigation();
<?php <?php
if (isset($success)) { if (isset($success)) {
if ($success) { if ($success) {
echo Page::success('Successfully logged in as ' . $_SESSION['user']['email'] . '.', 'Success'); echo Page::success(sprintf(__('Successfully logged in as %s.'), $_SESSION['user']['email']), __('Success'));
} else { } else {
echo Page::error('User not found!', 'Error'); echo Page::error(__('User not found!'), __('Error'));
} }
} }
?> ?>
@ -45,11 +45,11 @@ $page->navigation();
<div class="ui segment"> <div class="ui segment">
<form class="ui form" method="post"> <form class="ui form" method="post">
<div class="field"> <div class="field">
<label>Email</label> <label><?= __('Email') ?></label>
<input type="email" name="email" placeholder="john.doe@domain.tld" /> <input type="email" name="email" placeholder="john.doe@domain.tld" />
</div> </div>
<input class="ui primary button" type="submit" value="Login" /> <input class="ui primary button" type="submit" value="<?= __('Login') ?>" />
</form> </form>
</div> </div>
</div> </div>

View file

@ -8,7 +8,7 @@
use wishthis\{Page, Email}; use wishthis\{Page, Email};
$page = new Page(__FILE__, 'Login'); $page = new Page(__FILE__, __('Login'));
/** /**
* Login * Login
@ -33,8 +33,8 @@ if (isset($_POST['login'], $_POST['email'], $_POST['password'])) {
$_SESSION['user'] = $user; $_SESSION['user'] = $user;
} else { } else {
$page->messages[] = Page::error( $page->messages[] = Page::error(
'I could not find a user with the credential combination you provided.', __('No user could be found with the credentials you provided.'),
'Invalid credentials' __('Invalid credentials'),
); );
} }
} }
@ -79,12 +79,12 @@ if (isset($_POST['reset'], $_POST['email'])) {
$mjml $mjml
); );
$emailReset = new Email($_POST['email'], 'Password reset link', $mjml); $emailReset = new Email($_POST['email'], __('Password reset link'), $mjml);
$emailReset->send(); $emailReset->send();
$page->messages[] = Page::info( $page->messages[] = Page::info(
'If I can find a match for this email address, a password reset link will be sent to it.', __('If a match can be found for this email address, a password reset link will be sent to it.'),
'Info' __('Info')
); );
} }
} }
@ -104,11 +104,11 @@ $page->navigation();
<div class="row"> <div class="row">
<div class="column"> <div class="column">
<h2 class="ui header">Credentials</h2> <h2 class="ui header"><?= __('Credentials') ?></h2>
<form class="ui form login" method="post"> <form class="ui form login" method="post">
<div class="field"> <div class="field">
<label>Email</label> <label><?= __('Email') ?></label>
<div class="ui left icon input"> <div class="ui left icon input">
<input type="email" name="email" placeholder="john.doe@domain.tld" /> <input type="email" name="email" placeholder="john.doe@domain.tld" />
@ -117,7 +117,7 @@ $page->navigation();
</div> </div>
<div class="field"> <div class="field">
<label>Password</label> <label><?= __('Password') ?></label>
<div class="ui left icon input"> <div class="ui left icon input">
<input type="password" name="password" /> <input type="password" name="password" />
@ -125,23 +125,16 @@ $page->navigation();
</div> </div>
</div> </div>
<input class="ui primary button" type="submit" name="login" value="Login" /> <input class="ui primary button" type="submit" name="login" value="<?= __('Login') ?>" />
<a class="ui tertiary button" href="/?page=register">Register</a> <a class="ui tertiary button" href="/?page=register"><?= __('Register') ?></a>
</form> </form>
</div> </div>
<div class="column"> <div class="column">
<h2 class="ui header">Forgot password?</h2> <h2 class="ui header"><?= __('Forgot password?') ?></h2>
<p> <p><?= __('Consider using a password manager. It will save all your passwords and allow you to access them with one master password. Never forget a password ever again.') ?></p>
Consider using a password manager. <p><?= sprintf('%sBitwarden%s is the most trusted open source password manager.', '<a href="https://bitwarden.com/" target="_blank">', '</a>') ?></p>
It will save all your passwords and allow you to access them with one master password.
Never forget a password ever again.
</p>
<p>
<a href="https://bitwarden.com/" target="_blank">Bitwarden</a>
is the most trusted open source password manager.
</p>
<?php if ($options->getOption('mjml_api_key') && $options->getOption('mjml_api_secret')) { ?> <?php if ($options->getOption('mjml_api_key') && $options->getOption('mjml_api_secret')) { ?>
<p> <p>
@ -156,7 +149,7 @@ $page->navigation();
<input class="ui primary button" <input class="ui primary button"
type="submit" type="submit"
name="reset" name="reset"
value="Send email" value="<?= __('Send email') ?>"
/> />
</div> </div>
@ -164,7 +157,7 @@ $page->navigation();
</form> </form>
</p> </p>
<p>Please note that you have to enter the email address, you have registered with.</p> <p><?= __('Please note that you have to enter the email address, you have registered with.') ?></p>
<?php } ?> <?php } ?>
</div> </div>
</div> </div>

View file

@ -8,7 +8,7 @@
use wishthis\Page; use wishthis\Page;
$page = new Page(__FILE__, 'Logout'); $page = new Page(__FILE__, __('Logout'));
if (PHP_SESSION_ACTIVE === session_status()) { if (PHP_SESSION_ACTIVE === session_status()) {
session_destroy(); session_destroy();
@ -26,8 +26,8 @@ $page->navigation();
<h1 class="ui header"><?= $page->title ?></h1> <h1 class="ui header"><?= $page->title ?></h1>
<div class="ui segment"> <div class="ui segment">
<h2 class="ui header">Goodbye</h2> <h2 class="ui header"><?= __('Goodbye') ?></h2>
<p>You have been logged out.</p> <p><?= __('You have been logged out.') ?></p>
</div> </div>
</div> </div>
</main> </main>

View file

@ -8,7 +8,7 @@
use wishthis\Page; use wishthis\Page;
$page = new Page(__FILE__, 'Insufficient power'); $page = new Page(__FILE__, __('Insufficient power'));
$page->header(); $page->header();
$page->bodyStart(); $page->bodyStart();
$page->navigation(); $page->navigation();
@ -19,14 +19,8 @@ $page->navigation();
<h1 class="ui header"><?= $page->title ?></h1> <h1 class="ui header"><?= $page->title ?></h1>
<div class="ui segment"> <div class="ui segment">
<h2 class="ui header">Restricted access</h2> <h2 class="ui header"><?= __('Restricted access') ?></h2>
<p> <p><?= sprintf(__('You do not have enough power to view this page. You need %s to see this page, but only have %s.'), '<strong>' . $_GET['required'] . '</strong>', '<strong>' . $user->power . '</strong>') ?></p>
You do not have enough power to view this page.
You need
<strong><?= $_GET['required'] ?></strong>
to see this page, but only have
<strong><?= $user->power ?></strong>.
</p>
</div> </div>
</div> </div>
</main> </main>

View file

@ -8,7 +8,7 @@
use wishthis\Page; use wishthis\Page;
$page = new Page(__FILE__, 'Profile'); $page = new Page(__FILE__, __('Profile'));
$page->header(); $page->header();
$page->bodyStart(); $page->bodyStart();
$page->navigation(); $page->navigation();
@ -21,39 +21,39 @@ $page->navigation();
<div class="ui segment"> <div class="ui segment">
<form class="ui form"> <form class="ui form">
<div class="field"> <div class="field">
<label>Email</label> <label><?= __('Email') ?></label>
<input type="email" name="user-email" value="<?= $user->email ?>" /> <input type="email" name="user-email" value="<?= $user->email ?>" />
</div> </div>
<div class="two fields"> <div class="two fields">
<div class="field"> <div class="field">
<label>Password</label> <label><?= __('Password') ?></label>
<input type="password" name="user-password" autocomplete="new-password" /> <input type="password" name="user-password" autocomplete="new-password" />
</div> </div>
<div class="field"> <div class="field">
<label>Password (repeat)</label> <label><?= __('Password (repeat)') ?></label>
<input type="password" name="user-password-repeat" autocomplete="new-password" /> <input type="password" name="user-password-repeat" autocomplete="new-password" />
</div> </div>
</div> </div>
<div class="field"> <div class="field">
<label>Birthdate</label> <label><?= __('Birthdate') ?></label>
<div class="ui calendar"> <div class="ui calendar">
<div class="ui input left icon"> <div class="ui input left icon">
<i class="calendar icon"></i> <i class="calendar icon"></i>
<input type="text" placeholder="Pick up a date" /> <input type="text" placeholder="<?= __('Pick a date') ?>" />
</div> </div>
</div> </div>
</div> </div>
<div class="ui error message"></div> <div class="ui error message"></div>
<input class="ui primary button" type="submit" value="Save" /> <input class="ui primary button" type="submit" value="<?= __('Save') ?>" />
</form> </form>
</div> </div>
</div> </div>

View file

@ -10,8 +10,8 @@ use wishthis\Page;
$passwordReset = isset($_GET['password-reset'], $_GET['token']); $passwordReset = isset($_GET['password-reset'], $_GET['token']);
$pageTitle = $passwordReset ? 'Reset password' : 'Register'; $pageTitle = $passwordReset ? __('Reset password') : __('Register');
$buttonSubmit = $passwordReset ? 'Reset' : 'Register'; $buttonSubmit = $passwordReset ? __('Reset') : __('Register');
$page = new Page(__FILE__, $pageTitle); $page = new Page(__FILE__, $pageTitle);
@ -48,9 +48,8 @@ if (isset($_POST['email'], $_POST['password']) && !empty($_POST['planet'])) {
if (in_array($planet, $not_planets)) { if (in_array($planet, $not_planets)) {
$page->messages[] = Page::warning( $page->messages[] = Page::warning(
'<strong>' . $planetName . '</strong> sprintf(__('%s is not a planet but I\'ll let it slide, since only a human would make this kind of mistake.'), '<strong>' . $planetName . '</strong>'),
is not a planetbut I\'ll let it slide, since only a human would make this kind of mistake.', __('Invalid planet')
'Invalid planet'
); );
} }
@ -81,10 +80,10 @@ if (isset($_POST['email'], $_POST['password']) && !empty($_POST['planet'])) {
'Success' 'Success'
); );
} else { } else {
$page->messages[] = Page::error('This link has expired.', 'Failure'); $page->messages[] = Page::error(__('This link has expired.'), __('Failure'));
} }
} else { } else {
$page->messages[] = Page::error('This link seems invalid.', 'Failure'); $page->messages[] = Page::error(__('This link seems invalid.'), __('Failure'));
} }
} else { } else {
/** /**
@ -106,8 +105,8 @@ if (isset($_POST['email'], $_POST['password']) && !empty($_POST['planet'])) {
} else { } else {
if (in_array($_POST['email'], $emails)) { if (in_array($_POST['email'], $emails)) {
$page->messages[] = Page::error( $page->messages[] = Page::error(
'An account with this email address already exists.', __('An account with this email address already exists.'),
'Invalid email address' __('Invalid email address')
); );
} else { } else {
$database->query('INSERT INTO `users` $database->query('INSERT INTO `users`
@ -121,7 +120,7 @@ if (isset($_POST['email'], $_POST['password']) && !empty($_POST['planet'])) {
;'); ;');
$userRegistered = true; $userRegistered = true;
$page->messages[] = Page::success('Your account was successfully created.', 'Success'); $page->messages[] = Page::success(__('Your account was successfully created.'), __('Success'));
} }
} }
} }
@ -131,7 +130,7 @@ if (isset($_POST['email'], $_POST['password']) && !empty($_POST['planet'])) {
*/ */
if ($userRegistered) { if ($userRegistered) {
$userID = $database->lastInsertID(); $userID = $database->lastInsertID();
$wishlistName = 'My hopes and dreams'; $wishlistName = __('My hopes and dreams');
$database $database
->query('INSERT INTO `wishlists` ->query('INSERT INTO `wishlists`
@ -148,12 +147,8 @@ if (isset($_POST['email'], $_POST['password']) && !empty($_POST['planet'])) {
} }
} else { } else {
$page->messages[] = Page::error( $page->messages[] = Page::error(
'<strong>' . $planetName . '</strong> sprintf(__('%s is not a planet in our solar system. Read this for more information: %s.'), '<strong>' . $planetName . '</strong>', '<a href="https://www.space.com/16080-solar-system-planets.html" target="_blank">Solar system planets: Order of the 8 (or 9) planets</a>'),
is not a planet in our solar system. Read this for more information: __('Invalid planet')
<a href="https://www.space.com/16080-solar-system-planets.html" target="_blank">
Solar system planets: Order of the 8 (or 9) planets
</a>.',
'Invalid planet'
); );
} }
} }
@ -174,10 +169,10 @@ $page->navigation();
<div class=" row"> <div class=" row">
<div class="column"> <div class="column">
<h2 class="ui header">Account details</h2> <h2 class="ui header"><?= __('Account details') ?></h2>
<div class="field"> <div class="field">
<label>Email</label> <label><?= __('Email') ?></label>
<div class="ui left icon input<?= isset($_GET['password-reset']) ? ' disabled' : '' ?>"> <div class="ui left icon input<?= isset($_GET['password-reset']) ? ' disabled' : '' ?>">
<?php if (isset($_GET['password-reset'])) { ?> <?php if (isset($_GET['password-reset'])) { ?>
@ -195,7 +190,7 @@ $page->navigation();
</div> </div>
<div class="field"> <div class="field">
<label>Password</label> <label><?= __('Password') ?></label>
<div class="ui left icon input"> <div class="ui left icon input">
<input type="password" name="password" /> <input type="password" name="password" />
@ -205,21 +200,18 @@ $page->navigation();
</div> </div>
<div class="column"> <div class="column">
<h2 class="ui header">Authentication</h2> <h2 class="ui header"><?= __('Authentication') ?></h2>
<p> <p><?= __('Prove you are a Human, Lizard-person or Zuck-like creature. Please name a planet from our solar system.') ?></p>
Prove you are a Human, Lizard-person or Zuck-like creature.
Please name a planet from our solar system.
</p>
<div class="field"> <div class="field">
<label>Planet</label> <label><?= __('Planet') ?></label>
<div class="ui left icon input"> <div class="ui left icon input">
<input type="text" name="planet" /> <input type="text" name="planet" />
<i class="globe icon"></i> <i class="globe icon"></i>
</div> </div>
</div> </div>
<p>Robots are obivously from another solar system so this will keep them at bay.</p> <p><?= __('Robots are obivously from another solar system so this will keep them at bay.') ?></p>
</div> </div>
</div> </div>
@ -228,7 +220,7 @@ $page->navigation();
<div class="ui error message"></div> <div class="ui error message"></div>
<input class="ui primary button" type="submit" value="<?= $buttonSubmit ?>" /> <input class="ui primary button" type="submit" value="<?= $buttonSubmit ?>" />
<a class="ui tertiary button" href="/?page=login">Login</a> <a class="ui tertiary button" href="/?page=login"><?= __('Login') ?></a>
</div> </div>
</div> </div>

View file

@ -8,7 +8,7 @@
use wishthis\Page; use wishthis\Page;
$page = new Page(__FILE__, 'Settings'); $page = new Page(__FILE__, __('Settings'));
$page->header(); $page->header();
$page->bodyStart(); $page->bodyStart();
$page->navigation(); $page->navigation();
@ -24,16 +24,13 @@ if (isset($_POST['mjml_api'], $_POST['api_key'], $_POST['api_secret'])) {
<h1 class="ui header"><?= $page->title ?></h1> <h1 class="ui header"><?= $page->title ?></h1>
<div class="ui segment"> <div class="ui segment">
<h2 class="ui header">MJML</h2> <h2 class="ui header"><?= __('MJML') ?></h2>
<p> <p><?= sprintf(__('MJML is required for sending emails. Visit %shttps://mjml.io/api%s to request API access.'), '<a href="https://mjml.io/api" target="_blank">', '</a>') ?></p>
MJML is required for sending emails.
Visit <a href="https://mjml.io/api" target="_blank">https://mjml.io/api</a> to request API access.
</p>
<h3 class="ui header">API</h3> <h3 class="ui header"><?= __('API') ?></h3>
<form class="ui form" method="POST"> <form class="ui form" method="POST">
<div class="field"> <div class="field">
<label>Key</label> <label><?= __('Key') ?></label>
<input type="text" <input type="text"
name="api_key" name="api_key"
placeholder="01234567-89ab-cdef-0123-456789abcdef" placeholder="01234567-89ab-cdef-0123-456789abcdef"
@ -42,7 +39,7 @@ if (isset($_POST['mjml_api'], $_POST['api_key'], $_POST['api_secret'])) {
</div> </div>
<div class="field"> <div class="field">
<label>Secret</label> <label><?= __('Secret') ?></label>
<input type="text" <input type="text"
name="api_secret" name="api_secret"
placeholder="01234567-89ab-cdef-0123-456789abcdef" placeholder="01234567-89ab-cdef-0123-456789abcdef"
@ -50,7 +47,7 @@ if (isset($_POST['mjml_api'], $_POST['api_key'], $_POST['api_secret'])) {
/> />
</div> </div>
<input class="ui primary button" type="submit" name="mjml_api" value="Save" /> <input class="ui primary button" type="submit" name="mjml_api" value="<?= __('Save') ?>" />
</form> </form>
</div> </div>
</div> </div>

View file

@ -8,7 +8,7 @@
use wishthis\{Page, User}; use wishthis\{Page, User};
$page = new Page(__FILE__, 'Update', 100); $page = new Page(__FILE__, __('Update'), 100);
$page->header(); $page->header();
$page->bodyStart(); $page->bodyStart();
$page->navigation(); $page->navigation();
@ -100,27 +100,27 @@ if ('POST' === $_SERVER['REQUEST_METHOD']) {
<h1 class="ui header"><?= $page->title ?></h1> <h1 class="ui header"><?= $page->title ?></h1>
<div class="ui segment"> <div class="ui segment">
<h2 class="ui header">New version detected</h2> <h2 class="ui header"><?= __('New version detected') ?></h2>
<p>An update is available. If you are brave, please click the button to start the self updater.</p> <p><?= __('An update is available. If you are brave, please click the button to start the self updater.') ?></p>
<div class="ui icon warning message"> <div class="ui icon warning message">
<i class="exclamation triangle icon"></i> <i class="exclamation triangle icon"></i>
<div class="content"> <div class="content">
<div class="header"> <div class="header">
Use at own risk <?= __('Use at own risk') ?>
</div> </div>
<p>Be sure to make backups before proceeding.</p> <p><?= __('Be sure to make backups before proceeding.') ?></p>
</div> </div>
</div> </div>
<form class="ui form" method="post"> <form class="ui form" method="post">
<button class="ui orange button" type="submit"> <button class="ui orange button" type="submit">
<i class="upload icon"></i> <i class="upload icon"></i>
Update to v<?= $version ?> <?= sprintf(__('Update to %s'), 'v' . $version) ?>
</button> </button>
</form> </form>
</div> </div>
<div class="ui segment"> <div class="ui segment">
<h2 class="ui header">Changes</h2> <h2 class="ui header"><?= __('Changes') ?></h2>
<?= str_replace(PHP_EOL, '<br>', $release['body']) ?> <?= str_replace(PHP_EOL, '<br>', $release['body']) ?>
</div> </div>

View file

@ -32,7 +32,7 @@ if ('POST' === $_SERVER['REQUEST_METHOD'] && count($_POST) >= 0) {
$wish = new Wish($_GET['id'], false); $wish = new Wish($_GET['id'], false);
$page = new Page(__FILE__, $wish->getTitle()); $page = new Page(__FILE__, $wish->getTitle());
$page->messages[] = Page::success('Wish successfully updated.', 'Success'); $page->messages[] = Page::success(__('Wish successfully updated.'), __('Success'));
} }
$wishlists = $user->getWishlists($wish->wishlist); $wishlists = $user->getWishlists($wish->wishlist);
@ -47,8 +47,8 @@ foreach ($wishlists as $wishlist) {
if (!$userIsAuthenticated) { if (!$userIsAuthenticated) {
http_response_code(404); http_response_code(404);
?> ?>
<h1>Not found</h1> <h1><?= __('Not found') ?></h1>
<p>The requested Wish was not found.</p> <p><?= __('The requested Wish was not found.') ?></p>
<?php <?php
die(); die();
} }
@ -82,14 +82,14 @@ $referer = '/?page=wishlists&wishlist=' . $wish->wishlist;
<a class="ui small labeled icon button" href="<?= $wish->url ?>" target="_blank"> <a class="ui small labeled icon button" href="<?= $wish->url ?>" target="_blank">
<i class="external icon"></i> <i class="external icon"></i>
Visit <?= __('Visit') ?>
</a> </a>
<button class="ui small labeled icon button auto-fill disabled" <button class="ui small labeled icon button auto-fill disabled"
type="button" type="button"
> >
<i class="redo icon"></i> <i class="redo icon"></i>
Auto-fill <?= __('Auto-fill') ?>
</button> </button>
</div> </div>
@ -107,7 +107,7 @@ $referer = '/?page=wishlists&wishlist=' . $wish->wishlist;
<div class="column"> <div class="column">
<div class="field"> <div class="field">
<label>Title</label> <label><?= __('Title') ?></label>
<div class="ui input"> <div class="ui input">
<input type="text" <input type="text"
@ -120,7 +120,7 @@ $referer = '/?page=wishlists&wishlist=' . $wish->wishlist;
</div> </div>
<div class="field"> <div class="field">
<label>Description</label> <label><?= __('Description') ?></label>
<textarea name="wish_description" <textarea name="wish_description"
placeholder="<?= $wish->description ?>" placeholder="<?= $wish->description ?>"
@ -132,7 +132,7 @@ $referer = '/?page=wishlists&wishlist=' . $wish->wishlist;
<div class="column"> <div class="column">
<div class="field"> <div class="field">
<label>URL</label> <label><?= __('URL') ?></label>
<input type="url" <input type="url"
name="wish_url" name="wish_url"
@ -143,7 +143,7 @@ $referer = '/?page=wishlists&wishlist=' . $wish->wishlist;
</div> </div>
<div class="field"> <div class="field">
<label>Priority</label> <label><?= __('Priority') ?></label>
<select class="ui selection clearable dropdown priority" <select class="ui selection clearable dropdown priority"
name="wish_priority" name="wish_priority"
@ -164,9 +164,9 @@ $referer = '/?page=wishlists&wishlist=' . $wish->wishlist;
<div class="stackable row"> <div class="stackable row">
<div class="sixteen wide column"> <div class="sixteen wide column">
<input class="ui small primary button" type="submit" value="Save" /> <input class="ui small primary button" type="submit" value="<?= __('Save') ?>" />
<input class="ui small button" type="reset" value="Reset" /> <input class="ui small button" type="reset" value="<?= __('Reset') ?>" />
<a class="ui small secondary button" href="<?= $referer ?>">Back</a> <a class="ui small secondary button" href="<?= $referer ?>"><?= __('Back') ?></a>
</div> </div>
</div> </div>
@ -181,24 +181,24 @@ $referer = '/?page=wishlists&wishlist=' . $wish->wishlist;
<!-- Preview --> <!-- Preview -->
<div class="ui small modal preview"> <div class="ui small modal preview">
<div class="header"> <div class="header">
Image <?= __('Image') ?>
</div> </div>
<div class="content"> <div class="content">
<p>Define a new URL to be used as a preview.</p> <p><?= __('Define a new URL to be used as a preview.') ?></p>
<div class="ui form preview"> <div class="ui form preview">
<div class="field"> <div class="field">
<label>URL</label> <label><?= __('URL') ?></label>
<input class="current" type="url" name="wish_image" /> <input class="current" type="url" name="wish_image" />
</div> </div>
</div> </div>
</div> </div>
<div class="actions"> <div class="actions">
<div class="ui primary approve button"> <div class="ui primary approve button">
Save <?= __('Save') ?>
</div> </div>
<div class="ui deny button"> <div class="ui deny button">
Discard <?= __('Discard') ?>
</div> </div>
</div> </div>
</div> </div>
@ -206,18 +206,18 @@ $referer = '/?page=wishlists&wishlist=' . $wish->wishlist;
<!-- Auto-fill --> <!-- Auto-fill -->
<div class="ui small modal auto-fill"> <div class="ui small modal auto-fill">
<div class="header"> <div class="header">
Warning <?= __('Warning') ?>
</div> </div>
<div class="content"> <div class="content">
<p>This action will potentially overwrite all fields in this wish.</p> <p><?= __('This action will potentially overwrite all fields in this wish.') ?></p>
<p>Would you like to continue?</p> <p><?= __('Would you like to continue?') ?></p>
</div> </div>
<div class="actions"> <div class="actions">
<div class="ui primary approve button"> <div class="ui primary approve button">
Yes, overwrite <?= __('Yes, overwrite') ?>
</div> </div>
<div class="ui deny button"> <div class="ui deny button">
No <?= __('No') ?>
</div> </div>
</div> </div>
</div> </div>
@ -225,25 +225,21 @@ $referer = '/?page=wishlists&wishlist=' . $wish->wishlist;
<!-- Validate --> <!-- Validate -->
<div class="ui small modal validate"> <div class="ui small modal validate">
<div class="header"> <div class="header">
URL mismatch <?= __('URL mismatch') ?>
</div> </div>
<div class="content"> <div class="content">
<div class="description"> <div class="description">
<p> <p><?= __('The URL you have entered does not seem quite right. Would you like to update it with the one I found?') ?></p>
The URL you have entered does not seem quite right. Would you like to update it with the one I found? <p class="provider"><?= sprintf(__('According to %s, this is the canonical (correct) URL.'), '<strong class="providerName">Unknown</strong>') ?></p>
</p>
<p class="provider">
According to <strong class="providerName">Unknown</strong>, this is the canonical (correct) URL.
</p>
<div class="ui form urls"> <div class="ui form urls">
<div class="field"> <div class="field">
<label>Current</label> <label><?= __('Current') ?></label>
<input class="current" type="url" readonly /> <input class="current" type="url" readonly />
</div> </div>
<div class="field"> <div class="field">
<label>Proposed</label> <label><?= __('Proposed') ?></label>
<input class="proposed" type="url" /> <input class="proposed" type="url" />
</div> </div>
</div> </div>
@ -251,10 +247,10 @@ $referer = '/?page=wishlists&wishlist=' . $wish->wishlist;
</div> </div>
<div class="actions"> <div class="actions">
<div class="ui primary approve button"> <div class="ui primary approve button">
Yes, update <?= __('Yes, update') ?>
</div> </div>
<div class="ui deny button"> <div class="ui deny button">
No, leave it <?= __('No, leave it') ?>
</div> </div>
</div> </div>
</div> </div>

View file

@ -13,8 +13,8 @@ $wishlist = new Wishlist($_GET['wishlist']);
if (!$wishlist->exists) { if (!$wishlist->exists) {
http_response_code(404); http_response_code(404);
?> ?>
<h1>Not found</h1> <h1><?= __('Not found') ?></h1>
<p>The requested Wishlist was not found and likely deleted by its creator.</p> <p><?= __('The requested Wishlist was not found and likely deleted by its creator.') ?></p>
<?php <?php
die(); die();
} }
@ -38,17 +38,11 @@ $page->navigation();
<i class="exclamation triangle icon"></i> <i class="exclamation triangle icon"></i>
<div class="content"> <div class="content">
<div class="header"> <div class="header">
Careful <?= __('Careful') ?>
</div> </div>
<div class="text"> <div class="text">
<p> <p><?= __('You are viewing your own wishlist! You will be able to see which wishes have already been bought for you. Don\'t you want to be surprised?') ?></p>
You are viewing your own wishlist! <p><?= __('It\'s probably best to just close this tab.') ?></p>
You will be able to see which wishes have already been bought for you.
Don't you want to be surprised?
</p>
<p>
It's probably best to just close this tab.
</p>
</div> </div>
</div> </div>
</div> </div>
@ -56,19 +50,15 @@ $page->navigation();
<div class="ui horizontal stackable segments"> <div class="ui horizontal stackable segments">
<div class="ui segment"> <div class="ui segment">
<h2 class="ui header">What to do?</h2> <h2 class="ui header"><?= __('What to do?') ?></h2>
<p> <p><?= sprintf(
If you found something you would like to buy, __('If you found something you would like to buy, click the %s button and it will become unavailable for others.'),
click the '<span class="ui primary tiny horizontal label"><i class="shopping cart icon"></i> ' . __('Commit') . '</span>'
<span class="ui primary tiny horizontal label"> ) ?></p>
<i class="shopping cart icon"></i> Commit
</span>
button and it will become unavailable for others.
</p>
</div> </div>
</div> </div>
<h2 class="ui header">Wishes</h2> <h2 class="ui header"><?= __('Wishes') ?></h2>
<div class="wishlist-cards"> <div class="wishlist-cards">
<?php <?php

View file

@ -8,7 +8,7 @@
use wishthis\{Page, User, Wishlist}; use wishthis\{Page, User, Wishlist};
$page = new Page(__FILE__, 'My lists'); $page = new Page(__FILE__, __('My lists'));
$page->header(); $page->header();
$page->bodyStart(); $page->bodyStart();
$page->navigation(); $page->navigation();
@ -16,47 +16,47 @@ $page->navigation();
<main> <main>
<div class="ui container"> <div class="ui container">
<h1 class="ui header"><?= $page->title ?></h1> <h1 class="ui header"><?= $page->title ?></h1>
<p>Here you can view and edit all of your wishlists.</p> <p><?= __('Here you can view and edit all of your wishlists.') ?></p>
<h2 class="ui header">View</h2> <h2 class="ui header"><?= __('View') ?></h2>
<div class="ui horizontal stackable segments"> <div class="ui horizontal stackable segments">
<div class="ui segment"> <div class="ui segment">
<p>Please select a wishlist to view.</p> <p><?= __('Please select a wishlist to view.') ?></p>
<div class="ui form"> <div class="ui form">
<div class="field"> <div class="field">
<label>Wishlist</label> <label><?= __('Wishlist') ?></label>
<select class="ui fluid search selection dropdown loading wishlists" name="wishlist"> <select class="ui fluid search selection dropdown loading wishlists" name="wishlist">
<option value="">Loading your wishlists...</option> <option value=""><?= __('Loading your wishlists...') ?></option>
</select> </select>
</div> </div>
<div class="flex buttons"> <div class="flex buttons">
<a class="ui small labeled icon primary button wishlist-wish-add disabled"> <a class="ui small labeled icon primary button wishlist-wish-add disabled">
<i class="add icon"></i> <i class="add icon"></i>
Add a wish <?= __('Add a wish') ?>
</a> </a>
<a class="ui small labeled icon button wishlist-share disabled" target="_blank"> <a class="ui small labeled icon button wishlist-share disabled" target="_blank">
<i class="share icon"></i> <i class="share icon"></i>
Share <?= __('Share') ?>
</a> </a>
<div class="ui small labeled icon top left pointing dropdown button options"> <div class="ui small labeled icon top left pointing dropdown button options">
<i class="cog icon"></i> <i class="cog icon"></i>
<span class="text">Options</span> <span class="text"><?= __('Options') ?></span>
<div class="menu"> <div class="menu">
<div class="item wishlist-rename disabled"> <div class="item wishlist-rename disabled">
<i class="pen icon"></i> <i class="pen icon"></i>
Rename <?= __('Rename') ?>
</div> </div>
<div class="item wishlist-delete disabled"> <div class="item wishlist-delete disabled">
<i class="trash icon"></i> <i class="trash icon"></i>
Delete <?= __('Delete') ?>
</div> </div>
</div> </div>
@ -67,19 +67,19 @@ $page->navigation();
</div> </div>
<div class="ui segment"> <div class="ui segment">
<p>General options.</p> <p><?= __('General options.') ?></p>
<div class="flex buttons"> <div class="flex buttons">
<a class="ui small labeled icon button wishlist-create"> <a class="ui small labeled icon button wishlist-create">
<i class="add icon"></i> <i class="add icon"></i>
Create a wishlist <?= __('Create a wishlist') ?>
</a> </a>
</div> </div>
</div> </div>
</div> </div>
<h2 class="ui header">Wishes</h2> <h2 class="ui header"><?= __('Wishes') ?></h2>
<div class="ui primary progress"> <div class="ui primary progress">
<div class="bar"> <div class="bar">
@ -101,18 +101,15 @@ $page->navigation();
<!-- Wishlist: Create --> <!-- Wishlist: Create -->
<div class="ui modal wishlist-create"> <div class="ui modal wishlist-create">
<div class="header"> <div class="header">
Create a wishlist <?= __('Create a wishlist') ?>
</div> </div>
<div class="content"> <div class="content">
<div class="description"> <div class="description">
<p> <p><?= __('Choose a new name for your wishlist. Here\'s a suggestion to get you started.') ?></p>
Choose a new name for your wishlist.
Here's a suggestion to get you started.
</p>
<form class="ui form"> <form class="ui form">
<div class="field"> <div class="field">
<label>Name</label> <label><?= __('Name') ?></label>
<input type="text" <input type="text"
name="wishlist-name" name="wishlist-name"
data-default="<?= getCurrentSeason() ?>" data-default="<?= getCurrentSeason() ?>"
@ -123,10 +120,10 @@ $page->navigation();
</div> </div>
<div class="actions"> <div class="actions">
<div class="ui approve primary button create"> <div class="ui approve primary button create">
Create <?= __('Create') ?>
</div> </div>
<div class="ui deny button cancel"> <div class="ui deny button cancel">
Cancel <?= __('Cancel') ?>
</div> </div>
</div> </div>
</div> </div>
@ -134,26 +131,26 @@ $page->navigation();
<!-- Wishlist: Rename --> <!-- Wishlist: Rename -->
<div class="ui tiny modal wishlist-rename"> <div class="ui tiny modal wishlist-rename">
<div class="header"> <div class="header">
Rename wishlist <?= __('Rename wishlist') ?>
</div> </div>
<div class="content"> <div class="content">
<p>How would you like to name this wishlist?</p> <p><?= __('How would you like to name this wishlist?') ?></p>
<form class="ui form wishlist-rename"> <form class="ui form wishlist-rename">
<input type="hidden" name="wishlist_id" /> <input type="hidden" name="wishlist_id" />
<div class="field"> <div class="field">
<label>Title</label> <label><?= __('Title') ?></label>
<input type="text" name="wishlist_title" maxlength="128" /> <input type="text" name="wishlist_title" maxlength="128" />
</div> </div>
</form> </form>
</div> </div>
<div class="actions"> <div class="actions">
<div class="ui approve primary button"> <div class="ui approve primary button">
Rename <?= __('Rename') ?>
</div> </div>
<div class="ui deny button"> <div class="ui deny button">
Cancel <?= __('Cancel') ?>
</div> </div>
</div> </div>
</div> </div>
@ -161,27 +158,27 @@ $page->navigation();
<!-- Wishlist: Add a wish --> <!-- Wishlist: Add a wish -->
<div class="ui modal wishlist-wish-add"> <div class="ui modal wishlist-wish-add">
<div class="header"> <div class="header">
Add a wish <?= __('Add a wish') ?>
</div> </div>
<div class="content"> <div class="content">
<div class="description"> <div class="description">
<p>Fill out any or all of the below fields to add your new wish.</p> <p><?= __('Fill out any or all of the below fields to add your new wish.') ?></p>
<form class="ui form wishlist-wish-add" method="post"> <form class="ui form wishlist-wish-add" method="post">
<input type="hidden" name="wishlist_id" /> <input type="hidden" name="wishlist_id" />
<div class="field"> <div class="field">
<label>Title</label> <label><?= __('Title') ?></label>
<input type="text" name="wish_title" maxlength="128" /> <input type="text" name="wish_title" maxlength="128" />
</div> </div>
<div class="field"> <div class="field">
<label>Description</label> <label><?= __('Description') ?></label>
<textarea name="wish_description"></textarea> <textarea name="wish_description"></textarea>
</div> </div>
<div class="field"> <div class="field">
<label>URL</label> <label><?= __('URL') ?></label>
<div class="ui input url"> <div class="ui input url">
<input type="url" name="wish_url" maxlength="255" /> <input type="url" name="wish_url" maxlength="255" />
@ -192,10 +189,10 @@ $page->navigation();
</div> </div>
<div class="actions"> <div class="actions">
<div class="ui primary approve button"> <div class="ui primary approve button">
Add <?= __('Add') ?>
</div> </div>
<div class="ui deny button"> <div class="ui deny button">
Cancel <?= __('Cancel') ?>
</div> </div>
</div> </div>
</div> </div>