The default bug view has changed. See this FAQ.

Add L20n bindings for HTML5

ASSIGNED
Assigned to

Status

()

Core
Localization
ASSIGNED
5 years ago
5 years ago

People

(Reporter: gandalf, Assigned: gandalf)

Tracking

(Blocks: 1 bug)

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

Comment hidden (empty)
(Assignee)

Comment 1

5 years ago
Created attachment 576343 [details] [diff] [review]
WIP 1

WIP that works with code from bug 704500 to make HTML5 localizable
Assignee: nobody → gandalf
Status: NEW → ASSIGNED
Attachment #576343 - Flags: feedback?(hsivonen)
(Assignee)

Updated

5 years ago
Version: unspecified → Trunk
(Assignee)

Comment 2

5 years ago
Created attachment 576344 [details] [diff] [review]
WIP 1

d'uh, that was just hg stat, not hg diff. Proper WIP patch
Attachment #576343 - Attachment is obsolete: true
Attachment #576343 - Flags: feedback?(hsivonen)
Attachment #576344 - Flags: feedback?(hsivonen)
Comment on attachment 576344 [details] [diff] [review]
WIP 1

>         } else if (nsHtml5Atoms::link == aName) {
>           nsString* rel = aAttributes->getValue(nsHtml5AttributeName::ATTR_REL);
>+          nsString* type = aAttributes->getValue(nsHtml5AttributeName::ATTR_TYPE);
>           // Not splitting on space here is bogus but the old parser didn't even
>           // do a case-insensitive check.
>           if (rel && rel->LowerCaseEqualsASCII("stylesheet")) {
>             nsString* url = aAttributes->getValue(nsHtml5AttributeName::ATTR_HREF);
>             if (url) {
>               nsString* charset = aAttributes->getValue(nsHtml5AttributeName::ATTR_CHARSET);
>               mSpeculativeLoadQueue.AppendElement()->InitStyle(*url,
>                                                     (charset) ? *charset : EmptyString());
>             }
>+          } else if (type && type->LowerCaseEqualsASCII("intl/l20n")) {

Instead of dispatching on the type attribute and minting a new mediatype (if you do mint a new media type, it should be text/l20n, not intl/l20n), it would make more sense to mint a new rel token, such as "l10n" and check for that. (Note that in principle, you should check if any space-separated token in the rel value matches your token. The stylesheet check above is only an optimization and, therefore, cheats and doesn't deal with rel values that have multiple tokens.)

>+        if (localName->Equals(NS_LITERAL_STRING("l10n-id"))) {

You should add l10n-id to nsGkAtomList and then do a pointer comparison between localName and nsGkAtoms::l10nid here.

>+    case eTreeOpL20nResourceAdded: {
>+      PRUnichar* buffer = mOne.unicharPtr;

You need to add 
case eTreeOpL20nResourceAdded:
to the part of the nsHtml5TreeOperation's destructor that delete[]s mOne.unicharPtr;

Also, since this isn't ready to be exposed to Web content without the shadow tree stuff, this implementation needs a check to see if the document is a chrome doc so that the l20n stuff only runs for chrome docs until we are ready to expose this to Web content in general.
Attachment #576344 - Flags: feedback?(hsivonen) → feedback+
You need to log in before you can comment on or make changes to this bug.