mate-desktop / mate-themes

Official themes for the MATE desktop
https://mate-desktop.org
GNU Lesser General Public License v2.1
75 stars 45 forks source link

Migrate from intltool to gettext #258

Closed yetist closed 5 years ago

yetist commented 5 years ago

When the gettext version is 0.20 (on Archlinux), it will fail on some po files, I am not sure if this is a bug in gettext 0.20 or a bug in po file.

raveit65 commented 5 years ago

Archlinux build with gettext-0.20 failed at another place. https://travis-ci.org/mate-desktop/mate-themes/jobs/580040772#L1189

/usr/sbin/msgfmt: error while opening "an.1po" for reading: No such file or directory
raveit65 commented 5 years ago

It seems to work fine and all translation strings are in mate-themes.pot. But do you have a idea why this line in mate-themes.pot is wrong? "Content-Type: text/plain; charset=CHARSET\n" Should be "Content-Type: text/plain; charset=UTF-8\n" Issue still exits in master , so it isn't related to PR, but it is annoying because it breaks distcheckif it goes into *.po files. And we have to fix it by hand every time we send the resource file to transifex.

yetist commented 5 years ago

Installation with sudo make install doesn't install any locale. It seems that that all locale will be installed first, but later they will be removed.

Yes, it's ok, please see the $top_srcdir/Makefile.am.

# we don't want to install mo files, all translations are already stored
# in theme files
install-data-local:
$(MAKE) -C po uninstall
raveit65 commented 5 years ago

Yes, it's ok, please see the $top_srcdir/Makefile.am.

Opps sorry, i had forgot this special handling here in this package.

rbuj commented 5 years ago

You shouldn't rename index.theme to index.desktop, all files are Desktop files in po/POTFILES.in:

diff --git a/po/Makevars b/po/Makevars
index 5c3836c5..66ae5e12 100644
--- a/po/Makevars
+++ b/po/Makevars
@@ -8,7 +8,7 @@ subdir = po
 top_builddir = ..

 # These options get passed to xgettext.
-XGETTEXT_OPTIONS = --from-code=UTF-8 --keyword=_ --keyword=N_ --keyword=C_:1c,2 --keyword=NC_:1c,2 --keyword=g_dngettext:2,3 --add-comments
+XGETTEXT_OPTIONS = --from-code=UTF-8 --language=Desktop --add-comments

 # This is the copyright holder that gets inserted into the header of the
 # $(DOMAIN).pot file.  Set this to the copyright holder of the surrounding

desktop.in -> theme.in:

sed -i 's/index\.desktop\.in/index\.theme\.in/g'  po/POTFILES.in
find . -name Makefile.am -exec sed -i 's/\.desktop\.in/\.theme\.in/g' {} \;
find . -name index.desktop.in -exec echo "mv "{}" \$(dirname "{}")/index.theme.in" \; | sh

Test:

find . -name Makefile.i* -exec rm {} + && ./autogen.sh --prefix=/usr && ./makepot && make && sudo make install
git diff mate-themes.pot