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 610934 - Improve translations for the wizard files
Improve translations for the wizard files
Status: RESOLVED FIXED
Product: anjuta
Classification: Applications
Component: plugins: project-wizard
git master
Other Linux
: Normal normal
: ---
Assigned To: Sébastien Granjoux
Anjuta maintainers
Depends on:
Blocks:
 
 
Reported: 2010-02-24 12:26 UTC by Gabor Kelemen
Modified: 2010-05-31 19:23 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
diff of the regenerated file (4.37 KB, patch)
2010-03-03 18:55 UTC, Gabor Kelemen
reviewed Details | Review

Description Gabor Kelemen 2010-02-24 12:26:53 UTC
This commit: http://git.gnome.org/browse/anjuta/commit/?id=0a58b834083b245e088cc593e2061db694af9fc9

removed a generated file. Now POTFILES.in is broken, as there is AFAIK no automatic way to regenerate this file on d-l - it can not run the perl script to extract the strings to the .h file.

I guess the simplest way to keep the wizard templates translatable would be to add this file back. And of course, updating it before each major release, around string freeze time :).
Comment 1 Johannes Schmid 2010-02-24 15:03:32 UTC
That's ugly. I don't generated files in the repository. Can't damned-lies be a bit more clever?
Comment 2 Johannes Schmid 2010-02-24 15:17:02 UTC
Looking a bit further, what exactly does damned-lies need to know? It seems that it can skope somehow with intltool-extract stuff so this should be difficult to add. Quoting from the Makefile.am:

translatable-strings.h: $(wizard_files_DATA)
	perl $(srcdir)/extract-translatable-strings.pl $(wizard_files_DATA) > translatable-strings.h
Comment 3 Gabor Kelemen 2010-02-25 20:35:30 UTC
I don't like storing generated files in vcs either, but I'm not sure that one month before release is a good time to start inventing creative ways to generate it...
Comment 4 Johannes Schmid 2010-02-26 17:07:47 UTC
The file was always generated. For a dubios reason it was in git while it shouldn't have been.

Everything is fine for make distcheck so this is only a damned-lies problem, nothing that is wrong in the package.
Comment 5 Claude Paroz 2010-02-26 17:19:23 UTC
Well damned-lies could of course try to cope with this issue. However, I think every GNOME module should try to comply as much as possible to the intltool tool chain, without requiring to any supplemental script magic. There are always translators which update their po files with an intltool-update command in the po directory.

Did you try any XML mode from intltool (e.g. [type:gettext/xml]) ?
Comment 6 Claude Paroz 2010-02-28 20:15:16 UTC
Currently, intltool-update blocks on the unexisting translatable-strings.h file. Johannes, could you fix this?
Comment 7 Johannes Schmid 2010-02-28 20:56:04 UTC
Well, I am aware of that because this file is generated using extract-translable-strings.pl (see comment #2). I will try to figure out if we could use intltool instead to get the translation but I am not sure.

But what can we do if intltool is not able to extract the translations and a generated file in unacceptable in git because it will become outdated or it will be catched in completely unrelated commits?
Comment 8 Johannes Schmid 2010-02-28 21:03:12 UTC
Checking further, as the .wiz files are actually xml files with the _ convention that shouldn't be a big deal for intltool. I just wonder if it can scope with the wiz.in => wiz instead of xml.in => xml.

I won't be able to have a look at it till wednesday...
Comment 9 Gabor Kelemen 2010-02-28 23:26:28 UTC
The .wiz files are not well-formed xml files, so intltool-extract can not parse them:

gabor@gabor-desktop:~/tmp/anjuta/po$ intltool-extract --type=gettext/xml ../plugins/project-wizard/templates/gtk.wiz
Generating C format header file for translation.

junk after document element at line 12, column 0, byte 352 at /usr/lib/perl5/XML/Parser.pm line 187

This was the problem in bug #398035, then this perl script was invented to work it around.
Comment 10 Claude Paroz 2010-03-01 14:59:46 UTC
Maybe the bug is to used XML-like format and not make it XML compliant. However, there is not much to do to make them XML compliant: add a root element and replace quotes in attribute values. Would this be possible?
Comment 11 Sébastien Granjoux 2010-03-01 20:50:22 UTC
The .wiz files are not XML file.

They are templates those are going through a kind a preprocessor (autogen) to generate XML file (almost as I have forgotten to put a root node).

By example in minimal.wiz you have something like

[+IF (=(get "HavePackage") "1")+]
<page name="packages" _label="Configure external packages" _description="Configure external packages">
...
[+ENDIF+]

I'm afraid it's not obvious to transform this to a valid XML file. I don't know if I can change this to really match XML syntax.

Then, another issue is that adding the translation for these files inside Anjuta is not right, because it means that we cannot translate .wiz file distributed outside Anjuta. The translation should be inside the .wiz file, like it's done for .plugin file.


I'm ready to work on this but if I'm changing the .wiz file format, I would like to fix both problems at the same time. I have some idea for the first issue, but I don't know how to solve the second one. I'm afraid that using a kind of ini format for .wiz file will be difficult. Is it possible to include translation in a XML file ?

But, I'm afraid that it's too late to do such changes for Anjuta 2.30. I'm not sure I will be able to find a solution in one week and it's probably too much hassle for translators.
Comment 12 Johannes Schmid 2010-03-03 10:42:08 UTC
OK, I added the file back for now though it's really ugly.

Translation in xml files are now problem, intltool can extract them from xml.in files and creates an xml file for each language.

I don't know about all this "if"-stuff though.

Changed bug-title!
Comment 13 Gabor Kelemen 2010-03-03 11:07:38 UTC
Thanks Johannes, but didn't just forgot to push it? I can't see it in the log: http://git.gnome.org/browse/anjuta/log/
Comment 14 Johannes Schmid 2010-03-03 16:35:09 UTC
Sorry...
Comment 15 Gabor Kelemen 2010-03-03 18:55:21 UTC
Created attachment 155158 [details] [review]
diff of the regenerated file

oops, I forgot to mention, while we are at it, it would be nice to update this file :)
Comment 16 Johannes Schmid 2010-03-03 20:36:43 UTC
Review of attachment 155158 [details] [review]:

I regenerated the file here so didn't use the patch. It should be up-to-date now anyway.
Comment 17 Sébastien Granjoux 2010-03-09 21:02:45 UTC
I have done some investigation and I think the situation is better than expected.

The XML parser in intltool accept invalid XML file too. I have been able to use it on a .wiz file after just adding a root node and changing some quote. I think we can keep almost the same format, just supporting an optional root node. 


Then using intltool-merge, it is possible to include the translation directly in the .wiz file. It creates element in the xml file, so I need to improve the parser to read these new elements and use them for translation instead of using gettext.


When this is done, it makes sense to distribute project templates outside Anjuta. But it needs several files, I think we can rename a .tgz archive of all needed files as anjuta.wiz.tgz. Then, if we use such file in anjuta command line, we automatically expand the archive, install it in the user directory and start the project wizard inside.
Comment 18 Sébastien Granjoux 2010-05-31 19:23:49 UTC
I have added a root node (optional to keep compatibility) in all .wiz file and change the quote character when needed.

The extract-translable-strings.pl script and the translatable-strings.h file are not needed anymore, I have removed them.

I have checked that intltool-merge is able to read the .wiz file and merge the translation but please check that everything is fine.

The .wiz files are still not completely valid XML files and finding the right character for quote is a not always obvious as the files are used by different languages (xml, autogen, guile).