Feature #3044
Updated by Gregory Magarshak over 1 year ago
Given a language string (e.g. "ru" or "zh") we want to get a RegExp that captures the characters from that language. For languages like Chinese, which have many characters, you will need a Unicode Range. For others, you can list out the actual letters of their alphabet. Sometimes, their digits are written differently also.
The output should be like this:
<pre>
{
"en": ["[A-Za-z]+", "[0-9]+"]
"af": ["[someRanges]+", "someRanges"],
"ru": ...,
...
}
</pre>
h2. What we can use it for
When sorting lists by first letter, for example, we want to show people their language first, before English. But if we sort by Unicode, the Latin alphabet letters will always come first. To solve this problem we will need alphabets at least for the main languages that we use:
<pre>
ar, zh, fr, de, he, hi, it, ko, ms, pt, ru, es, uk, vi, en
</pre>
h2. Deliverable
Please generate a file, @plugins/Q/js/RegExp.js@
And move @Q.RegExp@ from @Q.js@ to that file. Look at @Q/js/Colors.js@
That file would contain all the letters and codes, and the method @Q.RegExp.letters(language)@, with language defaulting to @navigator.language@.