Forum: Ruby on Rails Localization: word wrap in tables?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
602f73f02a8b8abcf01ca093e1762006?d=identicon&s=25 Micah Bly (yak)
on 2006-02-27 04:36
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 <br/>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
84962fcce3fbde5aef15001d60e242ae?d=identicon&s=25 Michael Glaesemann (Guest)
on 2006-02-27 05:16
(Received via mailing list)
On Feb 27, 2006, at 12:36 , Micah Bly 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 Glaesemann
grzm myrealbox com
Ef3aa7f7e577ea8cd620462724ddf73b?d=identicon&s=25 Rob Biedenharn (Guest)
on 2006-02-27 15:24
(Received via mailing list)
At 2/26/2006 11:14 PM, you wrote:

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

Can you use any of the Unicode Zero Width spaces shown on this page?
http://www.unicode.org/charts/PDF/U2000.pdf

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

-Rob
602f73f02a8b8abcf01ca093e1762006?d=identicon&s=25 Micah Bly (yak)
on 2006-02-27 20:26
Rob Biedenharn wrote:

>
> Can you use any of the Unicode Zero Width spaces shown on this page?
> 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 <br>s but I'd prefer not
too...

Micah
5ce55767684e0cd1727db2b8b8975640?d=identicon&s=25 Steve Longdo (Guest)
on 2006-02-27 20:41
(Received via mailing list)
Have you tried the CSS whitespace: none attribute?

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

-Steve
http://www.stevelongdo.com
602f73f02a8b8abcf01ca093e1762006?d=identicon&s=25 Micah Bly (yak)
on 2006-02-28 02:32
Steve Longdo 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
This topic is locked and can not be replied to.