Skip to content

Allow linebreaks in i18n translations #27809

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

Closed
armaserg opened this issue Dec 22, 2018 · 6 comments
Closed

Allow linebreaks in i18n translations #27809

armaserg opened this issue Dec 22, 2018 · 6 comments
Labels
area: i18n Issues related to localization and internationalization
Milestone

Comments

@armaserg
Copy link

armaserg commented Dec 22, 2018

🚀 feature request

Description

This problem already was discussed here: #25242
But it was closed without resolving it. Also, @vicb in #23053 wrote:

We don't monitor close PRs nor issues

so, I have to open new ticket for this.
Translations for different languages could have different length.
In some cases original english phrase nicely fits in one line, but german translation could be much longer, so for site design it will be better to break it to 2 lines after specific word. But it is not possible :(

If I add "<ph name="LINE_BREAK"><ex>&lt;br&gt;</ex></ph>" - build will throw "parse errors: Unexpected tag"
If I add "<br>" or "&lt;br&gt;" - it will add escaped version of tag.

Describe the solution you'd like

Allow <br> tags in translations. Maybe also <b> and <i> tags.
<i> tag - because in some translations we should italicize foreign words and phrases https://intelligentediting.com/blog/how-to-decide-if-you-should-italicize-foreign-words-and-phrases/

@pkozlowski-opensource pkozlowski-opensource added the area: i18n Issues related to localization and internationalization label Dec 23, 2018
@ngbot ngbot bot added this to the needsTriage milestone Dec 23, 2018
@ocombe
Copy link
Contributor

ocombe commented Jan 2, 2019

@AndrewKushnir do you know if it's possible in ivy with runtime i18n to add a line break to a translation with something like \n?

@trotyl
Copy link
Contributor

trotyl commented Jan 3, 2019

@ocombe One can just apply white-space to render \n as line break, no need for special handing in the source.

@ocombe
Copy link
Contributor

ocombe commented Jan 3, 2019

yes, I just wanted to make sure that they weren't striped or anything

@trotyl
Copy link
Contributor

trotyl commented Jan 3, 2019

Yep, they're also stripped by default as if being the original source code, so ngPreserveWhitespaces or equivalent configuration is required to force preserve them.

@AndrewKushnir
Copy link
Contributor

As @trotyl mentioned, the combination of ngPreserveWhitespaces and white-space CSS rule should help achieve the necessary result. Thank you.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: i18n Issues related to localization and internationalization
Projects
None yet
Development

No branches or pull requests

5 participants