OriginProtocol / origin

Monorepo for our developer tools and decentralized marketplace application
https://www.originprotocol.com/developers
MIT License
652 stars 196 forks source link

Long translations cropped/overlapping #405

Open wanderingstan opened 6 years ago

wanderingstan commented 6 years ago

As is typical, German has über-long words which break some layout elements:


In listing card

image

Full word is "Verkauft".


Footer

image

wanderingstan commented 6 years ago

I confirmed that adding a "soft hyphen" allows the word to get hyphenated here, and added to crowdin.

https://crowdin.com/translate/originprotocol/63/en-de#q=product+brief

<a href="https://www.originprotocol.com/de/product-brief" style="
    word-wrap: normal;
">Produkt&shy;beschreibung</a>

image

jordajm commented 6 years ago

FWIW - this is the kind of thing we could catch during development if we do this: https://github.com/OriginProtocol/origin-dapp/issues/397

wanderingstan commented 6 years ago

Just noticed in Japanese also: image

micahalcorn commented 6 years ago

We certainly need to do a pass on the entire DApp, but I think that specifically in regard to that sold tag, Aure wants to scrap it in favor of something else.

mek32390 commented 6 years ago

@wanderingstan to confirm, are you proposing that when we find an irregularly long word that breaks the layout, the correct step to take is to add/approve a translation of that word within crowdin that includes a soft hyphen?

wanderingstan commented 6 years ago

Ugh, apparently not: The soft hyphen code isn't making it out of Crowdin: image

@mek32390 - If we can figure out how to include soft hyphens, they are the "correct" approach to fixing cases where the long word can safely be wrapped to a 2nd line.

wanderingstan commented 6 years ago

EDIT: Turns out we just need to encode the characters in the JSON way. A soft hyphen is thus represented as \u00AD, and the translation of Product Brief in German is Produkt\u00ADbeschreibung

@jordajm Do you know if html codes are being stripped by react-intl, and/or if there is some way to stop that? It looks like the html code &shy; is getting exported from crowdin and picked up by our json here: https://github.com/OriginProtocol/origin-dapp/blob/a9348de77f62c9192a150c0531bf350e2305f825/translations/languages/de-DE/all-messages.json#L28

So the problem must be that it gets escaped to t&amp;shy; before rendering.