Archive for November 30th, 2007

Crossing the language barrier

Yesterday, I encountered a surprising situation while working in Flex Builder 3 (Beta 2) on OS X (Leopard). I was working on a project that being designed to handle multiple languages. While in the code I create three simple arrays with Latin, Hebrew and Chinese characters. (See below)private var labelArrayENU:Array =
[“Tools”,”Contents”,”Zoom”,”Magnify”,”Print”,”Save”,”Link”,”Send”];

private var labelArrayHEB:Array =
[‘אמצעי’,’תכולה’,’בצילום’,’להגזים’,’ספר’,’ש”ע’,’להתחבר’,’סלנג’];

private var labelArrayCHN:Array =
[“走 狗”,”甘 心 情 愿”,”形 满 足”,”反 义 词”,”名 物 品”,”内 容”,”容 量”,”近 义 词”];

Image provided for those without languagesets

But something bizarre and unexpected happened when I began to create the array of Hebrew. I attempted to copy and paste the word into the array. However, when I pasted the Hebrew text at the end of the array it was moved to the beginning. Try as I might this kept happening. It dawned on me that my system has become aware of the fact that Hebrew is a “R2L” language. That means it is written from right to left as opposed to the common right to left of Western languages. (Note: I use Western as most non-modernized eastern languages write R2L.)

After some further experimentation I was confirmed in my assumption that my system had become R2L aware. First off, using the right & left arrow keys in the Hebrew text actually caused the cursor to move in the opposite direction. Now, I was concerned in part by the fact that this might be OS X acting on the text…while Flex Builder 3 remained unaware. I was concerned that my array was being constructed in reverse order. A quick test of output while looping over my array showed that while the order was being reversed in the code; the index was being reversed to correspond as well.

What I mean by this is that “index 0” was now the right most entry instead of the left most entry. Therefore, my array outputs correctly. And the output of all three arrays corresponded to one another.

This is pretty impressive, especially in the globally connected world of our today. However, there are a few caveats. I still found it challenging to do what I want because the system makes some assumptions based on my activities. For instance, when I actually wanted to add another entry before my first entry. The system still assumed I was trying to add an entry to the end of my array and automatically moved it for me. (Which is NOT what I wanted.)

So my thoughts on this are:

a) it’s cool, and insightful to the future
b) it’s can catch you unawares and leave you momentarily confused
c) it’s still a bit quirky and can make it challenging to complete an action as you intend, even after you understand what’s going on.

Anyways, I just thought I’d share with everyone this interesting encounter. Not everyone deals with multiple languages, especially non-western R2L languages in their projects. But in case you ever do…you can be aware of this behavior which might save you some time pondering your sanity.

– The Saj

PS – I endeavored to see if this was an OS X only action by trying it in my Parallels instance of Windows XP. The action occurred there as well, but that may be from OS X’s influence.

Would love to know from a stand-a-lone Windows XP & Windows Vista user if this behavior is seen on your machine as well, or not.


November 2007
M T W T F S S
 1234
567891011
12131415161718
19202122232425
2627282930  


Awesome Developer Conferences


Nxtbook MediaFormer Employer - Great Company



The Saj... "Dark Lord of the SWF"