Skip to content
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

Make final decision between   \u00A0 or class="nowrap" #535

Closed
groovecoder opened this issue Oct 17, 2018 · 6 comments
Closed

Make final decision between   \u00A0 or class="nowrap" #535

groovecoder opened this issue Oct 17, 2018 · 6 comments
Assignees
Labels

Comments

@groovecoder
Copy link
Member

In #486 we never quite finalized whether to use &nbsp;, \u00A0 or <span class="nowrap"> for strings with spaces that shouldn't be broken.

There seem to be l10n and a11y pros and cons to each method. Let's list them out and discuss them here and make the final decision.

@Pike
Copy link

Pike commented Oct 17, 2018

Generally, exposing dom fragments to l10n is gonna be a source of errors. Often it's worth the risk, but in this case, I think just generally using unicode to work for us sounds good.

Would there be any counter-indications where nbsp breaks, but CSS nowrap works?

@flodolo
Copy link
Collaborator

flodolo commented Oct 18, 2018

I think the options are between UTF-8 non breaking space and the nowrap class, while the HTML shouldn't on the table?

@flodolo
Copy link
Collaborator

flodolo commented Oct 18, 2018

Personally I would go with one product name and unicode

# {"\u00A0"} is a non-breaking space, and it's used to prevent the product name
# from being displayed on two lines
-product-name = Firefox{"\u00A0"}Monitor

@stasm
Copy link
Contributor

stasm commented Oct 18, 2018

AFAICT, the fluentFormat helper inserts the translation content verbatim into the templates. Do Handlebars do anything to prevent broken markup? If not, the <span class="nowrap"></span> approach comes with the risk that a broken translation messes up the markup of the template. Using HTML entities is safer in this regard, but still suffers from being transparent to Fluent. For Fluent, any HTML markup in the translation is just regular text; there isn't any additional validation step for it.

OTOH, using the Unicode escape sequence ({"\u00A0"}, which is a feature of the Fluent syntax, means that we can detect errors in the translation very early in the lifecycle of the translation: Pontoon won't even save a translation with a syntax error in it.

@groovecoder groovecoder added this to the l10n Launch milestone Oct 25, 2018
@groovecoder
Copy link
Member Author

Pulling this out of l10n launch milestone, unless someone thinks we need to ship with this?

@groovecoder groovecoder removed this from the l10n Launch milestone Oct 30, 2018
@lesleyjanenorton
Copy link
Collaborator

Closing - I think we've reached a good working consensus on markup in strings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants