-
Notifications
You must be signed in to change notification settings - Fork 79
Support complex DOM trees in overlays #288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for kicking it off! My first thought is that we should limit such DOM Fragments to be white-listed by the developer. In other words, while I expect text level semantics to be allowed in every element, I expect such model to be only allowed when the developer specifically sets some attribute to say |
I agree that we should do this, and that we should make it opt-in.
I'd say no. As Zibi said, I'd make this opt-in.
Can we classify these errors? Might also depend on whether opt-in is generic, or specific. Like,
Yep, totally.
I think so, yes. |
Example of a use case: https://bugzilla.mozilla.org/show_bug.cgi?id=1626064 |
Because: * Sometimes, the line between UI localization and content localization is thin. There are cases in which we should allow localizing longer, structured text with nested overlays. This commit: * Adds a prop, nestedElems, to LocalizedProps and an arg, arg.nestedElems, to Localized.getElement() that allows consumers to opt-in to recursively parse nested elements in overlays. By default this is disabled.
Sometimes, the line between UI localization and content localization is thin. A good example is
netError.dtd
in Gecko:Clearly in this case, the UI benefits from a more structured translation. In the past, we focused the design of Fluent on short messages with little structure and we avoided longer forms. With UIs like
netError
, we might want to find a middle-ground solution for conveniently localizing UI which features longer text and some structure.The implementation of overlays in
fluent-dom
currently supports two groups of elements:data-l10n-name
attribute, as long as a corresponding element is present in the source, andFurthermore the current implementation doesn't allow any nested elements. A
<li>
inside of a<p>
wouldn't work even if these elements were allowed.I'd like to start a discussion about what it would take to support UIs like
netError.dtd
. A few questions to get us started:The text was updated successfully, but these errors were encountered: