Add translation system (#85)
This commit is contained in:
@@ -39,25 +39,30 @@
|
||||
$headerClass = count($subscriptions) > 0 ? "main-actions" : "main-actions hidden";
|
||||
$defaultLogo = $theme == "light" ? "images/wallos.png" : "images/walloswhite.png";
|
||||
?>
|
||||
<style>
|
||||
.logo-preview:after {
|
||||
content: '<?= translate('upload_logo', $i18n) ?>';
|
||||
}
|
||||
</style>
|
||||
<section class="contain">
|
||||
<header class="<?= $headerClass ?>" id="main-actions">
|
||||
<button class="button" onClick="addSubscription()">
|
||||
<img class="button-icon" src="images/siteicons/plusicon.png">
|
||||
New Subscription
|
||||
<?= translate('new_subscription', $i18n) ?>
|
||||
</button>
|
||||
<div class="sort-container">
|
||||
<button class="button" value="Sort" onClick="toggleSortOptions()" id="sort-button">
|
||||
<img src="images/siteicons/sort.png" class="button-icon" /> Sort
|
||||
<img src="images/siteicons/sort.png" class="button-icon" /> <?= translate('sort', $i18n) ?>
|
||||
</button>
|
||||
<div class="sort-options" id="sort-options">
|
||||
<ul>
|
||||
<li <?= $sort == "name" ? 'class="selected"' : "" ?> onClick="setSortOption('name')" id="sort-name">Name</li>
|
||||
<li <?= $sort == "id" ? 'class="selected"' : "" ?> onClick="setSortOption('id')" id="sort-id">Last Added</li>
|
||||
<li <?= $sort == "price" ? 'class="selected"' : "" ?> onClick="setSortOption('price')" id="sort-price">Price</li>
|
||||
<li <?= $sort == "next_payment" ? 'class="selected"' : "" ?> onClick="setSortOption('next_payment')" id="sort-next_payment">Next payment</li>
|
||||
<li <?= $sort == "payer_user_id" ? 'class="selected"' : "" ?> onClick="setSortOption('payer_user_id')" id="sort-payer_user_id">Member</li>
|
||||
<li <?= $sort == "category_id" ? 'class="selected"' : "" ?> onClick="setSortOption('category_id')" id="sort-category_id">Category</li>
|
||||
<li <?= $sort == "payment_method_id" ? 'class="selected"' : "" ?> onClick="setSortOption('payment_method_id')" id="sort-payment_method_id">Payment Method</li>
|
||||
<li <?= $sort == "name" ? 'class="selected"' : "" ?> onClick="setSortOption('name')" id="sort-name"><?= translate('name', $i18n) ?></li>
|
||||
<li <?= $sort == "id" ? 'class="selected"' : "" ?> onClick="setSortOption('id')" id="sort-id"><?= translate('last_added', $i18n) ?></li>
|
||||
<li <?= $sort == "price" ? 'class="selected"' : "" ?> onClick="setSortOption('price')" id="sort-price"><?= translate('price', $i18n) ?></li>
|
||||
<li <?= $sort == "next_payment" ? 'class="selected"' : "" ?> onClick="setSortOption('next_payment')" id="sort-next_payment"><?= translate('next_payment', $i18n) ?></li>
|
||||
<li <?= $sort == "payer_user_id" ? 'class="selected"' : "" ?> onClick="setSortOption('payer_user_id')" id="sort-payer_user_id"><?= translate('member', $i18n) ?></li>
|
||||
<li <?= $sort == "category_id" ? 'class="selected"' : "" ?> onClick="setSortOption('category_id')" id="sort-category_id"><?= translate('category', $i18n) ?></li>
|
||||
<li <?= $sort == "payment_method_id" ? 'class="selected"' : "" ?> onClick="setSortOption('payment_method_id')" id="sort-payment_method_id"><?= translate('payment_method', $i18n) ?></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -71,7 +76,7 @@
|
||||
$print[$id]['name']= $subscription['name'];
|
||||
$cycle = $subscription['cycle'];
|
||||
$frequency = $subscription['frequency'];
|
||||
$print[$id]['billing_cycle'] = getBillingCycle($cycle, $frequency);
|
||||
$print[$id]['billing_cycle'] = getBillingCycle($cycle, $frequency, $i18n);
|
||||
$paymentMethodId = $subscription['payment_method_id'];
|
||||
$print[$id]['currency_code'] = $currencies[$subscription['currency_id']]['code'];
|
||||
$currencyId = $subscription['currency_id'];
|
||||
@@ -94,20 +99,20 @@
|
||||
}
|
||||
|
||||
if (isset($print)) {
|
||||
printSubscriptions($print, $sort, $categories, $members);
|
||||
printSubscriptions($print, $sort, $categories, $members, $i18n);
|
||||
}
|
||||
$db->close();
|
||||
|
||||
if (count($subscriptions) == 0) {
|
||||
?>
|
||||
<div class="empty-page">
|
||||
<img src="images/siteimages/empty.png" alt="Empty page" />
|
||||
<img src="images/siteimages/empty.png" alt="<?= translate('empty_page', $i18n) ?>" />
|
||||
<p>
|
||||
You don't have any subscriptions yet
|
||||
<?= translate('no_subscriptions_yet', $i18n) ?>
|
||||
</p>
|
||||
<button class="button" onClick="addSubscription()">
|
||||
<img class="button-icon" src="images/siteicons/plusicon.png">
|
||||
Add First Subscription
|
||||
<?= translate('add_first_subscription', $i18n) ?>
|
||||
</button>
|
||||
</div>
|
||||
<?php
|
||||
@@ -117,25 +122,25 @@
|
||||
|
||||
<section class="subscription-form" id="subscription-form">
|
||||
<header>
|
||||
<h3 id="form-title">Add subscription</h3>
|
||||
<h3 id="form-title"><?= translate('add_subscription', $i18n) ?></h3>
|
||||
<span class="fa-solid fa-xmark close-form" onClick="closeAddSubscription()"></span>
|
||||
</header>
|
||||
<form action="endpoints/subscription/add.php" method="post" id="subs-form">
|
||||
|
||||
<div class="form-group-inline">
|
||||
<input type="text" id="name" name="name" placeholder="Subscription name" onchange="setSearchButtonStatus()" onkeypress="this.onchange();" onpaste="this.onchange();" oninput="this.onchange();" required>
|
||||
<input type="text" id="name" name="name" placeholder="<?= translate('subscription_name', $i18n) ?>" onchange="setSearchButtonStatus()" onkeypress="this.onchange();" onpaste="this.onchange();" oninput="this.onchange();" required>
|
||||
<label for="logo" class="logo-preview">
|
||||
<img src="" alt="Logo Preview" id="form-logo">
|
||||
<img src="" alt="<?= translate('logo_preview', $i18n) ?>" id="form-logo">
|
||||
</label>
|
||||
<input type="file" id="logo" name="logo" accept="image/jpeg, image/png" onchange="handleFileSelect(event)" class="hidden-input">
|
||||
<input type="hidden" id="logo-url" name="logo-url">
|
||||
<div id="logo-search-button" class="image-button medium disabled" title="Search logo on the web" onClick="searchLogo()">
|
||||
<div id="logo-search-button" class="image-button medium disabled" title="<?= translate('search_logo', $i18n) ?>" onClick="searchLogo()">
|
||||
<img src="images/siteicons/websearch.png">
|
||||
</div>
|
||||
<input type="hidden" id="id" name="id">
|
||||
<div id="logo-search-results" class="logo-search">
|
||||
<header>
|
||||
Web search
|
||||
<?= translate('web_search', $i18n) ?>
|
||||
<span class="fa-solid fa-xmark close-logo-search" onClick="closeLogoSearch()"></span>
|
||||
</header>
|
||||
<div id="logo-search-images"></div>
|
||||
@@ -143,8 +148,8 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group-inline">
|
||||
<input type="number" step="0.01" id="price" name="price" placeholder="Price" required>
|
||||
<select id="currency" name="currency_id" placeholder="Currency">
|
||||
<input type="number" step="0.01" id="price" name="price" placeholder="<?= translate('price', $i18n) ?>" required>
|
||||
<select id="currency" name="currency_id" placeholder="<?= translate('add_subscription', $i18n) ?>">
|
||||
<?php
|
||||
foreach ($currencies as $currency) {
|
||||
$selected = ($currency['id'] == $main_currency) ? 'selected' : '';
|
||||
@@ -156,16 +161,12 @@
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="inline">
|
||||
<div class="split66">
|
||||
<label for="cycle">Billing Cycle</label>
|
||||
<label for="cycle"><?= translate('billing_cycle', $i18n) ?></label>
|
||||
<div class="inline">
|
||||
<select id="frequency" name="frequency" placeholder="Frequency">
|
||||
<select id="frequency" name="frequency" placeholder="<?= translate('frequency', $i18n) ?>">
|
||||
<?php
|
||||
foreach ($frequencies as $frequency) {
|
||||
?>
|
||||
@@ -178,7 +179,7 @@
|
||||
<?php
|
||||
foreach ($cycles as $cycle) {
|
||||
?>
|
||||
<option value="<?= $cycle['id'] ?>" <?= $cycle['id'] == 3 ? "selected" : "" ?>><?= $cycle['name'] ?></option>
|
||||
<option value="<?= $cycle['id'] ?>" <?= $cycle['id'] == 3 ? "selected" : "" ?>><?= translate($cycle['name'], $i18n) ?></option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
@@ -186,14 +187,14 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="split33">
|
||||
<label for="next_payment">Next Payment</label>
|
||||
<label for="next_payment"><?= translate('next_payment', $i18n) ?></label>
|
||||
<input type="date" id="next_payment" name="next_payment" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="payment_method">Payment Method</label>
|
||||
<label for="payment_method"><?= translate('payment_method', $i18n) ?></label>
|
||||
<select id="payment_method" name="payment_method_id">
|
||||
<?php
|
||||
foreach ($payment_methods as $payment) {
|
||||
@@ -208,7 +209,7 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="category">Category</label>
|
||||
<label for="category"><?= translate('category', $i18n) ?></label>
|
||||
<select id="category" name="category_id">
|
||||
<?php
|
||||
foreach ($categories as $category) {
|
||||
@@ -224,7 +225,7 @@
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label for="payer_user">Paid by</label>
|
||||
<label for="payer_user"><?= translate('paid_by', $i18n) ?></label>
|
||||
<select id="payer_user" name="payer_user_id">
|
||||
<?php
|
||||
foreach ($members as $member) {
|
||||
@@ -237,11 +238,11 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<input type="text" id="url" name="url" placeholder="URL">
|
||||
<input type="text" id="url" name="url" placeholder="<?= translate('url', $i18n) ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<input type="text" id="notes" name="notes" placeholder="Notes">
|
||||
<input type="text" id="notes" name="notes" placeholder="<?= translate('notes', $i18n) ?>">
|
||||
</div>
|
||||
|
||||
<?php
|
||||
@@ -249,16 +250,16 @@
|
||||
?>
|
||||
<div class="form-group-inline">
|
||||
<input type="checkbox" id="notifications" name="notifications">
|
||||
<label for="notifications">Enable Notifications for this subscription</label>
|
||||
<label for="notifications"><?= translate('enable_notifications', $i18n) ?></label>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="buttons">
|
||||
<input type="button" value="Delete" class="warning-button left" id="deletesub" style="display: none">
|
||||
<input type="button" value="Cancel" class="secondary-button" onClick="closeAddSubscription()">
|
||||
<input type="submit" value="Save" id="save-button">
|
||||
<input type="button" value="<?= translate('delete', $i18n) ?>" class="warning-button left" id="deletesub" style="display: none">
|
||||
<input type="button" value="<?= translate('cancel', $i18n) ?>" class="secondary-button" onClick="closeAddSubscription()">
|
||||
<input type="submit" value="<?= translate('save', $i18n) ?>" id="save-button">
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user