question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Non-breaking space ( ) and other special chars

See original GitHub issue

Both v-t and $t doesn’t support special chars like   and so on. Using $t with v-html works well, but frequently it is needed as a “plain text” (without rendering HTML). By the way another localization plugins (e.g. vue-multilanguage) support this feature.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:15 (1 by maintainers)

github_iconTop GitHub Comments

15reactions
avenla-mvirkkunencommented, Apr 10, 2018

  is an HTML entity and it isn’t supposed to work outside of v-html. If you want a non-breaking space, use a JavaScript escape code and not an HTML entity. The one for a non-breaking space is \xa0

For most characters just paste the character in the text - all modern tools support Unicode fine. For things like non-breaking spaces the escape codes are useful because otherwise they’re kind of hard to see as they look just like normal spaces most of the time.

4reactions
imagoiqcommented, Apr 28, 2020

If we can avoid to ask translators to add such entities or special characters, I think we all agree that it is better. I’ve just found out that there is a posTranslation constructor option so the following work really well:

postTranslation: (str) => str.replace(' ?', '\xa0?').replace(' !', '\xa0!')
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Add a Non-breaking Space with the   Character ...
In HTML, you can't create an extra blank space after the space ( ) character with the spacebar. If you want 10 blank...
Read more >
&nbsp and HTML Space Challenges and Tricks | Mailtrap Blog
Nbsp stands for non-breaking space, meaning that strings separated with this entity will not be separated and put into separate lines. But ...
Read more >
Non-breaking Space HTML Symbol, Character and Entity Codes
HTML symbol, character and entity codes, ASCII, CSS and HEX values for Non-breaking Space, plus a panoply of others.
Read more >
Non-breaking space - Wikipedia
In word processing and digital typesetting, a non-breaking space, , also called NBSP, required space, hard space, or fixed space is a space...
Read more >
“ ” U+00A0 No-Break Space (NBSP) Unicode Character
Unicode Character “ ” (U+00A0) ; Name: No-Break Space (NBSP) ; - Formerly: Nbsp ; Unicode Version: 1.1 (June 1993) ; Block: Latin-1...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found