ENGLISH = "eng"
SPANISH = "spa"

"""
general
"""

language_name_english = {
    ENGLISH: "English",
    SPANISH: "Inglés"
}

language_name_spanish = {
    ENGLISH: "Spanish",
    SPANISH: "Español"
}

language_name_basque = {
    ENGLISH: "Basque",
    SPANISH: "Euskera"
}

language_name_maltese = {
    ENGLISH: "Maltese",
    SPANISH: "Maltés"
}

"""
frontpage
"""
welcome_title = {
    ENGLISH: "Welcome!",
    SPANISH: "Bienvenido(a)!",
}

welcome_subtitle = {
    ENGLISH: "A campaign for evaluation of translations",
    SPANISH: "Una campaña de evaluación de traducciones"
}

onboarding_panel_title = {
    ENGLISH: "The campaign",
    SPANISH: "La campaña"
}

onboarding_text = {
    ENGLISH: """
    <p>Int kelliem bilingwi tal-Malti u l-Ingliż, jew l-Ispanjol u l-Bask? Jekk iva, għandna bżonn l-għajnuna tiegħek!</p>
    <p>Aħna riċerkaturi mill-Università ta’ Malta (UM) u mill-Università tal-Pajjiż Bask (UPV/EHU), u qed nagħmlu dan l-istudju sabiex nevalwaw il-kwalità tat-traduzzjonijiet f’żewġ lingwi li ma tantx għandom riżorsi, il-Malti u l-Bask. It-traduzzjoni mhix biċċa xogħol faċli, għalhekk nixtiequ nisimgħu mingħandek: jekk tixtieq tipparteċipa, se nuruk xi sentenzi u nitolbuk tagħtijhom punteġġ, u dan jgħinna ħafna fir-riċerka tagħna biex intejbuhom fil-futur.</p>
    <p>Jekk trid taqra aktar u tipprova, kompli u oħloq profil — mhux se nitolbuk l-ebda informazzjoni privata, sempliċement għidilna liema lingwi titkellem u inti tista’ tibda!</p>
    <hr class="ui-lang-divider" />
    <p>Are you a bilingual speaker of Maltese and English, or Spanish and Basque? If so, we need your help!</p>
    <p>We are researchers from the University of Malta (UM) and from the University of the Basque Country (UPV/EHU), and we are conducting this study in order to evaluate the quality of translations into two under-resourced languages, Maltese and Basque. Translation is not an easy task, so we would like to hear from you: if you wish to participate, we will show you some sentences and ask you to rate the translations, and that would help us a lot with our research to improve them in the future.</p>
    <p>If you want to read more and try it out, go on and create a profile — we won’t ask you for any private information, just tell us what languages you speak and you’re good to go!</p>
    """,
    SPANISH: """
    <p>Euskara eta gaztelania, edo maltera eta ingelesa hitz egiten dituzu? Horrela bada, zure laguntza behar dugu!</p>
    <p>Euskal Herriko Unibertsitateko (UPV/EHU) eta Maltako Unibertsitateko (UM) ikertzaileak gara, eta baliabide urriko hizkuntzetara egindako itzulpenen kalitatearen ebaluazioan dihardugu lanean, zehazki euskararako eta malterarako. Itzultzea ez da lan erraza. Hortaz, zure laguntza eske gatoz: parte hartuz gero, esaldi batzuk erakutsiko dizkizugu eta itzulpenak balioztatzeko eskatu. Horrek lagunduko digu etorkizunean itzulpenen kalitatea hobetzen.</p>
    <p>Gure ekimenaz gehiago jakin nahi baduzu eta ekarpena egin, sortu profil bat. Ez dizugu datu pertsonalik eskatuko; zein hizkuntza hitz egiten duzun bakarrik. Anima zaitez!</p>
    <hr class="ui-lang-divider" />
    <p>¿Hablas euskera y castellano, o maltés e inglés? Si es así, ¡necesitamos tu ayuda!</p>
    <p>Somos investigadores de la Universidad del País Vasco (UPV/EHU) y de la Universidad de Malta (UM), y estamos realizando un estudio para evaluar la calidad de las traducciones a lenguas con pocos recursos, en concreto, al euskera y al maltés. La traducción no es una tarea fácil, por lo que nos gustaría contar con tu participación: te mostraremos unas frases y te pediremos que valores sus traducciones. Eso nos ayudará a mejorar su calidad en el futuro.</p>
    <p>Si quieres saber más sobre esta iniciativa y contribuir a ella, crea tu perfil. No te pediremos datos personales; sólo las lenguas que hablas. ¡Anímate!</p>
    """
}

