Revert "Invalid non-blank line in synaptic.desktop.in:"#263
Conversation
This reverts commit 4e7668f. The "_" prefixed lines in *.in files are automatically replaced with the translated ones by gettext. Removing them will mark these strings as non-translatable
|
Hey @AsciiWolf ! Nice to see you and thanks for thanks for the PR! I was under the impression that the meson integration of gettext would no longer need the "_" - did I misread/misassume this? If so I'm of course happy to merge this. @AsciiWolf if you have a bit of time I would love if you could play around a bit with the latest git version of synaptic - if all is well I would love to make a release soon(ish). |
Oh! It is possible, I am not an expert on meson. :) This needs to be tested (I can do it in upcoming weeks, but unfortunately not sooner; I will also test the git version of Synaptic as part of this). |
|
By the way, what about the AppStream metainfo file? It also has the "_" characters. |
|
FYI: In Meson and GNU gettext, how you mark strings in .in files depends on the file type. For Desktop/Metainfo files, prefix the keys with an underscore _. For XML/GSettings files, add translatable="yes". Meson’s i18n module automatically handles extraction.
[Desktop Entry]
Type=Application
_Name=My Application
_GenericName=Text Editor
_Comment=Edit your text files
Exec=appUse code with caution.
<?xml version="[1](https://github.com/mesonbuild/meson/issues/1565).0" encoding="UTF-8"?>
<component>
<id>com.example.App</id>
<name translatable="yes">My Application</name>
<summary translatable="yes">A simple app summary</summary>
</component>Use code with caution.
<?xml version="[1](https://discourse.gnome.org/t/xgettext-dont-extract-strings-from-ui-files/25063).0" encoding="UTF-8"?>
<schemalist>
<schema id="org.example.app" path="/org/example/app/">
<key name="greeting" type="s">
<default translatable="yes">Hello World</default>
<summary translatable="yes">A greeting message</summary>
<description translatable="yes">The message shown to users on startup.</description>
</key>
</schema>
</schemalist>Use code with caution.
i18n = import('i18n')
# Desktop file
i18n.merge_file(
input: 'data/app.desktop.in',
output: 'app.desktop',
type: 'desktop',
po_dir: meson.project_source_root() / 'po',
install: true,
install_dir: get_option('datadir') / 'applications'
)
# Metainfo file
i18n.merge_file(
input: 'data/app.metainfo.xml.in',
output: 'app.metainfo.xml',
po_dir: meson.project_source_root() / 'po',
install: true,
install_dir: get_option('datadir') / 'metainfo'
) |
|
Thanks for the detailed examples. So I looked at the desktop file and it seems its getting it right and this revert is not needed? Maybe I'm missing something but I did (in After applying the fixes from #269 - I think we are good and we don't need this PR. But let me know if I am missing something here, i18n is always a bit tricky :) |
This reverts commit 4e7668f.
The "_" prefixed lines in *.in files are automatically replaced with the translated ones by gettext. Removing them will mark these strings as non-translatable.
It is correct that
msgfmtcomplains about them since *.in suffixed files are template files and are not supposed to be validated or installed directly. This is automatically handled during the compilation process, but I am not sure if it still works since you replaced autotools with meson recently. If it does not work, you have to fix it in the meson.build file - that's the correct way./cc @mvo5 @amaa-99