[Digikam-users] Digikam 2.9: Save image comments to file
Jean-François Rabasse
jean-francois.rabasse at wanadoo.fr
Sun Oct 14 13:02:12 BST 2012
Hello,
Some comments, as I happened to face the same problem Markus raised
(not with lang=de-DE, in my case with lang=fr-FR but it's the same
issue).
On Fri, 12 Oct 2012, Peter Albrecht wrote:
> > > > > 2012/10/11 Markus Ebert <strohhirn at gmx.de>: In the mean
> > > > > time, I figured out that saving comments with language
> > > > > "x-default" works, but using "lang=de-DE" does not.
>
> I tried it on my system an saving "de-DE" caption and title worked.
> So I would guess, it is not "digikam 2.9.0's fault".
It's not a problem with Digikam.
Problem comes from the way multi-languages support is implemented and
not very well defined in the standards.
(Not well defined = the implementation syntax is well defined
but the way to use it, and what metadata readers are expected to do
is a misty planet.)
First, XMP metadata provides two kinds of text fields :
- simple text string. This is a Unicode encoded characters string.
- text string with languages alternatives. This is an array of
strings with language specifiers, allowing metadata readers to
select one or the other value of a text, according to a prefered
language.
And the special "x-default" language specifier seems more or less
mandatory. The Adobe XMP specification says :
« Languages alternatives allow the text value of a property to be
chosen based on a desired language. Each item in a language
alternative array is a simple text value, which must have a
language qualifier associated with it. The language qualifier is a
property qualifier, as described in the previous section.
The qualifier name is xml:lang and its value is a string that
conforms to RFC 3066 notation.
XMP uses the "x-default" language code to denote the default value
for a language alternative. It should be the first item in the
array, so that generic RDF processors will also use it as the
default (according to the RDF default-is-first rule). »
This means that specifying a language for a text is not setting a field
value definition, but adding an *extra* value to the initial default
definition as a language alternative.
Digikam captions are saved into the xmp.dc.description field, and this
field is a multi languages array (as stated by the Dublin Core specs).
A theoretical ideal definition should be something like :
xmp.dc.description = "
lang=x-default Default value for the text,
lang=de-DE German translation for the same text,
lang=fr-FR French translation ... "
But when selecting a non default language, it's not what is written.
The XMP space will only contain something like :
xmp.dc.description = "
lang=de-DE Some text in German"
What happens when a definition contains only non default values ?
Nothing seems specified in the XMP standards, so it will be
metadata readers dependent. Some reading software will perhaps use the
single definition as a default value. Some other reading software will
consider the definition as empty because of the missing x-default,
and won't parse to find some readable text.
Or some readers may check the specified language, compare to
the default environment language and accept or reject.
Peter says saving de-DE title and caption works for him.
Peter, what's your default O.S. session language ? German maybe ?
As for me, as my O.S. is installed in English, en-US,
saving with fr-FR language doesn't work (except if I add first
the same text with lang=x-default).
The conclusion is that saved metadata *should always* provide a default
value for texts if compatibility is required.
Language specific values are extra (and must come after the default
definition, cf. XMP standard). This is just provided for a metadata reader
able to deal with various languages, other will use only the default value.
But another problem is that a metadata reading software doesn't always
know the default language used for text definitions. It could be made
possible by specifying some kind of xml:lang=... at the XML structure
level.
The bad new is that the libexiv2 used by DK to create a XMP section
doesn't export the current session language. :-(
Regards,
Jean-François
NB: Editing multi languages metadata is not a simple task. From the
Digikam GUI it requires selecting x-default, then typing the text and
clicking Apply, then selecting e.g. fr-FR, type the text, Apply, then
selecting en-US, type, Apply, etc.
And the nightmare comes when one wishes to change/edit existing data.
All existing alternatives must be redisplayed, edited, saved, but this has
to be done by hand (and mind); there's no help support to issue some kind
of warning, « You've modified the French text, but you also had a previous
English, German, Other, variant ! »
So, the safe and simple way is to stick to x-default.:-)
More information about the Digikam-users
mailing list