dashboard_button = {
    ENGLISH: "Access dashboard",
    SPANISH: "Acceder al panel"
}

register_button = {
    ENGLISH: "Register",
    SPANISH: "Registrarse"
}

"""
dashboard
"""

dashboard_title = {
    ENGLISH: "Dashboard",
    SPANISH: "Panel"
}

task_panel_title = {
    ENGLISH: "The task",
    SPANISH: "La tarea"
}

task_panel_text = {
    ENGLISH: """
    <p>Għal kull mistoqsija / prova, se tintwera sentenza oriġinali bl-Ingliż u verzjoni għal traduzzjoni bil-Malti. Imbagħad se tintalab tikklassifika l-kwalità tat-traduzzjoni fuq skala minn 0 sa 100, ibbażat fuq kemm temmen li t-traduzzjoni tesprimi t-tifsira sħiħa tas-sentenza oriġinali. Klassifikazzjoni ta' 100 tfisser li l-verżjoni li qrajt hija traduzzjoni perfetta: tesprimi l-istess ħaġa bħas-sentenza oriġinali, b'mod ċar u korrett. Il-verżjoni għandha tiġi kklassifikata aktar baxxa jekk ikun fiha żbalji grammatikali jew ortografiċi, jekk ikun hemm informazzjoni nieqsa, jekk tinstema' mhux naturali jew stramba, eċċ.</p>
    <p>Aħna se nżommu kull punteġġ li tissottometti, u tista' tevalwa sentenzi kemm trid inti, imma ovvjament, l-aktar ma tagħmel aħjar! Ma tistax tbiddel l-klassifikazzjoni tiegħek wara li ddaħħala, għalhekk jekk jogħġbok, kun żgur/a li taqra sew is-sentenza oriġinali kif ukoll il-verżjoni għat- traduzzjoni qabel ma tiddeċiedi fuq il-punteġġ tiegħek.</p>
    <hr class="ui-lang-divider" />
    <p>For each item, you will be shown an original sentence in English and a translation candidate in Maltese. You will then be asked to rate the quality of the translation on a scale of 0 to 100, based on how well you believe the translation expresses the full meaning of the original sentence. A rating of 100 means that the candidate is a perfect translation: it expresses the same thing as the original sentence, in a clear and correct manner. A candidate should be rated lower if it contains grammatical or orthographic errors, if it's missing information, if it sounds unnatural or weird, and so on.</p>
    <p>We will save every score you submit, and you can do as many sentences as you wish, but of course, the more the merrier! You cannot edit your rating after you submit it, so please, make sure to read both the source sentence and the candidate carefully before you decide on your score.</p>
    """,
    SPANISH: """
    <p>Ebaluazio-unitate bakoitzerako erakutsiko dizkizugu gaztelaniazko jatorrizko esaldia eta euskarazko itzulpen-hautagai bat. Orduan, itzulpenaren kalitatea 0tik 100era bitarteko eskala batean balioztatzeko eskatuko dizugu, itzulpenak jatorrizko esaldiaren esanahia zein neurritan adierazten duen islatzeko. 100eko puntuazioak esan nahi du hautagaia itzulpen perfektua dela, hau da, jatorrizko esaldiak adierazten duen bera islatzen duela, argi eta zuzen. Itzulpen-hautagaiak informazioa falta badu, jatorra ez bada, esamolde arraroak erabiltzen baditu, akats gramatikalak edo ortografikoak baditu, eta abar, puntuazio baxuagoa esleitu beharko diozu.</p>
    <p>Nahi adina esaldi baliozta ditzakezu, eta guk guztien puntuazioak jasoko ditugu, baina, badakizu, zenbat eta gehiago hainbat eta hobeto! Behin balioztatzea eginda, ez da posible izango aldatzea. Beraz, mesedez, irakurri jatorrizko esaldia eta itzulpen-hautagaia arretaz puntuazioa erabaki aurretik.</p>
    <hr class="ui-lang-divider" />
    <p>Para cada unidad de evaluación, te mostraremos la frase original en castellano y una propuesta de traducción al euskera. Después, te pediremos que valores la calidad de la traducción en una escala de 0 a 100 para reflejar en qué medida transmite la traducción el significado de la frase original. Una puntuación de 100 significa que la traducción es perfecta, es decir, que refleja, de manera clara y correcta, el contenido de la frase original. Si en la traducción falta información, si no es fluida, utiliza expresiones que no son naturales, tiene errores gramaticales u ortográficos, etc., deberás asignarle una puntuación inferior.</p>
    <p>Puedes valorar tantas frases como quieras, y nosotros guardaremos todas las puntuaciones que nos proporciones, pero, ya sabes, ¡cuantas más mejor! Una vez enviada la valoración, no será posible modificarla. Por lo tanto, por favor, lee la frase original y la propuesta de traducción detenidamente antes de decidir la puntuación.</p>
    """,
}

