Galicaster translations

7 views
Skip to first unread message

Paul Gration

unread,
Nov 27, 2018, 6:46:21 AM11/27/18
to comm...@galicaster.org
Is anyone familiar with how these work?

The reason I'm looking into it is because we want to change the text
that is displayed on a number of widgets. We have our own adhoc plugin
with modal dialog screens and it seems a few of our users are getting
confused by the 'Waiting' label at the top of the screen (when
Galicaster is idle), thinking that something is happening that they need
to wait for before interacting with the modal dialog.
Also we use the hidetabs plugin (not active in the screenshot attached)
and we only show the 'Recording' tab (the tab information section is
mainly obscured by the on screen keyboard) and some users seem to
interpret this 'Recording' text as meaning there is a recording taking
place, rather than it being a 'Recording details' information section.

So I started looking into translations to whether we could change labels
there..

I currently have a clone of the latest master branch and there is the
galicaster.pot template file, and 4 translations (es, fr, nl, sl) in the
i18n directory.
I can only seem to get the es and fr versions to work, by adding the
LANGUAGE environment variable when running Galicaster, e.g.

LANGUAGE=es ./run_galicaster.py

Incidentally (and not the main point of my email) I noticed only about
half of the text gets translated, see attached screenshot...it seems the
translations need to happen manually and only some labels are changed
with set_text(_("msgid_here")).

The difference between the translations that work (es and fr) and those
that don't (nl and sl) is that the es and fr ones have the
LC_MESSAGES/galicaster.mo binary files included - *.mo is in the
.gitignore file so I'm not sure whether these are actually meant to be
in the repository?
Thinking that the absence of the .mo files is the reason that the nl and
sl translations aren't working, I've generated the galicaster.mo files
for the nl and sl (using msgfmt) but that didn't seem to work.
I've also tried going back further by generating a new .po file from the
galicaster.pot for nl and sl, and then generating the .mo files for them
from the new .po file but couldn't seem to get that working either.

If I set the translation fallback option[1] to False, then an exception
is thrown for anything other than es and fr:

File "/usr/lib/python2.7/gettext.py", line 560, in translation
raise IOError(ENOENT, 'No translation file found for domain', domain)
IOError: [Errno 2] No translation file found for domain: 'galicaster'

There may be a nicer way of doing this without translations, but
translations seem to be the least intrusive/potentially easiest way by
just dropping in a new translation to the application directory rather
than modify core code..


Thanks,

Paul

[1]
https://github.com/teltek/Galicaster/blob/c066b5abd3b32ed038a633cd2a9069c37bdafb5a/galicaster/utils/i18n.py#L20

--
Paul Gration
Multimedia Software Developer
University of Sussex
+44 (0) 1273 873269
es.png

Paul Pettit

unread,
Nov 27, 2018, 7:25:26 AM11/27/18
to comm...@galicaster.org
i am no translations expert, but it looks like at least the glade files are not getting translated at all. maybe when the glade files are added there should be a 

builder.set_translation_domain('galicaster')

??


--
You received this message because you are subscribed to the Google Groups "Galicaster-Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to community+...@galicaster.org.
To post to this group, send email to comm...@galicaster.org.

Paul Gration

unread,
Nov 27, 2018, 7:38:24 AM11/27/18
to comm...@galicaster.org
Thanks, yea I did try adding that to the recorderui.py after the glade
file is loaded, before this line:

https://github.com/teltek/Galicaster/blob/c066b5abd3b32ed038a633cd2a9069c37bdafb5a/galicaster/classui/recorderui.py#L82

But it didn't make any difference for me..

I may well be wrong but it seems that all translations are being handled
like this:

https://github.com/teltek/Galicaster/blob/c066b5abd3b32ed038a633cd2a9069c37bdafb5a/galicaster/classui/recorderui.py#L430

The fact that you get an exception when setting fallback=False in
utils/i18n.py and using the nl or sl language suggests that it's not
even finding a translation, before even trying to do any translating
(automatically or manually)?

Cheers,

Paul
> <mailto:community%2Bunsu...@galicaster.org>.
> To post to this group, send email to comm...@galicaster.org
> <mailto:comm...@galicaster.org>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Galicaster-Community" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to community+...@galicaster.org
> <mailto:community+...@galicaster.org>.
> To post to this group, send email to comm...@galicaster.org
> <mailto:comm...@galicaster.org>.

Paul Pettit

unread,
Nov 27, 2018, 7:52:36 AM11/27/18
to comm...@galicaster.org
i think there are  couple of different issues here.

_('text') is the standard way of using gettext to translate strings in the code. that will obviously not work for glade files where the strings are not in the code itself but in the glade XML.

then there i the issue of some languages not working at all, which i assume means the correct files/config is not being generated for them. maybe it would be helpful if the scripts used to generate the translation stuff was included in the repo, maybe extend the Makefile for example?

Paul.

To unsubscribe from this group and stop receiving emails from it, send an email to community+...@galicaster.org.
To post to this group, send email to comm...@galicaster.org.

Alfonso Rodriguez

unread,
Nov 27, 2018, 10:11:53 AM11/27/18
to comm...@galicaster.org
Hi guys,

Doing some quick testing here, it seems there are two things you need for translations to work:

1. Generate the .mo files for all translations. The exact commands appear on the Galicaster docs: https://github.com/teltek/Galicaster-doc/blob/master/DeveloperGuide/i18n.md
2. The LANGUAGE variable has to be set to the exact name of the translations folder (e.g. "es_ES"). Setting the LANGUAGE to "es" or "fr" does seem to translate Galicaster partially. Maybe Galicaster is picking up the strings from other .mo files already present in the system?

