Ticket #49 (new defect)

Opened 3 months ago

Last modified 8 weeks ago

Use HTML5 @lang attribute appropriately

Reported by: garrison Owned by: garrison
Priority: normal Milestone:
Component: Generic wiki interface Keywords:
Cc:

Description

59cf1af9294c217ba16d0c2861252d0760b6df6d sets the @lang attribute on the top-level <html> element with the user-interface language, but we should set the attribute on elements that appear on the page in other languages as well.

Problem is, we currently have no way of specifying that a lesson, textwiki page, or any other resource is in a certain language, so this may require some generic changes to the data model system as well.

Change History

Changed 3 months ago by ian

Any changes to the data model system that we do here might also impact, or result from, changes for flash card storage.

The most natural part of the page to tag for @lang is the written sentence, which is also the basic element from the page to be re-used in flash cards.

If we built up from a model where each of these sentences is a view of a flash card element, maybe we could inherit upwards and get the picture choice's @lang tag from the @lang of the component pieces.

Changed 8 weeks ago by garrison

Actually, the picture choice itself doesn't need a @lang attribute; only things that are actually in the target language need a @lang. Looking through the elements we currently support (in ductus/resource/models.py), the only ones that would need this attribute are TextElement? and TextBlobElement?. It would be quite simple to add XML attributes to those elements.

However, the  HTML5 draft says we can just set the @lang on these elements to the empty string if the language is unknown. This might be better for now so that we don't have to ask everywhere in the UI what language a given element is in (i.e. beside each phrase, on the textwiki page, etc).

But maybe we should be collecting that information, and another way to collect it is just to ask once on the page where people enter phrases. We could even set the @lang as a toplevel attribute in our XML data store, and have it inherit just as HTML does, but I'm not sure how I feel about elements in our XML format having to look at their ancestors to determine context.

Note: See TracTickets for help on using tickets.