task_button_text = {
    ENGLISH: "Go to task",
    SPANISH: "Ir a la tarea"
}

user_status_title = {
    ENGLISH: "User status",
    SPANISH: "Estado de usuario"
}

user_status_unavailable_text = {
    ENGLISH: "Start participating and evaluating translations to be able to see your user status!",
    SPANISH: "¡Empieza a participar y a evaluar traducciones para poder ver tu estado de usuario!"
}

no_tasks_available = {
    ENGLISH: "No tasks available",
    SPANISH: "Ninguna tarea disponible"
}

insufficient_proficiency_text = {
    ENGLISH: """
    <p>Thank you for your interest in participating in our project. However, in order to evaluate the quality of translations between Maltese and English, we are looking for bilingual speakers, who are fluent or near fluent in both languages.</p>
    <p>If you think you made a mistake in the sign up form and you are a fluent/native speaker of both Maltese and English, feel free to sign out and create a new account with the correct information.</p>
    """,
    SPANISH: """
    <p>Gracias por su interés en participar en nuestro proyecto. Sin embargo, para evaluar la calidad de las traducciones entre euskera y castellano, buscamos hablantes bilingües, que dominen o casi dominen ambos idiomas.</p>
    <p>Si crees que has cometido un error en el formulario de inscripción y hablas euskera y castellano con fluidez, puedes cerrar sesión y crear una cuenta nueva con la información correcta.</p>
    """
}

evaluations_done = {
    ENGLISH: "Evaluations done",
    SPANISH: "Evaluaciones hechas"
}

total_duration = {
    ENGLISH: "Total duration",
    SPANISH: "Duración total"
}

disclaimer_title = {
    ENGLISH: "Warning",
    SPANISH: "Aviso"
}

disclaimer_text = {
    ENGLISH: """
    <p>ĊAĦDA: Uħud mis-sentenzi li se tara matul dan l-istħarriġ jista' jkun fihom dikjarazzjonijiet offensivi jew mhux xierqa. Parti mid-data li użajna ntgħażlet minn sett ta’ data ta' preġudizzju soċjali , ġabra kbira ta' testi mill-Internet li huma offensivi għal diversi gruppi ta' minoranza, u dan is-sett ta' data nbena sabiex iħarreġ software biex jidentifikaw u jtaffu kontenut offensiv online. Il-bqija tas-sentenzi nġabru bl-istess mod minn diversi sorsi, pubblikazzjonijiet, midja, u l-Internet. L-ebda sentenza ma nkitbet minna, u dawn s-sentenzi ma jesprimux l-fehmiet tal-individwi involuti f’dan il-proġett. L-uniku għan tagħna huwa li nanalizzaw il-kwalità tat-traduzzjonijiet.</p>
    <hr class="ui-lang-divider" />
    <p>DISCLAIMER: Some of the sentences you will be shown over the course of this task may contain offensive or otherwise inappropriate statements. They may also contain wrong or outdated information about different topics. These sentences were collected from various sources, publications, media, and the Internet. They were not written by us, and do not express the views of anyone involved with this project. Our only goal with this project is to evaluate the quality of the translations.</p>
    """,
    SPANISH: """
    <p>OHARRA: Posible da ebaluazioan zehar erakutsiko dizugun esaldiren batek adierazpen iraingarriak edo nolabait desegokiak diren egiaztapenak izatea. Gaien gaineko informazio okerra edo zaharkitua ere izan dezakete. Esaldiak askotariko iturrietatik jaso ditugu, hainbat argitalpen eta komunikabidetik, internet barne. Ez ditugu guk idatzi, eta ez dute proiektu honetan parte hartzen dugunon iritzia islatzen. Gure helburu bakarra itzulpenen kalitatea ebaluatzea da.</p>
    <hr class="ui-lang-divider" />
    <p>ATENCIÓN: Es posible que alguna de las frases que te mostremos a lo largo de la evaluación contenga contenido ofensivo o inadecuado. Asimismo, pueden contener información errónea u obsoleta sobre los temas tratados. Las frases se han recopilado de fuentes muy diversas, de múltiples publicaciones y medios de comunicación, incluyendo internet. No han sido redactadas por el grupo de investigación ni reflejan la opinión de quienes participamos en el proyecto. Nuestro único objetivo es evaluar la calidad de las traducciones.</p>
    """
}

