Skip to content

Commit

Permalink
added other languages, updated spanish lang, and added machine transl…
Browse files Browse the repository at this point in the history
…ation script using DeepL
  • Loading branch information
wisplite committed Jan 8, 2025
1 parent 64a05a6 commit 653eef3
Show file tree
Hide file tree
Showing 10 changed files with 3,404 additions and 2,703 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ yarn-error.*

# local env files
.env*.local

.env
# typescript
*.tsbuildinfo
58 changes: 39 additions & 19 deletions components/Lang.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,51 @@
import React, { createContext, useContext, useEffect, useState } from 'react';
import AsyncStorage from "@react-native-async-storage/async-storage";
const en_us = require('../lang/en_us.json');
const es_es = require('../lang/es_es.json');
const en_us = require('../lang/EN.json');
const es_es = require('../lang/ES.json');
const de_de = require('../lang/DE.json');
const tr_tr = require('../lang/TR.json');

const LangContext = createContext();

export const useLang = () => useContext(LangContext);

const defaultLang = 'en_us';
const defaultLang = 'EN';

export const LangProvider = ({ children }) => {
const allLangs = ['English', 'Español', 'Deutsch', 'Türkçe'];
const allLangCodes = ['en_us', 'es_es', 'de_de', 'tr_tr'];
const allLangCodes = ['EN', 'ES', 'DE', 'TR'];
const [Lang, setLang] = useState(en_us);
const [langList, setLangList] = useState(['English', 'Español', 'Deutsch', 'Türkçe']);
const [langCodes, setLangCodes] = useState(['en_us', 'es_es', 'de_de', 'tr_tr']);
const [langCodes, setLangCodes] = useState(['EN', 'ES', 'DE', 'TR']);
const [currentLang, setCurrentLang] = useState('English');
const [currentLangCode, setCurrentLangCode] = useState('en_us');
const [currentLangCode, setCurrentLangCode] = useState('EN');

// loads the preferred language from AsyncStorage to make it persistent across app restarts
async function loadLang() {
try {
const userLang = await AsyncStorage.getItem('lang');
console.log(userLang)
if (userLang !== null) {
if (userLang == "en_us") {
if (userLang == "EN") {
setLang(en_us);
setCurrentLang('English');
setCurrentLangCode('en_us');
} else if (userLang == "es_es") {
setCurrentLangCode('EN');
} else if (userLang == "ES") {
setLang(es_es);
setCurrentLang('Español');
setCurrentLangCode('es_es');
setCurrentLangCode('ES');
} else if (userLang == "DE") {
setLang(de_de);
setCurrentLang('Deutsch');
setCurrentLangCode('DE');
} else if (userLang == "TR") {
setLang(tr_tr);
setCurrentLang('Türkçe');
setCurrentLangCode('TR');
} else {
setLang(en_us);
setCurrentLang('English');
setCurrentLangCode('en_us');
setCurrentLangCode('EN');
}
} else {
setLang(en_us);
Expand All @@ -50,22 +60,32 @@ export const LangProvider = ({ children }) => {
// switches the language and saves it to AsyncStorage
function switchLang(lang) {
console.log(lang)
if (lang == "en_us") {
if (lang == "EN") {
setLang(en_us);
setCurrentLang('English');
setCurrentLangCode('en_us');
AsyncStorage.setItem('lang', "en_us");
} else if (lang == "es_es") {
setCurrentLangCode('EN');
AsyncStorage.setItem('lang', "EN");
} else if (lang == "ES") {
setLang(es_es);
setCurrentLang('Español');
setCurrentLangCode('es_es');
AsyncStorage.setItem('lang', "es_es");
setCurrentLangCode('ES');
AsyncStorage.setItem('lang', "ES");
} else if (lang == "DE") {
setLang(de_de);
setCurrentLang('Deutsch');
setCurrentLangCode('DE');
AsyncStorage.setItem('lang', "DE");
} else if (lang == "TR") {
setLang(tr_tr);
setCurrentLang('Türkçe');
setCurrentLangCode('TR');
AsyncStorage.setItem('lang', "TR");
} else {
// Assumes English as the default because it is by far the most spoken language in FIRST
setLang(en_us);
setCurrentLang('English');
setCurrentLangCode('en_us');
AsyncStorage.setItem('lang', "en_us");
setCurrentLangCode('EN');
AsyncStorage.setItem('lang', "EN");
}
}

Expand Down
102 changes: 102 additions & 0 deletions lang/DE.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
{
"start_page": {
"start_title": "Rekon",
"start_tagline": "Scouting \\\\\n redifend",
"sign_up_button": "Anmeldung",
"sign_in_button": "Einloggen"
},
"sign_up": {
"title": "Anmeldung",
"email": "E-Mail",
"password": "Passwort",
"confirm_password": "Bestätigen Sie Ihr Passwort",
"already_have_account": "Sie haben bereits ein Konto?",
"log_in": "Einloggen",
"email_taken": "E-Mail ist bereits vergeben",
"password_mismatch": "Passwörter stimmen nicht überein"
},
"log_in": {
"title": "Einloggen",
"email": "E-Mail",
"password": "Passwort",
"no_account": "Sie haben noch kein Konto?",
"sign_up": "Anmeldung",
"incorrect_credentials": "Falsche E-Mail oder falsches Passwort",
"invalid_email": "Ungültige E-Mail"
},
"verification": {
"title": "Überprüfung",
"resend": "E-Mail erneut senden",
"email_sent": "Email sent:",
"enter_code": "Geben Sie den 6-stelligen Verifizierungscode ein:"
},
"welcome": {
"title": "Herzlich willkommen!",
"subtitle": "Lassen Sie uns Ihr Profil einrichten.",
"profile_picture": "Profilbild",
"next": "Weiter",
"name": "Name",
"team": "Team #",
"bio": "Bio"
},
"join_team": {
"title": "Einem Team beitreten",
"scan_qr": "QR scannen",
"code": "Enter Code",
"or": "Oder",
"create_team": "Team erstellen"
},
"admin_home_match": {
"title": "Verwaltung",
"scouting_overview": "Scouting-Übersicht",
"match": "Spiel",
"pit": "Grube",
"current_match": "Aktuelles Spiel:",
"scout": "Pfadfinder",
"team": "Team",
"subjective": "Subjektiv",
"matches": "Spielt:",
"show_all": "Alle anzeigen"
},
"admin_home_pit": {
"title": "Verwaltung",
"scouting_overview": "Scouting-Übersicht",
"match": "Spiel",
"pit": "Grube",
"teams_scouted": "Ausgekundschaftete Teams",
"completed": "Abgeschlossen",
"uncompleted": "Unvollendete",
"teammates": "Teamkollegen",
"teams_left": "Mannschaften links:"
},
"match_assignments": {
"title": "Spiel-Zuweisungen"
},
"hamburger_menu": {
"scout_mode": "Scout Mode",
"admin_mode": "Verwaltungsmodus",
"overview": "Übersicht",
"team_profile": "Team-Profil",
"teammates": "Teamkollegen",
"forms": "Formulare",
"events": "Veranstaltungen",
"sync_data": "Sync Data",
"settings": "Einstellungen"
},
"teammates": {
"title": "Teamkollegen",
"scouts": "Pfadfinder",
"admins": "Admins"
},
"assign_teammates": {
"title": "zuweisen",
"form_uploads": "Formular-Uploads",
"settings": "Einstellungen",
"subjective_scouts": "Subjektive Scouts:",
"manual_assign": "Manuell zuweisen",
"equally_distribute": "Gleichmäßig verteilen",
"match": "Spiel",
"pit": "Grube",
"subjective": "Subjektiv"
}
}
File renamed without changes.
102 changes: 102 additions & 0 deletions lang/ES.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
{
"start_page": {
"start_title": "Rekon",
"start_tagline": "exploración\n redifender",
"sign_up_button": "Inscribirse",
"sign_in_button": "Iniciar sesión"
},
"sign_up": {
"title": "Inscribirse",
"email": "Correo electrónico",
"password": "Contraseña",
"confirm_password": "Confirmar contraseña",
"already_have_account": "¿Ya tiene una cuenta?",
"log_in": "Iniciar sesión",
"email_taken": "El correo electrónico ya está ocupado",
"password_mismatch": "Las contraseñas no coinciden"
},
"log_in": {
"title": "Iniciar sesión",
"email": "Correo electrónico",
"password": "Contraseña",
"no_account": "¿No tiene cuenta?",
"sign_up": "Inscribirse",
"incorrect_credentials": "Correo electrónico o contraseña incorrectos",
"invalid_email": "Correo electrónico no válido"
},
"verification": {
"title": "Verificación",
"resend": "Reenviar correo electrónico",
"email_sent": "Correo electrónico enviado:",
"enter_code": "Introduzca el código de verificación de 6 dígitos:"
},
"welcome": {
"title": "Bienvenido.",
"subtitle": "Vamos a configurar tu perfil.",
"profile_picture": "Foto de perfil",
"next": "Siguiente",
"name": "Nombre",
"team": "Equipo",
"bio": "Bio"
},
"join_team": {
"title": "Únete a un equipo",
"scan_qr": "Escanear QR",
"code": "Introduzca el código",
"or": "O",
"create_team": "Crear equipo"
},
"admin_home_match": {
"title": "Admin",
"scouting_overview": "Visión general de la exploración",
"match": "Partido",
"pit": "Foso",
"current_match": "Partido actual:",
"scout": "Scout",
"team": "Equipo",
"subjective": "Subjetivo",
"matches": "Partidos:",
"show_all": "Mostrar todo"
},
"admin_home_pit": {
"title": "Admin",
"scouting_overview": "Visión general de la exploración",
"match": "Partido",
"pit": "Foso",
"teams_scouted": "Equipos explorados",
"completed": "Completado",
"uncompleted": "Sin terminar",
"teammates": "Compañeros de equipo",
"teams_left": "Equipos a la izquierda:"
},
"match_assignments": {
"title": "Asignación de partidos"
},
"hamburger_menu": {
"scout_mode": "Modo Explorador",
"admin_mode": "Modo Admin",
"overview": "Visión general",
"team_profile": "Perfil del equipo",
"teammates": "Compañeros de equipo",
"forms": "Formularios",
"events": "Eventos",
"sync_data": "Sincronizar datos",
"settings": "Ajustes"
},
"teammates": {
"title": "Compañeros de equipo",
"scouts": "Scouts",
"admins": "Admins"
},
"assign_teammates": {
"title": "Asignar",
"form_uploads": "Carga de formularios",
"settings": "Ajustes",
"subjective_scouts": "Exploradores subjetivos:",
"manual_assign": "Asignación manual",
"equally_distribute": "Distribuir equitativamente",
"match": "Partido",
"pit": "Foso",
"subjective": "Subjetivo"
}
}
Loading

0 comments on commit 653eef3

Please sign in to comment.