Start work on a new welcome screen: manjaro-hello



@Neutrino: Am i right if i say that python can only use the language which is set in the environment variable LANG or a default language?

Here an extract of this page.

Thanks to Juha Sahakangas on the #gtk+ IRC channel for providing the explanation: For this particular case the locale module needs to be used instead of gettext. Python’s gettext module is pure python, it doesn’t actually set the text domain in a way that the C library can read, but locale does (by calling libc). So long as that’s done, GtkBuilder already works the way you’re asking it to.

For now, the program use the default locale of user until we find the solution:

self.sys_locale = locale.getdefaultlocale()[0]
locale.setlocale(locale.LC_ALL, self.sys_locale + ".utf8")

The setlocale method require that locale specified must be installed on user system. That’s the problem, because what we want is to permit the user to use the language he wants, in the language selector. (this is important in a live session).

The language selected by user is set in self.preferences(“locale”):

locales = os.listdir(self.locale_path)
if self.preferences["locale"] not in locales:
    if self.sys_locale in locales:
        self.preferences["locale"] = self.sys_locale
        self.preferences["locale"] = self.default_locale


What is the problem ?
It’s just time to create a PKGBUILD that copies .mo into /usr/share/locale/
Need help creating the PKGBUILD? (But the tree is currently not good)

Ps: with the .mo in /usr/share/locale/fr/, I have French(my pc language) if I select English and English with the selection of French :confused:



  • The problem is that the method locale.setlocale() requires locale to be in locales system list

      locale -a

For example, if I remove fr_FR.utf8 from this list it can’t load the mo in the folder fr_FR.

  • Yes, I need help with PKGBUILD. (We can talk in private in French if you want).

  • This will be fixed when choice selection will be re-enabled.

EDIT: I’ve just re-enable the language selector. Manjaro-hello restarts with the language selected if locale selected is in user locales list. (see your list with locale -a command).


hard to make a good PKGBUILD
but for test (bad tree: all in /opt/)

pkgdesc="Manjaro hello"
depends=('gtk3' 'python3')

package() {
  cd "$srcdir/$_pkgname/src"
  #mkdir -p "${pkgdir}/usr/share/${pkgbase}" for pages as manjaro-welcomes
  mkdir -p "${pkgdir}/opt/${_pkgname}"
  mkdir -p "${pkgdir}/usr/bin"

  cp -a * "${pkgdir}/opt/${_pkgname}" # not good !

  sed -i -e '0,/Exec=manjaro-hello/s//Exec=python3' ${_pkgname}.desktop
  echo "Path=/opt/${_pkgname}">>${_pkgname}.desktop
  install -D -m644 ${_pkgname}.desktop ${pkgdir}/usr/share/applications/${_pkgname}.desktop
  # todo: move also icon in good folder
  ln -s  /opt/${_pkgname}/ ${pkgdir}/usr/bin/${_pkgname}
  #chmod +x ${pkgdir}/usr/bin/${_pkgname} not good : make "cd path" before, todo:create a bash file
  mkdir -p ${pkgdir}/usr/share/locale/fr/LC_MESSAGES/
  install -Dm644 locale/fr_FR/LC_MESSAGES/*.mo ${pkgdir}/usr/share/locale/fr/LC_MESSAGES/


I get an error now:

Traceback (most recent call last):
  File "", line 216, in <module>
  File "", line 61, in __init__
    locale.setlocale(locale.LC_ALL, self.preferences["locale"] + ".utf8")
  File "/usr/lib/python3.5/", line 594, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting


$ locale -a

And with

$ locale -a

i can see the English one but if i select French i get the error from above.


This is the problem that I have since the start. Its works only if locale is also installed in Manjaro Settings.


There is no need for an installation. The only thing that is needed is temporary another setting of the language. Maybe you can use a low level method or function (_setlocale()(?)) to set another locale?


Well, you can check also our thus installer code for language selection, if some part is useful for that. However the new app looks already great.


@philm: Thank’s for suggestion, I’ll take a look.

EDIT: For now, I have found that part:

def setup_gettext():
    """ This allows to translate all py texts (not the glade ones) """
    gettext.bindtextdomain(APP_NAME, LOCALE_DIR)

    locale_code, encoding = locale.getdefaultlocale()
    lang = gettext.translation(APP_NAME, LOCALE_DIR, [locale_code], None, True)

Note the “(not the glade ones)”. A possible hack is to not set text in glade but add them for each object by calling set_text method in pure Python. It would be pity. I think this is what you do with the def translate_ui() method.



Looks awsome, also with the arc dark theme everything is very readable and nice looking (I would post a screenshot, but after switching language it wont start again as already mentioned)

I removed the cloned folder, but the error persists - where does the selected language get stored?


@Th3Z0ne, just do this:

rm ~/.config/manjaro-hello.json


Thank you!

Nice, how it looks in dark! Like it a lot!


Glad to hear that !


I’ve just succeed to make translation works and without restarting app moreover.
But it’s just a workaround, code is not sexy…


Hey it works, I guess if it’s not introducing some kind of security hole the code must not be pretty? must it? ^^

Do you have to add the translations manually?



  • No, this workaround does not add vulnerabilities :slight_smile: . It is just redundant and should be useless.
  • Everything is automated. In fact, I retrieve the content of all elements of the interface and then redefined these with the same content. But, because it is done in pure Python, gettext module is sufficient (no need to use the locale module).


Hey, like how it looks and works by switching languages. It is always good to have documented and well done code. Sometimes the quick and dirty also works. So which open points are there still?


It’s right ! So, I think that soft has all features of manjaro-welcome now.

  • As suggested by @excalibur1234, we could use Transifex to manage translations.
  • The PKGBUILD need to be improved. (icon path, autostart path, glade path, loop for languages). This will cause small changes in the code.
  • Review pages to check spelling.
  • Test it in all situations (autostart, live systems, delete config files, …)

I think it’s all. The goal was to make manjaro-hello to have all features of manjaro-welcome but with a translation system for the first version.


I think it’s nearly pefect. The only thing that is not needed: The menu on the left because you can reach all pages over the buttons (“Documentation” on the left menu and the button “Read me” are the same page). But the issue is: It is needed to go back to the welcome-screen.


I could resolve this in adding a home icon next to languages selector.
Everyone is ok with this idea ?