"""
task page
"""
task_prompt = {
    ENGLISH: """
    <p>For the pair of sentences below, state <strong>how much you agree</strong> that:</p>
    <p align="center"><strong>The candidate translation adequately expresses the meaning of the original text.</strong></p>
    """,
    SPANISH: """
    <p>Lee con atención las siguientes frases e indica hasta qué punto estás de acuerdo con la siguiente afirmación:</p>
    <p align="center"><strong>La propuesta de traducción refleja adecuadamente el significado de la frase original.</strong></p>
    """
}

"""
create profile
"""
create_profile_title = {
    ENGLISH: "Register to participate",
    SPANISH: "Registrarse para participar"
}

create_profile_subtitle = {
    ENGLISH: "Please create an username and a password, and then tell us which languages you can evaluate.",
    SPANISH: "Por favor, cree un nombre de usuario y una contraseña, y luego díganos qué idiomas puede evaluar."
}

username_label_text = {
    ENGLISH: "Username",
    SPANISH: "Nombre de usuario"
}

username_help_text = {
    ENGLISH: "Please create an username",
    SPANISH: "Por favor, crea un nombre de usuario"
}

password1_label_text = {
    ENGLISH: "Password",
    SPANISH: "Contraseña"
}

password1_help_text = {
    ENGLISH: "Please enter your desired password",
    SPANISH: "Por favor, introduzca la contraseña deseada"
}

password2_label_text = {
    ENGLISH: "Password (again)",
    SPANISH: "Contraseña (otra vez)"
}

password2_help_text = {
    ENGLISH: "Please re-type your password",
    SPANISH: "Vuelva a introducir la contraseña deseada"
}

lp_help_text = {
    ENGLISH: "For this project, we wish to evaluate of translations between two pairs of languages: from English into Maltese, and from Spanish into Basque. Please select below which language pair you would like to contribute with, and tell us your proficiency level in each language.",
    SPANISH: "Para este proyecto, deseamos evaluar traducciones entre dos pares de idiomas: del inglés al maltés, y del español al euskera. Por favor, seleccione con qué par de idiomas le gustaría contribuir, e indíquenos su nivel de competencia en cada uno de ellos."
}

lp_label_text = {
    ENGLISH: "Language pair",
    SPANISH: "Par de idiomas"
}

lp_engmlt_option_text = {
    ENGLISH: "Maltese and English",
    SPANISH: "Maltés e inglés"
}

lp_spaeus_option_text = {
    ENGLISH: "Basque and Spanish",
    SPANISH: "Euskera y español"
}

select_option_text = {
    ENGLISH: "select",
    SPANISH: "seleccionar"
}

proficiency_level_label_text = {
    ENGLISH: "Proficiency level",
    SPANISH: "Nivel de competencia"
}

proficiency_level_beginner = {
    ENGLISH: "beginner",
    SPANISH: "principiante"
}

proficiency_level_intermediate = {
    ENGLISH: "intermediate",
    SPANISH: "intermedio"
}

proficiency_level_advanced = {
    ENGLISH: "advanced",
    SPANISH: "avanzado"
}

proficiency_level_fluent = {
    ENGLISH: "fluent",
    SPANISH: "fluido"
}

proficiency_level_native = {
    ENGLISH: "native",
    SPANISH: "nativo"
}

create_profile_button = {
    ENGLISH: "Create profile",
    SPANISH: "Registrarse",
}

error_msg_warning_header = {
    ENGLISH: "Warning!",
    SPANISH: "¡Atención!"
}

error_msg_invalid_username = {
    ENGLISH: "Invalid or missing username. Please provide a new username.",
    SPANISH: "Falta el nombre de usuario o no es válido. Por favor, introduzca un nuevo nombre de usuario."
}

error_msg_username_already_exists = {
    ENGLISH: "The username you have entered already exists. Please choose a new username.",
    SPANISH: "El nombre de usuario que ha introducido ya existe. Por favor, elija un nuevo nombre de usuario."
}

