ImageMagick-6.3.5 locale management + french.xml

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
Gozer404

ImageMagick-6.3.5 locale management + french.xml

Post by Gozer404 »

Edit: As it may not be so clear, the bug is: translations are not taken in account unless you used the patch shown at the end...

I discovered in ImageMagick-6.3.5 the new (?) locale and i18n stuff, I updated some config files and tried
to have a working translation.

Here are some changes I've done:
--- ImageMagick-6.3.5/config/locale.xml.EL 2005-08-11 04:21:51.000000000 +0200
+++ ImageMagick-6.3.5/config/locale.xml 2007-08-23 13:04:13.000000000 +0200
@@ -17,6 +17,7 @@
<include locale="et_EE.ISO-8859-1" file="estonian.xml" />
<include locale="fi_FI.ISO-8859-1" file="finnish.xml" />
<include locale="fr_FR.ISO-8859-1" file="francais.xml" />
+ <include locale="fr_FR.UTF-8" file="francais.xml" />
<include locale="fr_FR.ISO-8859-1" file="french.xml" />
<include locale="gl_ES.ISO-8859-1" file="galego.xml" />
<include locale="gl_ES.ISO-8859-1" file="galician.xml" />
--- ImageMagick-6.3.5/config/Makefile.am.EL 2007-01-21 02:58:31.000000000 +0100
+++ ImageMagick-6.3.5/config/Makefile.am 2007-08-23 13:04:13.000000000 +0200
@@ -33,6 +33,7 @@
config/configure.xml \
config/delegates.xml \
config/english.xml \
+ config/francais.xml \
config/locale.xml \
config/type.xml \
config/type-ghostscript.xml \

Then I created francais.xml (available on request !) ... but nothing was translated :-<

My final patch to have this working is:

--- ImageMagick-6.3.5/magick/locale.c.EL 2007-06-05 20:48:46.000000000 +0200
+++ ImageMagick-6.3.5/magick/locale.c 2007-08-23 13:04:13.000000000 +0200
@@ -589,6 +589,13 @@
register const char
*p;

+ /* LANG=C man 3 setlocale:
+ * On startup of the main program, the portable "C" locale is selected as
+ * default. A program may be made portable to all locales by calling set-
+ * locale(LC_ALL, "" ) after program initialization [../..]
+ */
+ (void)setlocale(LC_ALL, "");
+
locale=(char *) NULL;
p=setlocale(LC_CTYPE,(const char *) NULL);
if (p != (const char *) NULL)

What do you think of this change ? Is it really correct (the info in comments are from the manpage of setlocale) ?
Last edited by Gozer404 on 2007-09-04T03:47:38-07:00, edited 1 time in total.
Gozer404

Re: ImageMagick-6.3.5 locale management + french.xml

Post by Gozer404 »

Still fighting to translate english.xml to francais.xml:
a lot of messages were not found inside the code (ImageMagick-6.3.5-7) :

Code: Select all

for message in `grep "message name=" ./config/english.xml | sed -e 's/^ *<message name="//' -e 's/">.*$//' | sort -u`; do printf "+ $message : " ; grep -r $message . | egrep -v "^\.\/config|^\.\/www"  | wc -l; done
Parts of the result:
+ AnerrorHasOccurredReadingFromFile : 0
+ AnerrorHasOccurredWritingToFile : 0
+ ColorTypeNotSupported : 0
+ CompressNotValid : 0
+ DiskAllocationFailed : 0
+ DPSLibraryIsNotAvailable : 0
+ FPXLibraryIsNotAvailable : 0
+ FractalCompressNotSupported : 0
+ ImageColorspaceDiffers : 0
+ ImageExpected : 0
+ ImageInfoExpected : 0
+ ImageOpacityDiffers : 0
+ ImageResolutionNotDefined : 0
+ ImageSmallerThanKernelWidth : 0
+ IncompatibleSizeOfDouble : 0
+ InputImagesAlreadySpecified : 0
../..
+ UnsupportedLevel : 0
+ UnsupportedRLEImagefile : 0
+ XMLLibraryIsNotAvailable : 0
+ ZipCompressNotSupported : 0
In total 88 messages are not in the code...

Does this needs to be removed ?

I saw also a strange part in the xml file:
<Magnfiy>
<message name="Image">
Magnfiy image
</message>
</Magnfiy>
Shouldn't it be replaced by "magnify" ?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: ImageMagick-6.3.5 locale management + french.xml

Post by magick »

We will fix the problems you reported in ImageMagick 6.3.5-9 Beta within a day or two. Thanks for alerting us to the problems.
Gozer404

Re: ImageMagick-6.3.5 locale management + french.xml

Post by Gozer404 »

Complete patch for the above stuff is available here :
http://rpmfarm.free.fr/src/ImageMagick-6.3.5-patch
Post Reply