Language support

Alexander Larsson alexl at redhat.com
Thu May 23 07:51:37 UTC 2019


On Wed, May 22, 2019 at 1:01 PM Rafael Fontenelle <rafaelff at gnome.org> wrote:
>
> Em seg, 20 de mai de 2019 às 05:29, Alexander Larsson
> <alexl at redhat.com> escreveu:
> >
> > On Sat, May 18, 2019 at 10:30 PM Rafael Fontenelle <rafaelff at gnome.org> wrote:
> > >
> > > Hello,
> > >
> > > It seems flatpak only recognizes languages with two characters, like
> > > en, pt, sv". For me, setting 'pt' (European Portuguese) works, but
> > > 'pt_BR' (Brazilian Portuguese) fails. See:
> > >
> > > $ LC_ALL=C flatpak config --set languages pt_BR
> > > error: 'pt_BR' does not look like a language code
> > >
> > > This impacts on the details of software listed. e.g. I'd expect GNOME
> > > Boxes's name be, in pt_BR, "Boxes" but flatpak shows "Caixa" which is
> > > pt's translation.
> >
> > Just set it to "pt", and it will include all pt_* locales. Flatpak
> > only splits the set of locales on the first part to avoid an explosion
> > of options, but it doesn't mean that they are not all supported.
>
> Hi Alexander,
>
> Thanks for your reply.
>
> Maybe I didn't express myself clearly. I'm referring to the app names
> listed by Flatpak that show up in pt/European Portuguese instead of
> pt_BR/Brazilian Portuguese (The UI of the software installed via
> Flatpak or even the Flatpak itself are in pt_BR as I would expect).
> And I would prefer to have app names listed in Brazilian Portuguese in
> my system. See below for my outputs.
>
> First, to show my system is in Brazilian Portuguese:
>
> $ echo $LANG
> pt_BR.UTF-8
>
> Now, notice that Flatpak defaults to Portuguese (as I mentioned,
> unable to set to pt_BR):
>
> $ flatpak config
> languages: *unset* (default: pt)

I think you're reading to much into this. This configuration means one
thing, and one thing *only*, namely:

When downloading a locale extension for an application/runtime, only
download the subdir /pt.

For example, I have the language set to "sv", and if i look at what
files got installed for the locale extension for the gnome runtime we
see that is has sv_SE as well as sv_FI:

 ls /var/lib/flatpak/runtime/org.gnome.Platform.Locale/x86_64/3.32/active/files/sv/lib
sv_FI  sv_FI at euro  sv_FI.utf8  sv_SE  sv_SE.utf8

Similarly if you do the same with "pt" instead it should contain pt_BR.

The language configuration does not in any other way affect flatpak,
such as what translations is used in the UI. That is configured like
any other app (i.e. the LANG env var, etc).

> See the first column ("Nome") for gnome-boxes's app name. "Caixas
> GNOME" is the European Portuguese translation [1], while "GNOME Boxes"
> is Brazilian Portuguese's [2].
>
> $ flatpak search boxes
> Nome                          Descrição
>              ID de aplicativo                           Versão
>  Ramo         Remotos
> Caixas GNOME                  Máquinas virtuais e remotas simples
>              org.gnome.Boxes                            3.32.1
>  stable       flathub
> (...)

The output from flatpak search comes from the appstream data, which
originates from teh appdata file the app shipped and then combined
into one file for all apps in the repo. Looking at this file as
downloaded by flatpak:

  less /var/lib/flatpak/appstream/flathub/x86_64/active/appstream.xml

I can indeed see that boxes has:

    <name xml:lang="pt">Caixas GNOME</name>

But no line for pt_BR.

Others do though, for example org.gnome.Photos:

    <name xml:lang="pt">Fotografias</name>
    <name xml:lang="pt_BR">Fotos</name>

Why exactly some do and some don't is up to each individual app, and
you need to file an issue to figure out why its not getting
translated.

However, we automatically fall back to "pt" if "pt_BR" doesn't exist,
which is why you see the "wrong" translation.


More information about the Flatpak mailing list