Skip to content
This repository has been archived by the owner on Apr 15, 2022. It is now read-only.

Commit

Permalink
Merge pull request #10 from mikojimnz/dev-miko
Browse files Browse the repository at this point in the history
Implement page translations
  • Loading branch information
mikojimnz authored Nov 3, 2021
2 parents e232ce7 + e0a9203 commit a12dfb8
Show file tree
Hide file tree
Showing 13 changed files with 1,041 additions and 29 deletions.
Binary file modified .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributing

To contribute to this project, please check out the `dev` branch for the latest commits.
To contribute to this project, please check out the `main` branch for the latest stable release. Please name your branch `dev-YOURNAME` or `dev-YOURNAME-PROJECT`.

Make a pull request when you are finished with a description of what was changed. Please tag all the relevant issues assign relevant project tasks and milestones.

Expand Down
2 changes: 1 addition & 1 deletion app/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -128,5 +128,5 @@ <h5>October 29</h5>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.7/js/tether.min.js" integrity="sha384-CPFFlrdhp9pDDCqRqdTKNZ5oAHsnfnvHGt0CsRIeL5Gc7V/OkP1Y4w8zTxlV3mat" crossorigin="anonymous"></script>
<script src="https://cdn.ucf.edu/athena-framework/v1.1.0/js/framework.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/js-cookie@3.0.1/dist/js.cookie.min.js"></script>
<script src="../scripts/app.js"></script>
<script src="../scripts/accessibility.js"></script>
</html>
14 changes: 8 additions & 6 deletions app/preferences.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ <h4 class="pt-4">Emergency Notifications</h4>
<p>Emergency alerts and notifications.</p>
<button type="button" class="btn btn-success btn-toggle">Enabled</button>
<h4 class="pt-4">News & Events</h4>
<p>Calender alerts, new events.</p>
<p>Calendar alerts, new events.</p>
<button type="button" class="btn btn-success btn-toggle">Enabled</button>
<h4 class="pt-4">Transit Notifications</h4>
<p>Parking, travel time.</p>
Expand All @@ -111,10 +111,10 @@ <h2 class="heading-underline">Language Preferences</h2>
Change Language
</button>
<div class="dropdown-menu" aria-labelledby="dropdownLanguage">
<a class="dropdown-item" href="#">English</a>
<a class="dropdown-item" href="#">Spanish</a>
<a class="dropdown-item" href="#">French</a>
<a class="dropdown-item" href="#">German</a>
<a class="dropdown-item" href="#" id="lang_en">English</a>
<a class="dropdown-item" href="#" id="lang_es">Español</a>
<a class="dropdown-item" href="#" id="lang_fr">François</a>
<a class="dropdown-item" href="#" id="lang_de">Deutsch</a>
</div>
</div>
</div>
Expand Down Expand Up @@ -166,5 +166,7 @@ <h4 class="pt-4">Dark Mode</h4>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.7/js/tether.min.js" integrity="sha384-CPFFlrdhp9pDDCqRqdTKNZ5oAHsnfnvHGt0CsRIeL5Gc7V/OkP1Y4w8zTxlV3mat" crossorigin="anonymous"></script>
<script src="https://cdn.ucf.edu/athena-framework/v1.1.0/js/framework.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/js-cookie@3.0.1/dist/js.cookie.min.js"></script>
<script src="../scripts/app.js"></script>
<script src="../locales/preferences.js"></script>
<script src="../scripts/lingumania.js"></script>
<script src="../scripts/accessibility.js"></script>
</html>
10 changes: 7 additions & 3 deletions css/styles.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion css/styles.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions css/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ footer {
/* Dark Mode Stylings */

.darkmode, .fas.darkmode {
color: white;
color: $darkModeText;
}

.alert-warning.darkmode {
Expand All @@ -149,9 +149,14 @@ footer {
}

.btn.darkmode {
background-color: black;
background-color: $darkModeBackground;
}

.dropdown-menu.darkmode {
background-color: $darkModeBackground;
border: 1px solid #b3b3b3;
}

body.darkmode {
background-color: black;
background-color: $darkModeBackground;
}
3 changes: 3 additions & 0 deletions css/variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ $brightGold: rgba(255,202,6,1);
$brightGold50: rgba(255,202,6,0.5);
$brightGold25: rgba(255,202,6,0.25);

$darkModeBackground: #000000;
$darkModeText: #ffffff;

$breakpoint-mobile: 1000px;
154 changes: 154 additions & 0 deletions locales/preferences.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
var linguJSON = {
"custom_lang_switcher_container_id": "#lingumania",
"languages": [
{
"lang_name": "English",
"lang_code": "en",
"url_pattern": "?"
},
{
"lang_name": "Español",
"lang_code": "es",
"url_pattern": "?"
},
{
"lang_name": "François",
"lang_code": "fr",
"url_pattern": "?"
},
{
"lang_name": "Deutsch",
"lang_code": "de",
"url_pattern": "?"
}
],
"translated_segments": [
{
"source": "Preferences",
"target_es": "Preferencias",
"target_fr": "Préférences",
"target_de": "Einstellungen"
},
{
"source": "Change Campus",
"target_es": "Cambiar campus",
"target_fr": "Changer de campus",
"target_de": "Campus wechseln"
},
{
"source": "Select Campus",
"target_es": "Seleccionar campus",
"target_fr": "Sélectionnez le campus",
"target_de": "Campus auswählen"
},
{
"source": "Location Preferences",
"target_es": "Preferencias de ubicación",
"target_fr": "Préférences d'emplacement",
"target_de": "Standorteinstellungen"
},
{
"source": "Allow location services.",
"target_es": "Permitir servicios de ubicación.",
"target_fr": "Autoriser les services de localisation.",
"target_de": "Ortungsdienste zulassen."
},
{
"source": "Notification Preferences",
"target_es": "Preferencias de notificación",
"target_fr": "Préférences de notification",
"target_de": "Benachrichtigungseinstellungen"
},
{
"source": "Emergency Notifications",
"target_es": "Notificaciones de emergencia",
"target_fr": "Notifications d'urgence",
"target_de": "Notfallbenachrichtigungen"
},
{
"source": "Emergency alerts and notifications.",
"target_es": "Alertas y notificaciones de emergencia.",
"target_fr": "Alertes et notifications d'urgence.",
"target_de": "Notfallwarnungen und Benachrichtigungen."
},
{
"source": "News & Events",
"target_es": "Noticias y Eventos",
"target_fr": "Nouvelles et événements",
"target_de": "Neuigkeiten und Veranstaltungen"
},
{
"source": "Calendar alerts, new events.",
"target_es": "Alertas de calendario, nuevos eventos.",
"target_fr": "Alertes de calendrier, nouveaux événements.",
"target_de": "Kalenderbenachrichtigungen, neue Ereignisse."
},
{
"source": "Parking, travel time.",
"target_es": "Aparcamiento, tiempo de viaje.",
"target_fr": "Stationnement, temps de trajet.",
"target_de": "Parking, travel time."
},
{
"source": "Language Preferences",
"target_es": "Preferencias de idioma",
"target_fr": "Préférences de langue",
"target_de": "Sprache ändern"
},{
"source": "Change Language",
"target_es": "Cambiar idioma",
"target_fr": "Changer de langue",
"target_de": ""
},
{
"source": "Accessibility",
"target_es": "Accesibilidad",
"target_fr": "Accessibilité",
"target_de": "Barrierefreiheit"
},
{
"source": "Smaller",
"target_es": "Mas pequeño",
"target_fr": "Plus petite",
"target_de": "Smaller"
},
{
"source": "Normal",
"target_es": "Normal",
"target_fr": "Normal",
"target_de": "Normal"
},
{
"source": "Larger",
"target_es": "Más grande",
"target_fr": "Plus grand",
"target_de": "Farben mit hohem Kontrast"
},
{
"source": "High Contrast Colors",
"target_es": "Colores de alto contraste",
"target_fr": "Couleurs à contraste élevé",
"target_de": ""
},
{
"source": "Dark Mode",
"target_es": "Modo oscuro",
"target_fr": "Mode sombre",
"target_de": "Dunkler Modus"
},
{
"source": "Enabled",
"target_es": "Activado",
"target_fr": "Activé",
"target_de": "Ermöglicht"
},
{
"source": "Disabled",
"target_es": "Discapacitado",
"target_fr": "Désactivé",
"target_de": "Behinderte"
}

]
};

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dig4104c",
"version": "0.2.0",
"version": "0.3.0",
"description": "UCF Mobile App Prototype",
"main": "index.html",
"scripts": {
Expand Down
61 changes: 50 additions & 11 deletions scripts/app.js → scripts/accessibility.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
let ui_locales = {
"Enabled":
{
"en": "Enabled",
"es": "Activado",
"fr": "Activé",
"de": "Ermöglicht"
},
"Disabled": {
"en": "Disabled",
"es": "Discapacitado",
"fr": "Désactivé",
"de": "Behinderte"
}
}

/* Get font size based on preferences */
function setFontSize() {
let accessibleText = "a, button:not('.text-size-toggle'), h1, h2, h3, h4, h5, h6, p";
Expand Down Expand Up @@ -44,18 +60,18 @@ function setFontSize() {

/* Get dark mode based on preferences */
function setDarkMode() {
let accessibleElements = "a, body, button, h1, h2, h3, h4, h5, h6, .alert, .fas";
let accessibleElements = "a, body, button, h1, h2, h3, h4, h5, h6, .alert, .dropdown-menu, .fas";

if(Cookies.get('darkMode') == "true") {
$("#dark-mode-toggle").addClass("btn-success");
$("#dark-mode-toggle").removeClass("btn-default");
$("#dark-mode-toggle").text("Enabled");
$("#dark-mode-toggle").text(ui_locales['Enabled'][Cookies.get('lang')]);

$(accessibleElements).addClass("darkmode");
} else {
$("#dark-mode-toggle").addClass("btn-default");
$("#dark-mode-toggle").removeClass("btn-success");
$("#dark-mode-toggle").text("Disabled");
$("#dark-mode-toggle").text(ui_locales['Disabled'][Cookies.get('lang')]);

$(accessibleElements).removeClass("darkmode");
}
Expand All @@ -64,13 +80,11 @@ function setDarkMode() {
/* Toggle clickable buttons */
$(".btn-toggle").on("click", function(){
if ($(this).hasClass("btn-success")) {
$(this).addClass("btn-default");
$(this).removeClass("btn-success");
$(this).text("Disabled");
$(this).toggleClass("btn-default btn-success");
$(this).text(ui_locales['Disabled'][Cookies.get('lang')]);
} else {
$(this).addClass("btn-success");
$(this).removeClass("btn-default");
$(this).text("Enabled");
$(this).toggleClass("btn-default btn-success");
$(this).text(ui_locales['Enabled'][Cookies.get('lang')]);
}
});

Expand Down Expand Up @@ -99,5 +113,30 @@ $("#dark-mode-toggle").on("click", function() {
}
});

setFontSize()
setDarkMode();
/* Set language preferences */
$("#lang_en").on("click", function() {
Cookies.set('lang', 'en');
location.reload();
});
$("#lang_es").on("click", function() {
Cookies.set('lang', 'es');
location.reload();
});
$("#lang_fr").on("click", function() {
Cookies.set('lang', 'fr');
location.reload();
});
$("#lang_de").on("click", function() {
Cookies.set('lang', 'de');
location.reload();
});

/* Initalize accessibility features */
setFontSize();
setDarkMode();

/* Default cookies */
$(window).on("load", function() {
if (Cookies.get('lang') == undefined)
Cookies.set('lang', 'en');
});
Loading

0 comments on commit a12dfb8

Please sign in to comment.