error_msg_missing_password = {
    ENGLISH: "Missing password. Please type your desired password twice, in both fields.",
    SPANISH: "Falta la contraseña. Por favor, escriba la contraseña deseada dos veces, en ambos campos."
}

error_msg_passwords_not_matching = {
    ENGLISH: "The passwords don't match. Please type the desired password in both fields.",
    SPANISH: "Las contraseñas no coinciden. Por favor, introduzca la contraseña deseada en ambos campos."
}

error_msg_password_too_short = {
    ENGLISH: "The password must be at least 4 characters long. Please try again.",
    SPANISH: "La contraseña debe tener al menos 4 caracteres. Por favor, inténtelo de nuevo."
}

error_msg_no_lang_selected = {
    ENGLISH: "Please choose at least one language for evaluation.",
    SPANISH: "Elija al menos una lengua para evaluación."
}

error_msg_missing_poficiency_level = {
    ENGLISH: "Please select your proficiency level in all the languages you've marked.",
    SPANISH: "Por favor, seleccione su nivel de competencia en todas las lenguas que ha marcado."
}

error_msg_default = {
    ENGLISH: "Something bad happened. Please try again.",
    SPANISH: "Ha ocurrido algo malo. Por favor, inténtelo de nuevo."
}

"""
sign in
"""

user_auth_title = {
    ENGLISH: "User authentication",
    SPANISH: "Autenticación de usuarios"
}

user_auth_subtitle = {
    ENGLISH: "Please enter your username and password so we can verify your credentials.",
    SPANISH: "Introduzca su nombre de usuario y contraseña para que podamos verificar sus credenciales."
}

signin_username_help_text = {
    ENGLISH: "Please enter your username",
    SPANISH: "Introduzca su nombre de usuario"
}

signin_password_help_text = {
    ENGLISH: "And also provide your password",
    SPANISH: "Y escriba también su contraseña"
}

signin_button_text = {
    ENGLISH: "Sign in",
    SPANISH: "Entrar"
}

signin_error_text = {
    ENGLISH: "We did not find a registered user with your username and password. Please try again.",
    SPANISH: "No hemos encontrado ningún usuario registrado con su nombre de usuario y contraseña. Por favor, inténtelo de nuevo."
}

"""
nav
"""

account = {
    ENGLISH: "Account",
    SPANISH: "Cuenta"
}

sign_in = {
    ENGLISH: "Sign in",
    SPANISH: "Entrar"
}

register = {
    ENGLISH: "Register",
    SPANISH: "Registrarse"
}

sign_out = {
    ENGLISH: "Sign out",
    SPANISH: "Salir"
}

home_title = {
    ENGLISH: "Home",
    SPANISH: "Inicio"
}

"""
error pages
"""

error_500_text = {
    ENGLISH: "Oops! There was a server error. We apologize for the inconvenience. Please go back to the initial page and try again.",
    SPANISH: "¡Uy! Parece que se ha producido un error en el servidor. Disculpe las molestias. Por favor, vuelva a la página inicial e inténtelo de nuevo."
}

back_to_frontpage_button = {
    ENGLISH: "Back to initial page",
    SPANISH: "Volver a la página inicial"
}

"""
aux
"""

def _get_lang_texts(texts_module, ui_lang):
    # get vars from texts_module and keep only the text dicts
    text_dicts = {_key : _val for _key, _val in vars(texts_module).items() if (not _key.startswith("_")) and (type(_val) == dict)}

    # given the ui_lang, get each text in that lang and return as key:text dict
    lang_texts = {text_key : text_dict[ui_lang].strip() for text_key, text_dict in text_dicts.items()}

    return lang_texts

"""
This is a horrible hack to make my life easier and get all of the variables from this module as a dict so that I don't have to write them as a dict myself. It accesses the `vars` from this very module and filters out only the relevant text dicts from above, then returns only the texts corresponding to the given `ui_lang`. This delegates the responsibility of choosing the UI lang to Python code, which is much easier than doing it in templates, and then all of the texts can be unpacked at once into the context dict of whatever Django view I want, which is not entirely necessary nor efficient, but is convenient, and hopefully harmless.

    import translated_texts
    lang_texts = translated_texts._get_lang_texts(translated_texts, ui_lang)
    context = { ..., **lang_texts }

Then in templates they can just be included like this:

    <div>{{task_prompt|safe}}</div>

(The `safe` is for when there is HTML inside of the text string.)
"""