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 -- Posted via http://www.ruby-forum.com/.
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
At 2/26/2006 11:14 PM, you wrote:>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 comCan 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
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 JoinerI 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 -- Posted via http://www.ruby-forum.com/.
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 On 2/27/06, Micah Bly <mbly@inter-l.com> wrote:> > 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 > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060227/5122d582/attachment.html
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 -- Posted via http://www.ruby-forum.com/.