atom
atom copied to clipboard
Support of language attribute through xml:lang
Hi, nice project. I was wondering if it would be possible to either support user-defined attributes on the <feed>
and <entry>
tags, such as xml:lang="en"
, or maybe it would be best to have a "lang" ("language"?) field somewhere (in Feed
and Entry
).
The xml:lang
attribute is mentioned in Introduction to Atom - About this document which links to 2.12 Language Identification. Static Site Generators such as Zola also make use of this attribute (but I'd like to move away from it), so it would be nice if this crate somehow offered the possibility of setting the document's language. In the future, we could also decide what to do with the hreflang
attribute.
I took a look at both the documentation and the code, but as far as I can tell, I'm only able to define namespaces
and not actually arbitrary attributes
for the <feed>
tag. Thank you.
xml:lang
is already supported by this crate in <content> tags
and text fields in general.
Ah, my bad, I missed that. Would it be worthwhile to put it in Feed
as well, or does having it there make not much sense?
It depends on the pattern of usage of the crate. If you create a feed, it makes less sense. OTOH if you consume a feed and care about language, you may miss it, so it makes a lot of sense.
While Atom spec allows to have xml:lang
and xml:base
on ANY element (e.g. <category>
), my judgement is that it is a must to support them in a <feed>
tag and less important to support in other tags.