Translation to Spanish

Good morning:
We are trying to translate the webui server Privacy into Spanish and we have problems for it.
We have version 2.22 installed in a RehHat 7
We have followed the instructions indicated on the web:

We have generated the file es.po with some small translations to see how it would appear on the screen.
We have also generated the translations.js file and copied it to the path:

In this file a new line appears which is the following:

gettextCatalog.setStrings(‘es’, {“For HOTP and TOTP tokens:”:“Para tokens HOTP y TOTP:”,“For OCRA tokens:”:“Para tokens OCRA:”,“Import tokens from a file”:“Importar tokens de un fichero”,“List tokens”:“Lista de tokens”,“Number of required tokens”:“Numero de tokens requeridos”,“Please confirm with one of these tokens:”:“Confirma con uno de estos tokens:”,“Questionnaire”:“Cuestionario”,“Save”:“Grabar”,“Save CA”:“Grabar CA”,“Save Options”:“Grabar Opciones”,“Save RADIUS server”:“Grabar Servidor RADIUS”,“Save Resolver”:“Grabar Resolver”,“Save SMS gateway”:“Grabar Gateway SMS”,“Save SMTP server”:“Grabar Servidor SMTP”,“Save System Config”:“Grabar Configuracion del Sistema”,“Save Token Info”:“Grabar Informacion de Token”,“Save privacyIDEA server”:“Grabar Servidor privacyIDEA”,“Save realms”:“Grabar Dominio”,“Save resolver”:“Grabar Resolver”,“Save user”:“Grabar Usuario”,“Scope”:“Alcance”,“Search Filter”:“Buscar Filtro”,“Searching token…”:“Buscando token…”,“Secret”:“Secreto”,“Select Realm”:“Seleccionar Dominio”,“System”:“Sistema”,“System Config”:“Configuracion del Sistema”,“token type”:“Tipo de Token”,“total tokens:”:“Total de Tokens”,“type”:“Tipo”});

We have modified the file to also include the language in Spanish (“es”)

    browser_lang = request.accept_languages.best_match(["es", "en", "de"])

In theory, the browser should recognize the language of the system automatically, but it does not show the translations that we have incorporated.
Seeing the code of the login page, the following appears:

<script type="application/javascript">
        // Pass the browser Language to our Javascript code
        var browserLanguage = "es";

Another test we have done has been to copy the file es.po to the following address:

-rw-r--r-- 1 root root 135444 abr 20 10:09 es.po
-rw-r--r-- 1 root root 135444 abr 20 10:10 messages.po

and we have copied it with the name messages.po as it appears in the case of the German language.

Any more suggestions?
Have we forgotten anything?
What can we do?
Thanks for helping, greetings:
Jose Ma

Hi Jose,

we have some kind of nasty fallback here!

Without this fallback your UI would be prefixed with “[Missing]” if you set your browser language to a non-existing translation.
So add “es” in this list and everything should be fine!

Thanks a lot for bringing this up.
I hope we will be able to find a smooth solution.

And we are looking forward to your es pull request :slight_smile:

Good morning:

I have modified the code in this way:

  if (( ["de"].indexOf(nlang) === -1 ) && ( ["es"].indexOf(nlang) === -1 ) ) {
            // if language is not contained in translations,
            // we use default to "en"
            nlang = "en";

OKAY. It works correctly, very well.
Thank you very much.


Thank you very much.

Hi JoseMa,

this is so cool.
Would you be willing to share you translation? We could add this in the main repo at github.

THanks a lot