Skip to content

Improve the locale management #164

Description

@ncelerier

Hello,

While doing a new translation language for this applet, I have had a look at the code related to locale management and I think I can propose improvements. I would like to have feedback before implementing the changes. Maybe I'm wrong for some things since I'm only having a look at applet development since 2 weeks.

Don't commit generated .mo files

It doesn't look like a good idea to commit the .mo files because they are generated from .po files.
They can be generated automatically with scripts, so that there seems to be no need to commit them.
Also, it is harder to maintain, because you can see that there is a he.po file but no he.mo file so we have to take extra care of them.

I propose to remove the mo folder.

Rely on Cinnamon Install/Uninstall applet process

It looks like that Cinnamon handles localization during the install/uninstall process.

When someone install an applet, Cinnamon check the po folder for localizations and
compile them to *.mo file into the ~/.local/share/locale/xx/LC_MESSAGES folder.

When someone uninstall an appplet, Cinnamon also remove these files from LC_MESSAGES folder.

That's what I understand from other applet like the Weather one.

Have a look at the if condition at line 474 of the Cinnamon code that handle this:
https://github.com/linuxmint/Cinnamon/blob/f075328c6e983b3cae3c4bf0a0fe5e05f0c8f29c/files/usr/share/cinnamon/cinnamon-settings/bin/Spices.py

The only thing that annoys me is that I don't know how to re-install an installed applet to test that it is working the way I describe it.

I propose to rename locale folder to po folder.

Applet.js, method execInstallLanguage is not called anymore

Since commit ee37b02 (almost 2 years ago), the execInstallLanguage method is not called anymore.

Do we still need this method ? If not, I propose to remove it. If yes, it should be documented why we keep it.

Multiple files to handle locale management

There are multiple files that help us for locale management:

  • po/localeUpdate.sh.

That's really a helpful file. I propose to move it from the po folder to the root folder of this applet so that this folder only contains .po and .pot files.

  • locale.sh

This file shouldn't be useful anymore since we can rely on the Cinnamon install/uninstall process. Also this is a subset of what localeUpdate.sh is doing.

I propose to remove it.

  • configure.py

I'm not sure that we need this file. It does 2 things:

  • Install the applet into the applet folder where all the applets are, and it installs the committed .mo files.
  • Uninstall the applet from the applet folder where all the applets are.

The uninstall procedure is not removing the .mo files from LC_MESSAGES. This is a minor bug.

Can we remove these file, or is it being used for older versions of Cinnamon were the install/uninstall is not present ?

What do you think ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions