format-date() with language="en-GB" prefixes the output with "[Language: en]"
Raised by direct email
Details: When we call format-date function, we pass language parameter as en-gb. I have changed it to en, then it works fine.
Documentation states: The $language argument specifies the language to be used for the result string of the function. The value of the argument should be either the empty sequence or a value that would be valid for the xml:lang attribute (see [XML]). Note that this permits the identification of sublanguages based on country codes (from [ISO 3166-1]) as well as identification of dialects and of regions within a country.
But it is not clear to me what format should I use for specifying sublanguages.
What format is supported by Saxon for language parameter of format-date function?
Any ideas for what is causing our problem with date strings handling?
#7 Updated by Michael Kay 12 months ago
The conditions for the prefix to be output are that:
- the language argument is explicitly specified
- the language requested is not "en"
- the numbering is being performed using the Numberer_en class.
These conditions weren't satisfied in my tests because it was using the ICU numberer (which is only available under PE/EE).
Let's remind ourselves what the spec says: If the fallback representation uses a different language from that requested, the output string must identify the language actually used, for example by prefixing the string with [Language: Y] (where Y is the language actually used) localized in an implementation-dependent way.
It's not entirely clear, but "fallback" here presumably means that an explicit language was requested for which the product has no support.
I think there are two things wrong with the current code. (a) we're interpreting "uses a different language from that requested" too strictly; a different sublanguage should be OK. (b) we're not outputting any message if we're using ICU.
#8 Updated by Michael Kay 12 months ago
I'm reluctant to start outputting the prefix in cases where wasn't output before, because users would complain. So despite the fact that it's a non-conformance, I think that I'll keep the first test: i.e., we'll never output the prefix where ICU is used.
I'll change the second test so we only output the prefix if the first component of the requested language is something other than "en".
Please register to edit this issue