<language> tag required in rss
-
The folks over at https://syndic8.com have suggested that WordPress isn’t generating valid feeds because they lack the <language> tag as is expected. I looked at a few feeds generated by 1.2.1 and it appears they are correct. I suspect it is easy to add this to the next release?? I suppose you need to add a place to set it under options to the proper language.
-
At line 24 of WordPress 1.2.1’s file wp-rss2.php a language tag (with
the proper language) could easily be added to get a manual correction
(** added so you see the line, not because you actually insert that in
the file):
<channel>
<title><?php bloginfo_rss('name') ?></title>
<link><?php bloginfo_rss('url') ?></link>
** <language>en-us</language> **
<description><?php bloginfo_rss("description") ?></description>
<copyright>Copyright <?php echo mysql2date('Y', get_lastpostdate());
?></copyright>
If someone is reviewing a WordPress generated feed, that would be a
suggested correction I believe. However, there is a better way.
<channel>
<title><?php bloginfo_rss('name') ?></title>
<link><?php bloginfo_rss('url') ?></link>
** <language><?php echo get_settings('rss_language'); ?></language> **
<description><?php bloginfo_rss("description") ?></description>
<copyright>Copyright <?php echo mysql2date('Y', get_lastpostdate());
?></copyright>
This would get the rss language from the mysql db and insert it. In
fact, there is a second file: wp-commentsrss2.php that generates the
comments rss. The latest version does have a language tag inserted, but
it uses “en” and not “en-us” format. That is because they store that
value in the db as part of the set up.
That is generated with this:
<language><?php echo get_settings('rss_language'); ?></language>
There appear to be several other files that use the ‘rss_language’
including wp-atom.php.
The options gui in wordpress doesn’t appear to allow you to change your
language setting. It is in the db “options” table at option_id 22 for
those wishing to manually fix it via phpmyadmin of the like.
Hope this is helpful.See also bug 367, which I submitted last night.
Looking at the code for WP 1.3 — which removes the rss_language setting from the database as part of the upgrade process — I suspect the setting was left over from an earlier version, with the GUI removed in 1.2 and the option itself removed in 1.3.
I’m hoping, though I couldn’t find it, that there’s a general language setting somewhere in the current code which can be used in its place.
(Disclaimer: I’m not a WP developer, I just reported the bug and attempted a patch.)The spec pretty clearly says that
<language>
is optional. Where did the syndic8 folks suggest WP’s feeds were invalid?what about bilingual blogs then ? ??
I guess that another possibility is to add the language tag to the post box and store a language tag for each post. To my knowledge nothing like this exists in WordPress at current. I am sure I will be promptly corrected if I am wrong.
With 1.2.1 there is no language tag provided with rss, there is for comments and atom feeds … and I guess they assume they are all in english unless you make a change.There’s little benefit to leaving out the language tag. Put one in an it makes the feed easier to find and to translate. If the feed itself has a language tag there’s usually no need to have one within each item. Allow for a blog-wide language default and put the tag in the channel.
s/required/recommended/
It may not be required, but it would certainly be useful, particularly for feed discovery, accessibility, etc. If WP already stores the (default) language somewhere, it should be easy to add the tag. If not…, well, it probably should.
As for multi-language blogs, the RSS spec states that <language> only applies to the channel element, not to individual items, so that would be a case where it would be better to leave the language tag out or to pick the more-frequently-used language (if there is one).On a side-note, it seems the RSS generator for this forum isn’t escaping HTML/XML characters in the title element, breaking the feed for this thread. (everything looks like
<title>www.ads-software.com thread: <language> tag required in rss</title>
)Well it’s my opinion that bad or false metadata is worse than no metadata at all. I don’t want to clutter up the interface to cater to an optional element of a data format. If people think this is important (and they blog in one primary language) they can add this to their feed templates pretty easily.
This is also an accessibility issue. When there is a primary language for a document (be it HTML, RSS, or anything else), it’s advisable to indicate that for the benefit of screen readers, search engines, aggregators, etc.
OK, so it’s an easy one-line addition to each of several files. But most people publishing with WP probably have never even read the RSS spec, probably don’t even know that this tag exists. They aren’t going to add it without a massive education campaign like the Web Standards Project or Mozilla evangelism projects. Even then, it’ll only be those comfortable with hacking PHP and/or XML. For many, the whole purpose of using a publishing tool like WordPress is so they don’t have to worry about coding!
Alternatively, a small, easy change can be made in the authoring tool that will make their feeds easier to index and thus easier to find. IMO it doesn’t even need a UI, as long as the language is stored somewhere. It would be one of those sensible defaults.
As for “bad or false” metadata — I don’t think anyone here is advocating that. If the feed contains multiple languages, it seems to me that would be the case for leaving out the tag.
The only reason I can see that this feature would not be easy to add is if WordPress does not know what language it is being used in. I have been assuming that, with the localization push, WP would have this stored somewhere. If not, please correct me.Lot’s of people who blog in other languages don’t use the localization framework, which is mainly for the administration interface. If someone doesn’t mind the admin being in English they probably wouldn’t set up localisation.
Just because you don’t use other languages doesn’t mean it’s “clutter”. A simple drop-down of languages is an easy thing to add to any interface no matter how complex. Let the blog have a default language and propogate the selection of it into the default templates. Make it a no-brainer for the users of the tool and move on. There are certainly more important things for WP to argue about besides depriving the non-english speaking users of WP from EASY selection of their language for output.
WP doesn’t assume English any more than it assumes any other languages. That’s the point, it doesn’t presume to know what language you’re writing it when it may be a language there’s no localization for, or you may switch from post to post, or you may use one of the hacks to have multiple versions of each post.
Well to get into the new podcasting thing (you seen around and on this forum) everybody knows weblogs.com which you can ping if you post to your log.
Now when you build in the enclosure tag for podcasting purpose you can ping to the newly creaded audio.weblogs.com. There is the language tag required for the feed to get listed at audio.weblogs.com.
So while it’s optional you really should consider ??Again to say that leaving this out causes misses in indexing that would help WordPress blogs get found. If you have not yet fixed this, please consider adding the language tag. Ask as part of the five minute install. I love wordpress, but this is a shortcoming and many users of it aren’t familiar enough to add it manually. Plus each time you add something like this to templates manually, it complicated update issues.
- The topic ‘<language> tag required in rss’ is closed to new replies.