# Localization: word wrap in tables?

**URL:** <https://www.ruby-forum.com/t/localization-word-wrap-in-tables/74017>\
**Category:** Rails\
**Created:** [February 27, 2006, 4:36am UTC](https://www.ruby-forum.com/t/localization-word-wrap-in-tables/74017 "2006-02-27T04:36:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![yak](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/b3f665/32.png) [@yak](https://www.ruby-forum.com/u/yak)\
**Post date:** [February 27, 2006, 4:36am UTC](https://www.ruby-forum.com/t/localization-word-wrap-in-tables/74017/1 "2006-02-27T04:36:15Z")

</div>

I am a Rails noob, working on bringing a legacy db system into the 21st  
century. I want to localize the UI for two languages (EN/JA). Since I  
am already using the salted user system, I have been playing around with  
T. Fuchs’ localization module. Nice and simple, already up and working.

But here’s the problem: Japanese text is wrapping weirdly in table  
cells. I could set nowrap in all the cells, but that isn’t right either.  
So I’m wondering if anyone knows of a way to insert some kind of  
invisible character between words that would let it wrap at spots that  
you specified (in your translation yaml). If this isn’t clear, you  
have to know that Japanese doesn’t have spaces between characters/words,  
and that there are specific rules as to where you can break text. I  
could do   
s, but there will be cases where you don’t want it to  
break, and it doesn’t need to break… So some kind of char that isn’t  
visible to humans, but the browser could see as a legit break char. And  
err… one that is going to be compatible with the localization module  
and it’s translation yamls.

Micah

---

<div class="post-metadata">

**Author:** ![yak](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/b3f665/32.png) [@yak](https://www.ruby-forum.com/u/yak)\
**Post date:** [February 27, 2006, 5:16am UTC](https://www.ruby-forum.com/t/localization-word-wrap-in-tables/74017/2 "2006-02-27T05:16:29Z")

</div>

On Feb 27, 2006, at 12:36 , Micah B. wrote:

> But here’s the problem: Japanese text is wrapping weirdly in table  
> cells. I could set nowrap in all the cells, but that isn’t right  
> either.

I’m pretty sure this is a browser issue. Text strings are broken at  
spaces and line breaks. For languages without spaces to separate  
words (such as Japanese), the browser breaks at (nearly) arbitrary  
characters. To do anything else would require the browser to include  
a sentence parser to find where to break a line. Alternatively, you  
could insert breaks yourself. (Perhaps browsers will prefer to break  
at an tag, such as an empty span element?) This of course would  
require _you_ to code a parser for Japanese (or find a library that  
would do this for you).

I think you’ll find that many Japanese websites don’t worry about  
this too much. (Or are there specific breaks you’re worried about?)

Good luck!

Michael G.  
grzm myrealbox com

---

<div class="post-metadata">

**Author:** ![yak](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/b3f665/32.png) [@yak](https://www.ruby-forum.com/u/yak)\
**Post date:** [February 27, 2006, 3:24pm UTC](https://www.ruby-forum.com/t/localization-word-wrap-in-tables/74017/3 "2006-02-27T15:24:39Z")

</div>

At 2/26/2006 11:14 PM, you wrote:

> a sentence parser to find where to break a line. Alternatively, you  
> Michael G.  
> grzm myrealbox com

Can you use any of the Unicode Zero Width spaces shown on this page?

> **[U2000.pdf](https://www.unicode.org/charts/PDF/U2000.pdf)**
>
> 301.86 KB

200B - Zero Width Space  
200D - Zero Width Joiner  
2060 - Word Joiner

-Rob

---

<div class="post-metadata">

**Author:** ![yak](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/b3f665/32.png) [@yak](https://www.ruby-forum.com/u/yak)\
**Post date:** [February 27, 2006, 8:41pm UTC](https://www.ruby-forum.com/t/localization-word-wrap-in-tables/74017/4 "2006-02-27T20:41:21Z")

</div>

Have you tried the CSS whitespace: none attribute?

[http://www.w3.org/TR/REC-CSS2/text.html#white-space-prop](http://www.w3.org/TR/REC-CSS2/text.html#white-space-prop)

-Steve  
[http://www.stevelongdo.com](http://www.stevelongdo.com)

---

<div class="post-metadata">

**Author:** ![yak](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/b3f665/32.png) [@yak](https://www.ruby-forum.com/u/yak)\
**Post date:** [February 27, 2006, 8:26pm UTC](https://www.ruby-forum.com/t/localization-word-wrap-in-tables/74017/5 "2006-02-27T20:26:30Z")

</div>

Rob B. wrote:

> Can you use any of the Unicode Zero Width spaces shown on this page?  
> [http://www.unicode.org/charts/PDF/U2000.pdf](http://www.unicode.org/charts/PDF/U2000.pdf)
> 
> 200B - Zero Width Space  
> 200D - Zero Width Joiner  
> 2060 - Word Joiner

I actually tried a bunch of those, and also the “hair space” and “thin  
space”. Camino doesn’t seem to recognize the joiner ones, or at least,  
it doesn’t do anything useful with them as far as I could tell. There’s  
a zero width “break” char as well. It doesn’t actually wrap on that, or  
on any of the non ascii 32 space characters when doing Japanese, it just  
wraps whereever it feels like it.

Michael:

I was actually willing to put the breaks in myself, I’m only talking  
about a few UI elements, but even hand-coding it doesn’t seem to make  
any difference (see above). I could still do   
s but I’d prefer not  
too…

Micah

---

<div class="post-metadata">

**Author:** ![yak](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/b3f665/32.png) [@yak](https://www.ruby-forum.com/u/yak)\
**Post date:** [February 28, 2006, 2:32am UTC](https://www.ruby-forum.com/t/localization-word-wrap-in-tables/74017/6 "2006-02-28T02:32:31Z")

</div>

Steve L. wrote:

> Have you tried the CSS whitespace: none attribute?

Steve,

No, I hadn’t tried that (wasn’t even aware of it). Having taken a look  
at the spec there, I’m going to guess that using “pre” would work fine  
for JA (if I salted it with the correct break-here char, but I think it  
would wreak havoc for somebody looking at the EN interface. I’ll give  
it a shot though… Sometimes you never know.

Micah