Note: I think the glade files are being translated by the Gtk.Builder() whenever they are loaded, as long as there is a valid string and the section is set as translatable="yes" on the template.

Also, I guess the intention was for the .mo files to not be included on the source and instead being generated. I think this should be the way to go. I agree to adding a script to the Makefile that does the required calls to msgftm.

Cheers,

Alfonso Rodríguez Pereira
TELTEK Video Research

http://teltek.es/


La información contenida en este mensaje y/o archivo(s) adjunto(s) es confidencial/privilegiada y está destinada a ser leída sólo por la(s) persona(s) a la(s) que va dirigida. Si usted lee este mensaje y no es el destinatario señalado, el empleado o el agente responsable de entregar el mensaje al destinatario, o ha recibido esta comunicación por error, le informamos que está totalmente prohibida, y puede ser ilegal, cualquier divulgación, distribución o reproducción de esta comunicación, y le rogamos que nos lo notifique inmediatamente y nos devuelva el mensaje original a la dirección arriba mencionada. Gracias.

The 
information contained in this message and/or attached file(s) is confidential/privileged and is intended to be read only by the person(s) to whom it is directed. If you are reading this message and you are not the indicated recipient, or the employee or agent responsible for delivering the message to the addressee, or you have received this communication by mistake, please be aware that any dissemination, distribution or reproduction of this communication is strictly prohibited and may be illegal. Please notify us immediately and return the original message to the aforementioned address. Thank you.

Paul Gration

unread,
Nov 27, 2018, 10:31:03 AM11/27/18
to comm...@galicaster.org
Ah! Thanks Alfonso, not sure how I missed this piece of documentation..

I just generated a .mo file for the nl_BE language and used
LANGUAGE=nl_BE as you suggested and it works!

Cheers,

Paul

On 27/11/2018 15:11, Alfonso Rodriguez wrote:
> Hi guys,
>
> Doing some quick testing here, it seems there are two things you need
> for translations to work:
>
> 1. Generate the .mo files for all translations. The exact commands
> appear on the Galicaster docs:
> https://github.com/teltek/Galicaster-doc/blob/master/DeveloperGuide/i18n.md
> 2. The LANGUAGE variable has to be set to the exact name of the
> translations folder (e.g. "es_ES"). Setting the LANGUAGE to "es" or "fr"
> does seem to translate Galicaster partially. Maybe Galicaster is picking
> up the strings from other .mo files already present in the system?
>
> Note: I think the glade files are being translated by the Gtk.Builder()
> whenever they are loaded, as long as there is a valid string and the
> section is set as translatable="yes" on the template.
>
> Also, I guess the intention was for the .mo files to not be included on
> the source and instead being generated. I think this should be the way
> to go. I agree to adding a script to the Makefile that does the required
> calls to msgftm.
>
> Cheers,
>
> *Alfonso Rodríguez Pereira
> TELTEK Video Research*
> http://teltek.es/
>
>
> /La información contenida en este mensaje y/o archivo(s) adjunto(s) es
> confidencial/privilegiada y está destinada a ser leída sólo por la(s)
> persona(s) a la(s) que va dirigida. Si usted lee este mensaje y no es el
> destinatario señalado, el empleado o el agente responsable de entregar
> el mensaje al destinatario, o ha recibido esta comunicación por error,
> le informamos que está totalmente prohibida, y puede ser ilegal,
> cualquier divulgación, distribución o reproducción de esta comunicación,
> y le rogamos que nos lo notifique inmediatamente y nos devuelva el
> mensaje original a la dirección arriba mencionada. Gracias.
>
> The //information contained in this message and/or attached file(s) is
> confidential/privileged and is intended to be read only by the person(s)
> to whom it is directed. If you are reading this message and you are not
> the indicated recipient, or the employee or agent responsible for
> delivering the message to the addressee, or you have received this
> communication by mistake, please be aware that ///any dissemination,
> distribution or reproduction of this communication is/ strictly
> prohibited and may be illegal. Please notify us immediately and return
> the original message to the aforementioned address. Thank you./
> > <mailto:p.m.g...@sussex.ac.uk
> >     <mailto:community%2Bunsu...@galicaster.org
> <mailto:community%252Buns...@galicaster.org>>.
> >     To post to this group, send email to
> comm...@galicaster.org <mailto:comm...@galicaster.org>
> >     <mailto:comm...@galicaster.org
> <mailto:comm...@galicaster.org>>.
> >
> > --
> > You received this message because you are subscribed to the
> Google
> > Groups "Galicaster-Community" group.
> > To unsubscribe from this group and stop receiving emails from
> it, send
> > an email to community+...@galicaster.org
> <mailto:community%2Bunsu...@galicaster.org>
> > <mailto:community+...@galicaster.org
> <mailto:community%2Bunsu...@galicaster.org>>.
> > To post to this group, send email to comm...@galicaster.org
> <mailto:comm...@galicaster.org>
> > <mailto:comm...@galicaster.org
> <mailto:comm...@galicaster.org>>.
>
> --
> Paul Gration
> Multimedia Software Developer
> University of Sussex
> +44 (0) 1273 873269
>
> --
> You received this message because you are subscribed to the
> Google Groups "Galicaster-Community" group.
> To unsubscribe from this group and stop receiving emails from
> it, send an email to community+...@galicaster.org
Reply all
Reply to author
Forward
0 new messages