Add translation system (#85)
This commit is contained in:
@@ -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.",
|
||||
|
||||
];
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user