diff --git a/dj.php b/dj.php index e8a319a..d1b29dc 100644 --- a/dj.php +++ b/dj.php @@ -9,8 +9,7 @@ require_once 'classes/DJ.php'; use Yosymfony\Toml\Toml; $config = Toml::ParseFile('includes/config.toml'); -$lang = $_SESSION['lang'] ?? $config['app']['locale']; -$locale = loadLocale($lang); +require_once 'includes/lang_loader.php'; // if there's a query parameter named 'dj', load the DJ class $db = new Database($config); $djFound = false; @@ -24,15 +23,10 @@ if (isset($_GET['dj']) && $_GET['dj'] != "") { ?> - + - - - <?php echo $config['app']['name']; ?> - - - - + @@ -309,6 +303,6 @@ if (isset($_GET['dj']) && $_GET['dj'] != "") { - + \ No newline at end of file diff --git a/footer.php b/footer.php new file mode 100644 index 0000000..7f2ff46 --- /dev/null +++ b/footer.php @@ -0,0 +1 @@ + diff --git a/genre.php b/genre.php index 85c519a..7728c3b 100644 --- a/genre.php +++ b/genre.php @@ -5,13 +5,12 @@ require_once 'vendor/autoload.php'; require_once 'functions/i18n.php'; require_once 'classes/Database.php'; require_once 'classes/Genre.php'; +ob_start(); use Yosymfony\Toml\Toml; $config = Toml::ParseFile('includes/config.toml'); -$lang = $_SESSION['lang'] ?? $config['app']['locale']; -$locale = loadLocale($lang); -$genre= null; +require_once 'includes/lang_loader.php';$genre= null; $genreFound = false; // if there's a query parameter named 'dj', load the DJ class $db = new Database($config); @@ -27,15 +26,10 @@ if (isset($_GET['genre']) && $_GET['genre'] != "") { ?> - + - - - <?php echo $config['app']['name']; ?> - - - - + @@ -198,6 +192,6 @@ if (isset($_GET['genre']) && $_GET['genre'] != "") { - + \ No newline at end of file diff --git a/header.php b/header.php new file mode 100644 index 0000000..a018564 --- /dev/null +++ b/header.php @@ -0,0 +1,5 @@ + + +<?php echo $config['app']['name']; ?> + + \ No newline at end of file diff --git a/includes/lang_loader.php b/includes/lang_loader.php new file mode 100644 index 0000000..5d23e8b --- /dev/null +++ b/includes/lang_loader.php @@ -0,0 +1,12 @@ + - + - - - <?php echo $config['app']['name']; ?> - - - - + @@ -38,6 +31,6 @@ $locale = loadLocale($lang); - + \ No newline at end of file diff --git a/locale/de_DE/messages.php b/locale/de_DE/messages.php new file mode 100644 index 0000000..3511b10 --- /dev/null +++ b/locale/de_DE/messages.php @@ -0,0 +1,37 @@ + 'Willkommen auf unserer Website!', + 'description' => 'Dies ist eine Beschreibung auf Englisch.', + 'userProfile' => "Benutzerprofil", + 'user' => 'Benutzer', + 'home' => 'Zuhause', + 'djName' => 'DJ-Name', + 'email' => 'E-Mail', + 'location' => 'Standort', + 'bio' => 'Bio', + 'submit' => 'Absenden', + 'login' => 'Anmelden', + 'message' => 'Nachricht', + 'follow' => 'Folgen', + 'djs' => 'DJs', + "djNotFound" => "DJ konnte nicht geladen werden. Entweder wurde der DJ nicht gefunden oder dieser DJ ist privat.", + "notfound" => "Seite nicht gefunden", + "genre" => "Genre", + "genres" => "Genres", + "genreNotFound" => "Genre konnte nicht geladen werden; entweder wurde das Genre nicht gefunden, war leer oder dieses Genre ist privat.", + "mix-count" => "Mix-Anzahl", + "mixes" => "Mischungen", + "mix" => "Mix", + "mixNotFound" => "Mix konnte nicht geladen werden; entweder wurde der Mix nicht gefunden, war leer oder dieser Mix ist privat.", + "mixName" => "Mix-Name", + "mixDescription" => "Mix-Beschreibung", + "mixLength" => "Mix-Länge", + "mixGenre" => "Genre mischen", + "view" => "Ansicht", + "mixname" => "Mix-Name", + "search" => "Suchen", + "searchResults" => "Suchergebnisse", + "searchResultsFor" => "Suchergebnisse für", + "searchResultsFound" => "Suchergebnisse gefunden", + +]; \ No newline at end of file diff --git a/locale/en_US/messages.php b/locale/en_US/messages.php index 3bb19a8..2105888 100644 --- a/locale/en_US/messages.php +++ b/locale/en_US/messages.php @@ -29,5 +29,9 @@ return [ "mixGenre" => "Mix Genre", "view" => "View", "mixname" => "Mix Name", + "search" => "Search", + "searchResults" => "Search Results", + "searchResultsFor" => "Search Results for", + "searchResultsFound" => "Search Results Found", ]; \ No newline at end of file diff --git a/locale/es_ES/messages.php b/locale/es_ES/messages.php new file mode 100644 index 0000000..87d75ce --- /dev/null +++ b/locale/es_ES/messages.php @@ -0,0 +1,37 @@ + '¡Bienvenido a nuestro sitio web!', + 'description' => 'This is a description in Spanish.', + 'userProfile' => "Perfil de usuario", + 'user' => 'Usuario', + 'home' => 'Inicio', + 'djName' => 'Nombre DJ', + 'email' => 'E-mail', + 'location' => 'Ubicación', + 'bio' => 'Bio', + 'submit' => 'Enviar', + 'login' => 'Ingresar', + 'message' => 'Mensaje', + 'follow' => 'Seguir', + 'djs' => 'DJs', + "djNotFound" => "No se pudo cargar el DJ; o el DJ no se encontró o este DJ es privado.", + "notfound" => "Página no encontrada", + "genre" => "Género", + "genres" => "Genres", + "genreNotFound" => "No se pudo cargar el género; o el género no fue encontrado, estaba vacío, o este género es privado.", + "mix-count" => "Conteo Mix", + "mixes" => "Mezclas", + "mix" => "Mezcla", + "mixNotFound" => "No se pudo cargar la mezcla; o bien la mezcla no fue encontrada, estaba vacía, o esta mezcla es privada.", + "mixName" => "Mezclar nombre", + "mixDescription" => "Mezclar descripción", + "mixLength" => "Mezclar longitud", + "mixGenre" => "Mezclar género", + "view" => "Ver", + "mixname" => "Mezclar nombre", + "search" => "Buscar", + "searchResults" => "Resultados de búsqueda", + "searchResultsFor" => "Resultados de búsqueda para", + "searchResultsFound" => "Resultados de búsqueda encontrados", + +]; \ No newline at end of file diff --git a/locale/fil_PH/messages.php b/locale/fil_PH/messages.php new file mode 100644 index 0000000..ae5cd98 --- /dev/null +++ b/locale/fil_PH/messages.php @@ -0,0 +1,37 @@ + 'Maligayang pagdating sa aming website!', + 'description' => 'Ito ay isang paglalarawan sa Tagalog.', + 'userProfile' => "User Profile", + 'user' => 'User', + 'home' => 'Home', + 'djName' => 'DJ Name', + 'email' => 'Email', + 'location' => 'Location', + 'bio' => 'Bio', + 'submit' => 'Submit', + 'login' => 'Login', + 'message' => 'Message', + 'follow' => 'Follow', + 'djs' => 'DJs', + "djNotFound" => "Could not load DJ; either the DJ wasn't found or this DJ is private.", + "notfound" => "Page not found", + "genre" => "Genre", + "genres" => "Genres", + "genreNotFound" => "Could not load genre; either the genre wasn't found, was empty, or this genre is private.", + "mix-count" => "Mix Count", + "mixes" => "Mixes", + "mix" => "Mix", + "mixNotFound" => "Could not load mix; either the mix wasn't found, was empty, or this mix is private.", + "mixName" => "Mix Name", + "mixDescription" => "Mix Description", + "mixLength" => "Mix Length", + "mixGenre" => "Mix Genre", + "view" => "View", + "mixname" => "Mix Name", + "search" => "Search", + "searchResults" => "Search Results", + "searchResultsFor" => "Search Results for", + "searchResultsFound" => "Search Results Found", + +]; \ No newline at end of file diff --git a/locale/fr_FR/messages.php b/locale/fr_FR/messages.php new file mode 100644 index 0000000..1a98efe --- /dev/null +++ b/locale/fr_FR/messages.php @@ -0,0 +1,37 @@ + 'Bienvenue sur notre site Web!', + 'description' => 'This is a description in English.', + 'userProfile' => "Profil de l'utilisateur", + 'user' => 'Utilisateur', + 'home' => 'Domicile', + 'djName' => 'Nom du DJ', + 'email' => 'Courriel', + 'location' => 'Localisation', + 'bio' => 'Bio', + 'submit' => 'Soumettre', + 'login' => 'Se connecter', + 'message' => 'Message', + 'follow' => 'Suivre', + 'djs' => 'DJs', + "djNotFound" => "Impossible de charger le DJ; soit le DJ n'a pas été trouvé, soit ce DJ est privé.", + "notfound" => "Page introuvable", + "genre" => "Genre", + "genres" => "Genres", + "genreNotFound" => "Impossible de charger le genre, soit le genre n'a pas été trouvé, soit ce genre est privé.", + "mix-count" => "Nombre de mixages", + "mixes" => "Mixes", + "mix" => "Mélanger", + "mixNotFound" => "Impossible de charger le mixage; soit le mixage n'a pas été trouvé, soit le mixage est vide, soit ce mixage est privé.", + "mixName" => "Nom du mixage", + "mixDescription" => "Description du mixage", + "mixLength" => "Longueur du mixage", + "mixGenre" => "Mélanger le genre", + "view" => "Voir", + "mixname" => "Nom du mixage", + "search" => "Chercher", + "searchResults" => "Résultats de recherche", + "searchResultsFor" => "Résultats de recherche pour", + "searchResultsFound" => "Résultats de recherche trouvés", + +]; \ No newline at end of file diff --git a/locale/it_IT/messages.php b/locale/it_IT/messages.php new file mode 100644 index 0000000..40b848d --- /dev/null +++ b/locale/it_IT/messages.php @@ -0,0 +1,37 @@ + 'Benvenuto nel nostro sito Web!', + 'description' => 'Questa è una descrizione in inglese.', + 'userProfile' => "Profilo Utente", + 'user' => 'Utente', + 'home' => 'Home', + 'djName' => 'Nome DJ', + 'email' => 'Email', + 'location' => 'Posizione', + 'bio' => 'Bio', + 'submit' => 'Invia', + 'login' => 'Accedi', + 'message' => 'Messaggio', + 'follow' => 'Segui', + 'djs' => 'DJ', + "djNotFound" => "Impossibile caricare DJ; o il DJ non è stato trovato o questo DJ è privato.", + "notfound" => "Pagina non trovata", + "genre" => "Genere", + "genres" => "Genres", + "genreNotFound" => "Impossibile caricare il genere; o il genere non è stato trovato, è vuoto, o questo genere è privato.", + "mix-count" => "Conteggio Mix", + "mixes" => "Miscele", + "mix" => "Miscela", + "mixNotFound" => "Impossibile caricare il mix; o il mix non è stato trovato, è vuoto, o questo mix è privato.", + "mixName" => "Nome Mix", + "mixDescription" => "Descrizione Mix", + "mixLength" => "Miscela Lunghezza", + "mixGenre" => "Miscelare Genere", + "view" => "Visualizza", + "mixname" => "Nome Mix", + "search" => "Cerca", + "searchResults" => "Risultati Della Ricerca", + "searchResultsFor" => "Risultati della ricerca per", + "searchResultsFound" => "Risultati Di Ricerca Trovati", + +]; \ No newline at end of file diff --git a/locale/ru_RU/messages.php b/locale/ru_RU/messages.php new file mode 100644 index 0000000..e64753b --- /dev/null +++ b/locale/ru_RU/messages.php @@ -0,0 +1,37 @@ + 'Добро пожаловать на наш сайт!', + 'description' => 'Это описание на английском языке.', + 'userProfile' => "Профиль пользователя", + 'user' => 'Пользователь', + 'home' => 'Домашний', + 'djName' => 'Имя DJ', + 'email' => 'Почта', + 'location' => 'Местоположение', + 'bio' => 'Био', + 'submit' => 'Отправить', + 'login' => 'Логин', + 'message' => 'Сообщение', + 'follow' => 'Подписаться', + 'djs' => 'DJ', + "djNotFound" => "Не удалось загрузить DJ; либо DJ не найден или этот DJ является приватным.", + "notfound" => "Страница не найдена", + "genre" => "Жанр", + "genres" => "Жанры", + "genreNotFound" => "Не удалось загрузить жанр; либо жанр не найден, был пуст, или этот жанр является приватным.", + "mix-count" => "Кол-во миксов", + "mixes" => "Миксы", + "mix" => "Микс", + "mixNotFound" => "Не удалось загрузить смесь; либо смесь не найдена, либо эта смесь является приватной.", + "mixName" => "Название микса", + "mixDescription" => "Описание смеси", + "mixLength" => "Длина микса", + "mixGenre" => "Смешанный жанр", + "view" => "Вид", + "mixname" => "Название микса", + "search" => "Искать", + "searchResults" => "Результаты поиска", + "searchResultsFor" => "Результаты поиска для", + "searchResultsFound" => "Найдены результаты поиска", + +]; \ No newline at end of file diff --git a/locale/uk_UA/messages.php b/locale/uk_UA/messages.php new file mode 100644 index 0000000..7a7dee2 --- /dev/null +++ b/locale/uk_UA/messages.php @@ -0,0 +1,37 @@ + 'Ласкаво просимо на наш сайт!', + 'description' => 'Це опис англійською.', + 'userProfile' => "Профіль користувача", + 'user' => 'Користувач', + 'home' => 'Домашній екран', + 'djName' => 'Ім\'я DJ', + 'email' => 'Ел. пошта', + 'location' => 'Місцезнаходження', + 'bio' => 'Біо', + 'submit' => 'Ввести', + 'login' => 'Логін', + 'message' => 'Повідомлення', + 'follow' => 'Слідкувати', + 'djs' => 'Діс', + "djNotFound" => "Не можливо завантажити DJ; або DJ не знайдено, або цей DJ — приватний.", + "notfound" => "Сторінка не знайдена", + "genre" => "Жанр", + "genres" => "Genres", + "genreNotFound" => "Не вдалося завантажити жанр, або жанр не було знайдено, було порожнім, або цей жанр є приватним.", + "mix-count" => "Лічильник міксів", + "mixes" => "Змішати", + "mix" => "Змішати", + "mixNotFound" => "Не вдалось завантажити мікс; або суміш не знайдена, була порожня, або ця суміш приватна.", + "mixName" => "Змішане ім'я", + "mixDescription" => "Змішати опис", + "mixLength" => "Довжина мікса", + "mixGenre" => "Мікс-жанр", + "view" => "Дивитись", + "mixname" => "Змішане ім'я", + "search" => "Пошук", + "searchResults" => "Результати пошуку", + "searchResultsFor" => "Результати пошуку для", + "searchResultsFound" => "Результати пошуку знайдено", + +]; \ No newline at end of file diff --git a/mix.php b/mix.php index c5697e7..1a037ae 100644 --- a/mix.php +++ b/mix.php @@ -9,9 +9,7 @@ require_once 'classes/Mix.php'; use Yosymfony\Toml\Toml; $config = Toml::ParseFile('includes/config.toml'); -$lang = $_SESSION['lang'] ?? $config['app']['locale']; -$locale = loadLocale($lang); -// if there's a query parameter named 'dj', load the Mix class +require_once 'includes/lang_loader.php';// if there's a query parameter named 'dj', load the Mix class $db = new Database($config); $mixFound = false; if (isset($_GET['mix']) && $_GET['mix'] != "") { @@ -24,15 +22,10 @@ if (isset($_GET['mix']) && $_GET['mix'] != "") { ?> - + - - - <?php echo $config['app']['name']; ?> - - - - + @@ -237,6 +230,6 @@ if (isset($_GET['mix']) && $_GET['mix'] != "") { - + \ No newline at end of file diff --git a/navbar.php b/navbar.php index 94f792a..65a9132 100644 --- a/navbar.php +++ b/navbar.php @@ -21,19 +21,57 @@ if (basename($_SERVER['SCRIPT_NAME']) == 'index.php') { echo current_list(); } - ?>" href="/">Home + ?>" href="/"> + "English", "es_ES" => "Spanish", "fr_FR" => "French", "de_DE" => "German", "it_IT" => "Italian", "ru_RU" => "Russian", "uk_UA" => "Ukrainian", "fil_PH" => "Filipino"]; + + if (isset($_SESSION['lang'])) { + $current_lang = $_SESSION['lang']; + } else { + $current_lang = $config['app']['locale']; + } + + ?> + + ' . $locale['userProfile'] . ''; + } else { + echo '' . $locale['login'] . ''; + } + + + ?> +