Add translation system (#85)
This commit is contained in:
@@ -8,4 +8,8 @@ if (!$db) {
|
||||
die('Connection to the database failed.');
|
||||
}
|
||||
|
||||
require_once 'i18n/languages.php';
|
||||
require_once 'i18n/getlang.php';
|
||||
require_once 'i18n/' . $lang . '.php';
|
||||
|
||||
?>
|
||||
+2
-2
@@ -4,7 +4,7 @@
|
||||
<div class="toast-content">
|
||||
<i class="fas fa-solid fa-x toast-icon error"></i>
|
||||
<div class="message">
|
||||
<span class="text text-1">Error</span>
|
||||
<span class="text text-1"><?= translate("error", $i18n) ?></span>
|
||||
<span class="text text-2 errorMessage"></span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -16,7 +16,7 @@
|
||||
<div class="toast-content">
|
||||
<i class="fas fa-solid fa-check toast-icon success"></i>
|
||||
<div class="message">
|
||||
<span class="text text-1">Success</span>
|
||||
<span class="text text-1"><?= translate("success", $i18n) ?></span>
|
||||
<span class="text text-2 successMessage"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+12
-4
@@ -4,6 +4,10 @@
|
||||
require_once 'checksession.php';
|
||||
require_once 'currency_formatter.php';
|
||||
|
||||
require_once 'i18n/languages.php';
|
||||
require_once 'i18n/getlang.php';
|
||||
require_once 'i18n/' . $lang . '.php';
|
||||
|
||||
if ($userCount == 0) {
|
||||
$db->close();
|
||||
header("Location: registration.php");
|
||||
@@ -32,7 +36,10 @@
|
||||
<script type="text/javascript" src="scripts/common.js"></script>
|
||||
<script type="text/javascript">
|
||||
window.theme = "<?= $theme ?>";
|
||||
window.lang = "<?=$lang ?>";
|
||||
</script>
|
||||
<script type="text/javascript" src="scripts/i18n/<?= $lang ?>.js"></script>
|
||||
<script type="text/javascript" src="scripts/i18n/getlang.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
@@ -49,10 +56,11 @@
|
||||
<span id="user"><?= $username ?></span>
|
||||
</button>
|
||||
<div class="dropdown-content">
|
||||
<a href="stats.php"><i class="fa-solid fa-chart-simple"></i>Stats</a>
|
||||
<a href="settings.php"><i class="fa-solid fa-gear"></i>Settings</a>
|
||||
<a href="about.php"><i class="fa-solid fa-info-circle"></i>About</a>
|
||||
<a href="logout.php"><i class="fa-solid fa-arrow-right-from-bracket"></i>Logout</a>
|
||||
<a href="/"><i class="fa-solid fa-list"></i><?= translate('subscriptions', $i18n) ?></a>
|
||||
<a href="stats.php"><i class="fa-solid fa-chart-simple"></i><?= translate('stats', $i18n) ?></a>
|
||||
<a href="settings.php"><i class="fa-solid fa-gear"></i><?= translate('settings', $i18n) ?></a>
|
||||
<a href="about.php"><i class="fa-solid fa-info-circle"></i><?= translate('about', $i18n) ?></a>
|
||||
<a href="logout.php"><i class="fa-solid fa-arrow-right-from-bracket"></i><?= translate('logout', $i18n) ?></a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
@@ -0,0 +1,195 @@
|
||||
<?php
|
||||
|
||||
$i18n = [
|
||||
// Registration page
|
||||
"create_account" => "You need to create an account before you're able to login",
|
||||
'username' => "Username",
|
||||
'password' => "Password",
|
||||
"email" => "Email",
|
||||
"confirm_password" => "Confirm Password",
|
||||
"main_currency" => "Main Currency",
|
||||
"language" => "Language",
|
||||
"passwords_dont_match" => "Passwords do not match",
|
||||
"registration_failed" => "Registration failed, please try again.",
|
||||
"register" => "Register",
|
||||
// Login Page
|
||||
'please_login' => "Please login",
|
||||
'stay_logged_in' => "Stay logged in (30 days)",
|
||||
'login' => "Login",
|
||||
'login_failed' => "Login details are incorrect",
|
||||
// Header
|
||||
'subscriptions' => "Subscriptions",
|
||||
'stats' => "Statistics",
|
||||
'settings' => "Settings",
|
||||
'about' => "About",
|
||||
'logout' => "Logout",
|
||||
// Subscriptions page
|
||||
"subscription" => "Subscription",
|
||||
"no_subscriptions_yet" => "You don't have any subscriptions yet",
|
||||
"add_first_subscription" => "Add first subscription",
|
||||
'new_subscription' => "New Subscription",
|
||||
'sort' => "Sort",
|
||||
'name' => "Nome",
|
||||
'last_added' => "Last Added",
|
||||
'price' => "Price",
|
||||
'next_payment' => "Next Payment",
|
||||
'member' => "Member",
|
||||
'category' => "Category",
|
||||
'payment_method' => "Payment Method",
|
||||
"Daily" => "Daily",
|
||||
"Weekly" => "Weekly",
|
||||
"Monthly" => "Monthly",
|
||||
"Yearly" => "Yearly",
|
||||
"days" => "days",
|
||||
"weeks" => "weeks",
|
||||
"months" => "months",
|
||||
"years" => "years",
|
||||
"external_url" => "Visit Externarl URL",
|
||||
"empty_page" => "Empty Page",
|
||||
// Subscription form
|
||||
"add_subscription" => "Add subscription",
|
||||
"edit_subscription" => "Edit subscription",
|
||||
"subscription_name" => "Subscription name",
|
||||
"logo_preview" => "Logo Preview",
|
||||
"search_logo" => "Search logo on the web",
|
||||
"web_search" => "Web search",
|
||||
"currency" => "Currency",
|
||||
"billing_cycle" => "Billing Cycle",
|
||||
"frequency" => "Frequency",
|
||||
"cycle" => "Cycle",
|
||||
"next_payment" => "Next Payment",
|
||||
"payment_method" => "Payment Method",
|
||||
"no_category" => "No category",
|
||||
"paid_by" => "Paid by",
|
||||
"url" => "URL",
|
||||
"notes" => "Notes",
|
||||
"enable_notifications" => "Enable Notifications for this subscription",
|
||||
"delete" => "Delete",
|
||||
"cancel" => "Cancel",
|
||||
"upload_logo" => "Upload Logo",
|
||||
// Statistics page
|
||||
'general_statistics' => "General Statistics",
|
||||
'active_subscriptions' => "Active Subscriptions",
|
||||
'monthly_cost' => "Monthly Cost",
|
||||
'yearly_cost' => "Yearly Cost",
|
||||
'average_monthly' => "Average Monthly Subscription Cost",
|
||||
'most_expensive' => "Most Expensive Subscription Cost",
|
||||
'amount_due' => "Amount due this month",
|
||||
'split_views' => "Split Views",
|
||||
'category_split' => "Category Split",
|
||||
'household_split' => "Household Split",
|
||||
// About page
|
||||
'about_and_credits' => "About and Credits",
|
||||
'license' => "License",
|
||||
'issues_and_requests' => "Issues and Requests",
|
||||
'the_author' => "The author",
|
||||
'icons' => "Icons",
|
||||
'payment_icons' => "Payment Icons",
|
||||
// Settings page
|
||||
'user_details' => "User Details",
|
||||
"household" => "Household",
|
||||
"save_member" => "Save Member",
|
||||
"delete_member" => "Delete Member",
|
||||
"cant_delete_member" => "Can't delete main member",
|
||||
"cant_delete_member_in_use" => "Can't delete member in use in subscription",
|
||||
"notifications" => "Notifications",
|
||||
"enable_email_notifications" => "Enable email notifications",
|
||||
"notify_me" => "Notify me",
|
||||
"day_before" => "day before",
|
||||
"days_before" => "days before",
|
||||
"smtp_address" => "SMTP Address",
|
||||
"port" => "Port",
|
||||
"smtp_username" => "SMTP Username",
|
||||
"smtp_password" => "SMTP Password",
|
||||
"from_email" => "From email (Optional)",
|
||||
"smtp_info" => "SMTP Password is transmitted and stored in plaintext. For security, please create an account just for this.",
|
||||
"categories" => "Categories",
|
||||
"save_category" => "Save Category",
|
||||
"delete_category" => "Delete Category",
|
||||
"cant_delete_category_in_use" => "Can't delete category in use in subscription",
|
||||
"currencies" => "Currencies",
|
||||
"save_currency" => "Save currency",
|
||||
"delete_currency" => "Delete currency",
|
||||
"cant_delete_main_currency" => "Can't delete main currency",
|
||||
"cant_delete_currency_in_use" => "Can't delete currency in use in subscription",
|
||||
"exchange_update" => "Exchange rates last updated on",
|
||||
"currency_info" => "Find the supported currencies and correct currency codes on",
|
||||
"currency_performance" => "For improved performance keep only the currencies you use.",
|
||||
"fixer_api_key" => "Fixer API Key",
|
||||
"api_key" => "API Key",
|
||||
"fixer_info" => "If you use multiple currencies, and want accurate statistics and sorting on the subscriptions, a FREE API Key from Fixer is necessary.",
|
||||
"get_key" => "Get your key at",
|
||||
"display_settings" => "Display Settings",
|
||||
"switch_theme" => "Switch Light / Dark Theme",
|
||||
"calculate_monthly_price" => "Calculate and show monthly price for all subscriptions",
|
||||
"convert_prices" => "Always convert and show prices on my main currency (slower)",
|
||||
"experimental_settings" => "Experimental Settings",
|
||||
"remove_background" => "Attempt to remove background of logos from image search (experimental)",
|
||||
"experimental_info" => "Experimental settings will probably not work perfectly.",
|
||||
"payment_methods" => "Payment Methods",
|
||||
"payment_methods_info" => "Click a payment method to disable / enable it.",
|
||||
"cant_delete_payment_method_in_use" => "Can't disable used payment method",
|
||||
"disable" => "Disable",
|
||||
"enable" => "Enable",
|
||||
"test" => "Test",
|
||||
"add" => "Add",
|
||||
"save" => "Save",
|
||||
// Toast
|
||||
"success" => "Success",
|
||||
// Endpoint responses
|
||||
"session_expired" => "Your session expired. Please login again",
|
||||
"fields_missing" => "Some fields are missing",
|
||||
"fill_all_fields" => "Please fill all fields",
|
||||
"fill_mandatory_fields" => "Please fill all mandatory fields",
|
||||
"error" => "Error",
|
||||
// Category
|
||||
"failed_add_category" => "Failed to add category",
|
||||
"failed_edit_category" => "Failed to edit category",
|
||||
"category_in_use" => "Category is in use in subscriptions and can't be removed",
|
||||
"failed_remove_category" => "Failed to remove category",
|
||||
"category_saved" => "Category saved",
|
||||
"category_removed" => "Category removed",
|
||||
// Currency
|
||||
"currency_saved" => "was saved.",
|
||||
"error_adding_currency" => "Error adding currency entry.",
|
||||
"failed_to_store_currency" => "Failed to store Currency on the Database.",
|
||||
"currency_in_use" => "Currency is in use in subscriptions and can't be deleted.",
|
||||
"currency_is_main" => "Currency is set as main currency and can't be deleted.",
|
||||
"failed_to_remove_currency" => "Failed to remove currency from the Database.",
|
||||
"failed_to_store_api_key" => "Failed to store API Key on the Database.",
|
||||
"invalid_api_key" => "Invalid API Key.",
|
||||
"api_key_saved" => "API key saved successfully",
|
||||
"currency_removed" => "Currency removed",
|
||||
// Household
|
||||
"failed_add_household" => "Failed to add household member",
|
||||
"failed_edit_household" => "Failed to edit household member",
|
||||
"failed_remove_household" => "Failed to remove household member",
|
||||
"household_in_use" => "Household member is in use in subscriptions and can't be removed",
|
||||
"member_saved" => "Member saved",
|
||||
"member_removed" => "Member removed",
|
||||
// Notifications
|
||||
"error_saving_notifications" => "Error saving notifications data.",
|
||||
"wallos_notification" => "Wallos Notification",
|
||||
"test_notification" => "This is a test notification. If you\'re seeing this, the configuration is correct.",
|
||||
"email_error" => "Error sending email",
|
||||
"notification_sent_successfuly" => "Notification sent successfuly",
|
||||
"notifications_settings_saved" => "Notification settings saved successfully.",
|
||||
// Payments
|
||||
"payment_in_use" => "Can't disable used payment method",
|
||||
"failed_update_payment" => "Failed to update payment method in the database",
|
||||
"enabled" => "enabled",
|
||||
"disabled" => "disabled",
|
||||
// Subscription
|
||||
"error_fetching_image" => "Error fetching image",
|
||||
"subscription_updated_successfuly" => "Subscription updated successfuly",
|
||||
"subscription_added_successfuly" => "Subscription added successfuly",
|
||||
"error_deleting_subscription" => "Error deleting subscription.",
|
||||
"invalid_request_method" => "Invalid request method.",
|
||||
// User
|
||||
"error_updating_user_data" => "Error updating user data.",
|
||||
"user_details_saved" => "User details saved",
|
||||
|
||||
];
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
$lang = "en";
|
||||
if (isset($_COOKIE['language'])) {
|
||||
$selectedLanguage = $_COOKIE['language'];
|
||||
|
||||
if (array_key_exists($selectedLanguage, $languages)) {
|
||||
$lang = $selectedLanguage;
|
||||
}
|
||||
}
|
||||
|
||||
function translate($text, $translations) {
|
||||
if (array_key_exists($text, $translations)) {
|
||||
return $translations[$text];
|
||||
} else {
|
||||
require_once 'en.php';
|
||||
if (array_key_exists($text, $i18n)) {
|
||||
return $i18n[$text];
|
||||
} else {
|
||||
return "[i18n String Missing]";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
// File Name => Language Name
|
||||
|
||||
$languages = [
|
||||
"en" => "English",
|
||||
"pt" => "Português",
|
||||
]
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,194 @@
|
||||
<?php
|
||||
|
||||
$i18n = [
|
||||
// Registration page
|
||||
"create_account" => "Tem que criar uma conta antes de poder iniciar sessão",
|
||||
'username' => "Nome de utilizador",
|
||||
'password' => "Password",
|
||||
"email" => "Email",
|
||||
"confirm_password" => "Confirmar Password",
|
||||
"main_currency" => "Moeda Principal",
|
||||
"language" => "Linguagem",
|
||||
"passwords_dont_match" => "As passwords não coincidem",
|
||||
"registration_failed" => "O registo falhou. Tente novamente",
|
||||
"register" => "Registar",
|
||||
// Login Page
|
||||
'please_login' => "Por favor inicie sessão",
|
||||
'stay_logged_in' => "Manter sessão (30 dias)",
|
||||
'login' => "Iniciar Sessão",
|
||||
'login_failed' => "Dados de autenticação incorrectos",
|
||||
// Header
|
||||
'subscriptions' => "Subscrições",
|
||||
'stats' => "Estatísticas",
|
||||
'settings' => "Definições",
|
||||
'about' => "Sobre",
|
||||
'logout' => "Terminar Sessão",
|
||||
// Subscriptions page
|
||||
"subscription" => "Subscrição",
|
||||
"no_subscriptions_yet" => "Ainda não tem subscrições",
|
||||
"add_first_subscription" => "Adicionar primeira subscrição",
|
||||
'new_subscription' => "Nova Subscrição",
|
||||
'sort' => "Ordenar",
|
||||
'name' => "Nome",
|
||||
'last_added' => "Última Adicionada",
|
||||
'price' => "Preço",
|
||||
'next_payment' => "Próximo Pagamento",
|
||||
'member' => "Membro",
|
||||
'category' => "Categoria",
|
||||
'payment_method' => "Metodo de Pagamento",
|
||||
"Daily" => "Diario",
|
||||
"Weekly" => "Semanal",
|
||||
"Monthly" => "Mensal",
|
||||
"Yearly" => "Anual",
|
||||
"days" => "dias",
|
||||
"weeks" => "semanas",
|
||||
"months" => "meses",
|
||||
"years" => "anos",
|
||||
"external_url" => "Visitar URL Externo",
|
||||
"empty_page" => "Página Vazia",
|
||||
// Subscription form
|
||||
"add_subscription" => "Adicionar subscrição",
|
||||
"edit_subscription" => "Modificar subscrição",
|
||||
"subscription_name" => "Nome da subscrição",
|
||||
"logo_preview" => "Pre-visualisação do logo",
|
||||
"search_logo" => "Pesquisar logo na internet",
|
||||
"web_search" => "Pesquisa online",
|
||||
"currency" => "Moeda",
|
||||
"billing_cycle" => "Ciclo de faturação",
|
||||
"frequency" => "Frequencia",
|
||||
"Cycle" => "Ciclo",
|
||||
"next_payment" => "Próximo Pagamento",
|
||||
"payment_method" => "Método de Pagamento",
|
||||
"no_category" => "Sem categoria",
|
||||
"paid_by" => "Pago por",
|
||||
"url" => "URL",
|
||||
"notes" => "Notas",
|
||||
"enable_notifications" => "Activar notificações para esta subscrição",
|
||||
"delete" => "Remover",
|
||||
"cancel" => "Cancelar",
|
||||
"upload_logo" => "Enviar Logo",
|
||||
// Statistics page
|
||||
'general_statistics' => "Estatísticas Gerais",
|
||||
'active_subscriptions' => "Subscrições Activas",
|
||||
'monthly_cost' => "Custo Mensal",
|
||||
'yearly_cost' => "Custo Anual",
|
||||
'average_monthly' => "Custo Mensal Médio das Subscrições",
|
||||
'most_expensive' => "Custo da Subscrição Mais Cara",
|
||||
'amount_due' => "Quantia em dívida este mês",
|
||||
'split_views' => "Vistas Divididas",
|
||||
'category_split' => "Por Categoria",
|
||||
'household_split' => "Por Membro",
|
||||
// About page
|
||||
'about_and_credits' => "Sobre e Créditos",
|
||||
'license' => "Licença",
|
||||
'issues_and_requests' => "Problemas e Pedidos",
|
||||
'the_author' => "O Autor",
|
||||
'icons' => "Ícones",
|
||||
'payment_icons' => "Ícones de Pagamentos",
|
||||
// Settings page
|
||||
'user_details' => "Detalhes do utilizador",
|
||||
"household" => "Agregado",
|
||||
"save_member" => "Guardar Membro",
|
||||
"delete_member" => "Apagar Membro",
|
||||
"cant_delete_member" => "Não pode apagar o membro principal",
|
||||
"cant_delete_member_in_use" => "Não pode apagar membro em uso em subscrição",
|
||||
"notifications" => "Notificações",
|
||||
"enable_email_notifications" => "Activar notificações por email",
|
||||
"notify_me" => "Notificar-me",
|
||||
"day_before" => "dia antes",
|
||||
"days_before" => "dias antes",
|
||||
"smtp_address" => "Endereço SMTP",
|
||||
"port" => "Porto",
|
||||
"smtp_username" => "Utilizador SMTP",
|
||||
"smtp_password" => "Password SMTP",
|
||||
"from_email" => "Email de envio (Opcional)",
|
||||
"smtp_info" => "A Password é armazenada e transmitida em texto. Por segurança, crie uma conta só para esta finalidade.",
|
||||
"categories" => "Categorias",
|
||||
"save_category" => "Guardar Categoria",
|
||||
"delete_category" => "Apagar Categoria",
|
||||
"cant_delete_category_in_use" => "Não pode apagar categoria em uso em subscrição",
|
||||
"currencies" => "Moedas",
|
||||
"save_currency" => "Guardar moeda",
|
||||
"delete_currency" => "Apagar moeda",
|
||||
"cant_delete_main_currency" => "Não pode apagar a moeda principal",
|
||||
"cant_delete_currency_in_use" => "Não pode apagar moeda em uso em subscrição",
|
||||
"exchange_update" => "Taxas de conversão actualizadas em",
|
||||
"currency_info" => "Encontre a lista de moedas e os respectivos códigos em",
|
||||
"currency_performance" => "Por motivos de desempenho mantenha apenas as moedas que usa.",
|
||||
"fixer_api_key" => "Fixer API Key",
|
||||
"api_key" => "API Key",
|
||||
"fixer_info" => "Se usa multiplas moedas e deseja estatísticas correctas é necessário uma API Key grátis do Fixer.",
|
||||
"get_key" => "Obtenha a sua API Key em",
|
||||
"display_settings" => "Definições de visualização",
|
||||
"switch_theme" => "Trocar Tema Claro / Escuro",
|
||||
"calculate_monthly_price" => "Calcular e mostrar preço mensal para todas as subscrições",
|
||||
"convert_prices" => "Converter e mostrar todas as subscrições na moeda principal (mais lento)",
|
||||
"experimental_settings" => "Definições Experimentais",
|
||||
"remove_background" => "Tentar remover o fundo dos logos na pesquisa de imagem (experimental)",
|
||||
"experimental_info" => "Definições experimentais provavelmente não funcionarão correctamente.",
|
||||
"payment_methods" => "Métodos de Pagamento",
|
||||
"payment_methods_info" => "Clique num método de pagamento para o activar / desactivar.",
|
||||
"cant_delete_payment_method_in_use" => "Não pode desactivar metodo de pagamento em uso",
|
||||
"disable" => "Desactivar",
|
||||
"enable" => "Activar",
|
||||
"test" => "Testar",
|
||||
"add" => "Adicionar",
|
||||
"save" => "Guardar",
|
||||
// Toast
|
||||
"success" => "Sucesso",
|
||||
// Endpoint responses
|
||||
"session_expired" => "A sessão expirou. Por favor autentique-se.",
|
||||
"fields_missing" => "Alguns campos em falta",
|
||||
"fill_all_fields" => "Por favor preencha todos os campos",
|
||||
"fill_mandatory_fields" => "Por favor preencha todos os campos obrigatórios",
|
||||
"error" => "Erro",
|
||||
// Category
|
||||
"failed_add_category" => "Erro ao adicionar categoria",
|
||||
"failed_edit_category" => "Erro ao modificar categoria",
|
||||
"category_in_use" => "Categoria em uso em subscrição e não pode ser removida",
|
||||
"failed_remove_category" => "Erro ao remover categoria",
|
||||
"category_saved" => "Categoria guardada",
|
||||
"category_removed" => "Categoria removida",
|
||||
// Currency
|
||||
"currency_saved" => "guardada.",
|
||||
"error_adding_currency" => "Erro ao adicionar moeda.",
|
||||
"failed_to_store_currency" => "Erro ao guardar a moeda na base de dados.",
|
||||
"currency_in_use" => "Moeda em uso em subscrição e não pode ser removida.",
|
||||
"currency_is_main" => "A Moeda principal não pode ser removida.",
|
||||
"failed_to_remove_currency" => "Erro ao remover a moeda da base de dados.",
|
||||
"failed_to_store_api_key" => "Erro ao guardar API Key na base de dados.",
|
||||
"invalid_api_key" => "API Key inválida.",
|
||||
"api_key_saved" => "API key guardada",
|
||||
"currency_removed" => "Moeda removida",
|
||||
// Household
|
||||
"failed_add_household" => "Erro ao adicionar membro",
|
||||
"failed_edit_household" => "Erro ao modificar membro",
|
||||
"failed_remove_household" => "Erro ao remover membro",
|
||||
"household_in_use" => "Membro está em uso em subscrição e não pode er removido",
|
||||
"member_saved" => "Membro guardado",
|
||||
"member_removed" => "Membro removido",
|
||||
// Notifications
|
||||
"error_saving_notifications" => "Erro ao guardar os dados das notificaçoes.",
|
||||
"wallos_notification" => "Notificação Wallos",
|
||||
"test_notification" => "Isto é uma notificação de teste. Se está a ver isto a configuração está correcta.",
|
||||
"email_error" => "Erro ao enviar email",
|
||||
"notification_sent_successfuly" => "Notificação enviada com sucesso",
|
||||
"notifications_settings_saved" => "Configuração de notificações guardada.",
|
||||
// Payments
|
||||
"payment_in_use" => "Não pode desactivar método de pagamento em uso",
|
||||
"failed_update_payment" => "Erro ao actualizar método de pagamento na base de dados",
|
||||
"enabled" => "activado",
|
||||
"disabled" => "descativado",
|
||||
// Subscription
|
||||
"error_fetching_image" => "Erro ao obter a imagem",
|
||||
"subscription_updated_successfuly" => "Subscrição actualizada com sucesso",
|
||||
"subscription_added_successfuly" => "Subscrição adicionada com sucesso",
|
||||
"error_deleting_subscription" => "Erro ao remover subscrição.",
|
||||
"invalid_request_method" => "Método invalido.",
|
||||
// User
|
||||
"error_updating_user_data" => "Erro ao actualizar dados do utilizador.",
|
||||
"user_details_saved" => "Dados do utiliador actualizados.",
|
||||
|
||||
];
|
||||
|
||||
?>
|
||||
@@ -1,18 +1,20 @@
|
||||
<?php
|
||||
|
||||
function getBillingCycle($cycle, $frequency) {
|
||||
require_once 'i18n/getlang.php';
|
||||
|
||||
function getBillingCycle($cycle, $frequency, $i18n) {
|
||||
switch ($cycle) {
|
||||
case 1:
|
||||
return $frequency == 1 ? "Daily" : $frequency . " days";
|
||||
return $frequency == 1 ? translate('Daily', $i18n) : $frequency . " " . translate('days', $i18n);
|
||||
break;
|
||||
case 2:
|
||||
return $frequency == 1 ? "Weekly" : $frequency . " weeks";
|
||||
return $frequency == 1 ? translate('Weekly', $i18n) : $frequency . " " . translate('weeks', $i18n);
|
||||
break;
|
||||
case 3:
|
||||
return $frequency == 1 ? "Monthly" : $frequency . " months";
|
||||
return $frequency == 1 ? translate('Monthly', $i18n) : $frequency . " " . translate('months', $i18n);
|
||||
break;
|
||||
case 4:
|
||||
return $frequency == 1 ? "Yearly" : $frequency . " years";
|
||||
return $frequency == 1 ? translate('YEarly', $i18n) : $frequency . " " . translate('years', $i18n);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -54,7 +56,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
function printSubscriptions($subscriptions, $sort, $categories, $members) {
|
||||
function printSubscriptions($subscriptions, $sort, $categories, $members, $i18n) {
|
||||
if ($sort === "price") {
|
||||
usort($subscriptions, function($a, $b) {
|
||||
return $a['price'] < $b['price'] ? 1 : -1;
|
||||
@@ -97,19 +99,19 @@
|
||||
<span class="cycle"><?= $subscription['billing_cycle'] ?></span>
|
||||
<span class="next"><?= $subscription['next_payment'] ?></span>
|
||||
<span class="price">
|
||||
<img src="<?= $subscription['payment_method_icon'] ?>" title="Payment Method: <?= $subscription['payment_method_name'] ?>"/>
|
||||
<img src="<?= $subscription['payment_method_icon'] ?>" title="<?= translate('payment_method', $i18n) ?>: <?= $subscription['payment_method_name'] ?>"/>
|
||||
<?= CurrencyFormatter::format($subscription['price'], $subscription['currency_code']) ?>
|
||||
</span>
|
||||
<span class="actions">
|
||||
<button class="image-button medium" onClick="openEditSubscription(event, <?= $subscription['id'] ?>)" name="edit">
|
||||
<img src="images/siteicons/edit.png" title="Edit subscription">
|
||||
<img src="images/siteicons/edit.png" title="<?= translate('edit_subscription', $i18n) ?>">
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
<div class="subscription-secondary">
|
||||
<span class="name"><img src="images/siteicons/subscription.png" alt="Subscription" /><?= $subscription['name'] ?></span>
|
||||
<span class="payer_user" title="Paid By"><img src="images/siteicons/payment.png" alt="Paid By" /><?= $members[$subscription['payer_user_id']]['name'] ?></span>
|
||||
<span class="category" title="Category" ><img src="images/siteicons/category.png" alt="Category" /><?= $categories[$subscription['category_id']]['name'] ?></span>
|
||||
<span class="name"><img src="images/siteicons/subscription.png" alt="<?= translate('subscription', $i18n) ?>" /><?= $subscription['name'] ?></span>
|
||||
<span class="payer_user" title="<?= translate('paid_by', $i18n) ?>"><img src="images/siteicons/payment.png" alt="<?= translate('paid_by', $i18n) ?>" /><?= $members[$subscription['payer_user_id']]['name'] ?></span>
|
||||
<span class="category" title="<?= translate('category', $i18n) ?>" ><img src="images/siteicons/category.png" alt="<?= translate('category', $i18n) ?>" /><?= $categories[$subscription['category_id']]['name'] ?></span>
|
||||
<?php
|
||||
if ($subscription['url'] != "") {
|
||||
$url = $subscription['url'];
|
||||
@@ -117,7 +119,7 @@
|
||||
$url = "https://" . $url;
|
||||
}
|
||||
?>
|
||||
<span class="url" title="External Url"><a href="<?= $url ?>" target="_blank"><img src="images/siteicons/web.png" alt="URL" /></a></span>
|
||||
<span class="url" title="<?= translate('external_url', $i18n) ?>"><a href="<?= $url ?>" target="_blank"><img src="images/siteicons/web.png" alt="<?= translate('url', $i18n) ?>" /></a></span>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user