linuxmint / cinnamon-control-center

A collection of configuration plugins used in cinnamon-settings
GNU General Public License v2.0
62 stars 67 forks source link

Use i18n to process desktop file. #293

Closed leigh123linux closed 1 year ago

leigh123linux commented 2 years ago

These shouldn't be included in the installed desktop file

Translators: those are keywords

_Keywords=

mtwebster commented 2 years ago

I end up with no keywords with this - not even the original line.

eli-schwartz commented 2 years ago

Oh hmm.

The files currently specify _Keywords, which is not actually a desktop file element, but Keywords is.

Gettext supports the actual desktop file element, and will translate it, but the underscore-prefixed version is something specific to intltool, which doesn't know about translatable filetypes at all and simply treats everything with a leading underscore as translatable (it removes the underscore when processing the file).

Before this PR, the desktop files weren't processed by either one and thus were not translated, and did not get keywords either. They did have an ignored line which could be used to open the desktop file in a text editor and admire the underscore-keywords, but desktop menus would not know that they mean anything.

In other words, commit 8111461df1f66bb78bbd45a975897801b93bccb1 was more broken than initially thought.

leigh123linux commented 2 years ago

The _keyword has never been translated.

https://github.com/linuxmint/cinnamon-control-center/blob/12ecbf6961514a200ed283a01435076ab04d2e2d/panels/color/cinnamon-color-panel.desktop.in.in#L11

eli-schwartz commented 2 years ago

Indeed it was not, and I guess the broken version was removed in 4d84b6e910fda5b83a257990211f95e0a22b8162 and then re-added in its broken state in 8111461df1f66bb78bbd45a975897801b93bccb1.

Also relevant: 0cc14fbdd4e3ce13b3ed956316ef82b44b82ce49

But FWIW, this was broken by the port to Meson: 38bcf170d96cafb0f162f0902052dca5e94dc26f

It migrated most things correctly, but the old autotools build system used intltool, and the port changed to use i18n.merge_file() without porting file contents from intltool to gettext.

clefebvre commented 2 years ago

I'm not mad about this... we do half the work in mint-common and the other half in meson. I'd rather add the ability to specify keywords in mint-common.

leigh123linux commented 2 years ago

I'm not mad about this... we do half the work in mint-common and the other half in meson. I'd rather add the ability to specify keywords in mint-common.

Will that fix the invalid desktop files shipped in the release tags? Fedora and other distro's don't have mint-common.

eli-schwartz commented 2 years ago

Well, either way you should not have _Keywords= in these files, but instead have Keywords=.

Whether you insert the translated keywords by running i18n.merge_file() at build time, or by merging them in via a maintenance script and checking the results into git, is not super important as it will have the same end result when building the package.

(Checking the results into git does make git log more complex, but this is already an issue for other elements so nothing really changes.)

clefebvre commented 1 year ago

Fixed by https://github.com/linuxmint/cinnamon-control-center/commit/5a8f817355702c8c5348b4291d5a8293da9da7d1