After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 474987 - shouldn't leave redundant translations in mo files
shouldn't leave redundant translations in mo files
Product: intltool
Classification: Deprecated
Component: general
Other Linux
: Low enhancement
: ---
Assigned To: intltool maintainers
intltool maintainers
Depends on:
Reported: 2007-09-08 22:57 UTC by Matthias Clasen
Modified: 2012-03-16 12:39 UTC
See Also:
GNOME target: ---
GNOME version: ---

Description Matthias Clasen 2007-09-08 22:57:56 UTC
it would be nice if intltool would strip the translations that came from xml files, gconf schemas, bonobo server files and similar types from the mo files
after they have been merged back. Of course, some care has been to be taken to not remove a string if it _also_ occurs in the source and is needed at runtime. 

That should be relatively straightforward using msgcomm.
Comment 1 Rodney Dawes 2007-09-11 13:58:44 UTC
I don't think there is currently any way to know if something has been merged back in or not, and whether or not it may be used from source. Some applications extract strings for translation from XML, but do not merge them back, instead parsing the XML and then translating strings with gettext () internally when necessary.

I don't think msgcomm can really help with this. It's usefulness seems to be related to reducing duplicate messages in translations, for example, pt and pt_BR.

However, it would be nice if this reduction were somehow possible, so I'll confirm and set it to a low priority enhancement.
Comment 2 Matthias Clasen 2007-09-11 16:42:28 UTC
you should be able to something like the following:

1) create a po including the xml and schemas and similar sources

2) create a pot file not including them

3) do a msgcomm --more-than=1

Comment 3 Matthias Clasen 2008-09-24 06:10:53 UTC
Here is how to do this, assuming you have your list split into two parts: POTFILES.strip, which contains xml files, schemas files and anything else where the translations get merged back and don't have to land in the .mo, and
POTFILES.keep for everything which needs to land in .mo

Then you create a pot file from the .keep list:

mv POTFILES.keep
intltool-update --pot > keep.pot

And when generating .mo files, you merge the .po with keep.pot:

msgmerge foo.po keep.pot > foo.po.keep
msgfmt -o foo.po.keep

Comment 4 Matthias Clasen 2008-09-25 14:13:35 UTC
Here is the hack I did in our evolution spec file for now:

# strip unneeded translations from .mo files
cd po
grep -v ".*[.]desktop[.]in[.]in$\|.*[.]server[.]in[.]in$\|.*[.]schemas[.]in$" > POTFILES.keep
mv POTFILES.keep
intltool-update --pot
for p in *.po; do
  msgmerge $p evolution-2.24.pot > $p.out
  msgfmt -o `basename $p .po`.gmo $p.out
Comment 5 Matthias Clasen 2008-09-25 14:16:32 UTC
And just to give an idea of the amount of savings that can be had this way: the evo rpm shrinks by ~10%, from 41M to 37M
Comment 6 Bastien Nocera 2009-04-27 16:40:51 UTC
Note that this call:
  msgmerge $p evolution-2.24.pot > $p.out
will update the "POT-Creation-Date" part of the pot file, so it should be saved from the original file, and restored, to avoid multilib conflicts (eg. files would be different because of the different time of the build).
Comment 7 Matthias Clasen 2009-04-27 16:55:41 UTC
Also worth pointing out that bug 568845 is about going the other way, ie keeping the schema translations in .po files, and instead stripping them out of schemas and gconf databases.
Comment 8 Takao Fujiwara 2009-10-01 01:14:50 UTC
I think removing translations from the multi-lingual files(.desktop, .schemas..) can reduce the more sizes than removing translations from the mo files.

Also if we keep the translations in the multilingual files, the UI messages are not handled by LC_MESSAGES.
% env LC_CTYPE=ja_JP.UTF-8 LC_MESSAGES=en_US.UTF-8 foo

Applications are expected UI messages are English but the collations are localized with the above example.

Currently we use intltool to merge the translations to the multilingual files but there is no tool to demerge the translations from the multilingual files.
If we use the translations from .mo files, it's easy to remove .mo files.
Ideally it would be great if both this way and bug 569829 could be handled.
Comment 9 André Klapper 2012-03-16 12:39:45 UTC
intltool has switched from the GNOME to the infrastructure nearly three years ago:
The intltool product in has been deprecated and closed for new bug entry since April 2009.

I am now closing all remaining open reports about intltool as NOTGNOME as part of GNOME Bugzilla Housekeeping.

Reporter: If the problem that you reported here is still valid in a recent version of intltool we kindly ask you to report it again to so the intltool developers get notified about it.