diff --git a/funciones/traducciones/traduccion_lvl2.json b/funciones/traducciones/traduccion_lvl2.json new file mode 100644 index 0000000..42f1f6e --- /dev/null +++ b/funciones/traducciones/traduccion_lvl2.json @@ -0,0 +1,94 @@ +{ + "home": { + "title": "The place where every journey begins", + "joinUs": "Join the biggest travel community, created by and for travelers.", + "beFast": "Be one of the first to register and get hundreds of prizes", + "registerNow": "Register Now", + "titleFirstItem": "Travel as a local", + "descriptionFirstItem": "You will be able to follow the routes of local people that will allow you to discover secrets and less touristic places of the city. You can also create your own routes and share them.", + "titleSecondItem": "Meet people like you", + "descriptionSecondItem": "A community of travelers with the same concerns as you. People who are excited about the next experience. You can now share your passion without limitations.", + "titleThirdItem": "Become an expert", + "descriptionThirdItem": "As a community of travelers, contributions are rewarded. The more routes you climb and the more you participate, the more points you get and therefore the better the benefits.", + "lastRoutes": "Last routes" + }, + "buttons": { + "close": "Close", + "login": "Login", + "register": "Sign in", + "loginFB": "Login with Facebook", + "loginGoogle": "Login with Google", + "loginMail": "Login with your Mail", + "back": "Back", + "enter": "Enter", + "signOut": "Sign Out", + "exit": "Exit", + "createRoute": "Create Route", + "submit": "Submit", + "AvatarChange": "Change Avatar", + "myProfile": "My Profile", + "community": "Community" + }, + "dialogs": { + "description": { + "login": "Access to goTripland with your account", + "register": "Register to access to goTripland" + } + }, + "forms": { + "privatePolicyAndTermsIntro": "By continuing, you confirm your agreement with our ", + "privatePolicy": "Privacy policy", + "useTerms": "Terms of use", + "and": "and", + "login": { + "mail": "E-mail", + "password": "Password", + "forgotPassword": "Did you forgot your password?", + "FBGoogleBack": "Would you like to login with Facebook or Google?", + "enterMail": "Enter your mail" + }, + "register": { + "username": "Username", + "gender": "Gender", + "male": "Male", + "female": "Female", + "selectGender": "Select gender", + "codeSent": "A confirmation code has been sent to your email. This may take a few minutes.", + "verify": "Verify", + "waitnPress": "If after a few minutes you still do not receive the verification code. Click on", + "askAgain": "to request the code again.", + "register": "Register" + } + }, + "alerts": { + "validMail": "Enter a valid email.", + "validPassword": "The minimum password size is 8 characters", + "mailTaken": "Oops! Looks like this account is already registered in the system. Try logging in or retrieving your password.", + "shortNickname": "Enter a username of at least 3 characters." + }, + "helpers": { + "hereMinus": "here" + }, + "user": { + "community": "Comunidad" + }, + "passport": { + "title": "Pasaporte", + "myProfile": "My Profile", + "nickname": "Nickname", + "name": "Name", + "surname": "Surname", + "birthday": "Birthday", + "gender": "Gender", + "male": "Male", + "female": "Female", + "country": "Country", + "location": "Location", + "description": "Description", + "email": "Email", + "validation": { + "shortNickname": "Too short" + } + } +} + diff --git a/funciones/traducciones/traductor.js b/funciones/traducciones/traductor.js index 8b8fa22..bbf1880 100644 --- a/funciones/traducciones/traductor.js +++ b/funciones/traducciones/traductor.js @@ -1,23 +1,43 @@ -const deepl = require('deepl-node'); +const deepl = require("deepl-node"); -const authKey = "9d607fdb-762b-fe7a-2e55-d8b23bbc18a4:fx"; // Replace with your key +const authKey = "92766a66-fa2a-b1c6-d7dd-ec0750322229:fx"; // Replace with your key const translator = new deepl.Translator(authKey); -const { writeFileSync, readFileSync } = require('fs'); -let data = readFileSync('translation.json'); -let traducciones = JSON.parse(data) - - -data = Object.entries(traducciones).map(entrada => { - (async () => { - const result = await translator.translateText(entrada[1], null, 'en-GB'); - traducciones[entrada[0]] = result.text - })().then(() => writeFileSync('translation-es.json', JSON.stringify(traducciones))); - -}) - - +const { writeFileSync, readFileSync } = require("fs"); +let data = readFileSync("traduccion_lvl2.json"); +let traducciones = JSON.parse(data); + +data = Object.entries(traducciones).map((entrada) => { + let clave = entrada[0]; + let valor = entrada[1]; + + if (traducciones[clave] instanceof String) { + traducir(valor) + .then((cadenaTraducida) => (traducciones[clave] = cadenaTraducida)) + .then(() => + writeFileSync("translation-es.json", JSON.stringify(traducciones)) + ); + } else { + DatosNivelDos = traducciones[clave]; + + Object.entries(DatosNivelDos).map((entradaDos) => { + let claveDos = entradaDos[0]; + let valorDos = entradaDos[1]; + + traducir(valorDos) + .then( + (cadenaTraducidaDos) => + (traducciones[clave][claveDos] = cadenaTraducidaDos) + ) + .then(() => + writeFileSync("translation-es.json", JSON.stringify(traducciones)) + ); + }); + } +}); //https://www.npmjs.com/package/deepl-node - - +async function traducir(cadena) { + const result = await translator.translateText(cadena, null, "ES"); + return result.text; +} diff --git a/funciones/traducciones/translation-es.json b/funciones/traducciones/translation-es.json index 5eb11e2..e500748 100644 --- a/funciones/traducciones/translation-es.json +++ b/funciones/traducciones/translation-es.json @@ -1,5 +1 @@ -{ - "trivial": "Trivia in English", - "bienvenido": "Welcome", - "puntuacion": "Your score is: {{score}}" -} \ No newline at end of file +{"home":{"title":"El lugar donde comienza todo viaje","joinUs":"Únase a la mayor comunidad de viajeros, creada por y para los viajeros.","beFast":"Sea uno de los primeros en inscribirse y consiga cientos de premios","registerNow":"Regístrese ahora","titleFirstItem":"Viajar como un local","descriptionFirstItem":"Podrás seguir las rutas de la gente local que te permitirán descubrir secretos y lugares menos turísticos de la ciudad. También puedes crear tus propias rutas y compartirlas.","titleSecondItem":"Conoce a gente como tú","descriptionSecondItem":"Una comunidad de viajeros con las mismas inquietudes que tú. Personas que se ilusionan con la próxima experiencia. Ahora puedes compartir tu pasión sin limitaciones.","titleThirdItem":"Conviértase en un experto","descriptionThirdItem":"Como comunidad de viajeros, las contribuciones son recompensadas. Cuantas más rutas subas y más participes, más puntos obtendrás y, por tanto, mejores serán los beneficios.","lastRoutes":"Últimas rutas"},"buttons":{"close":"Cerrar","login":"Inicio de sesión","register":"Acceder","loginFB":"Iniciar sesión con Facebook","loginGoogle":"Iniciar sesión con Google","loginMail":"Inicie sesión con su correo electrónico","back":"Volver","enter":"Entre en","signOut":"Firmar la salida","exit":"Salida","createRoute":"Crear ruta","submit":"Enviar","AvatarChange":"Cambiar el avatar","myProfile":"Mi perfil","community":"Comunidad"}} \ No newline at end of file diff --git a/funciones/traducciones/translation.json b/funciones/traducciones/translation.json deleted file mode 100644 index e3c8564..0000000 --- a/funciones/traducciones/translation.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "trivial":"Trivial en Ingles", - "bienvenido":"Bienvenido", - "puntuacion":"Su puntuación es: {{puntuacion}}" - -} \ No newline at end of file