Closed
Description
Edited by Globalize team:
Requirements:
- RTL data available on JSON CLDR? http://unicode.org/cldr/trac/ticket/9038
TODO:
- API
What can Globalize do with that information. CLDR contains a lot of information, Globalize is all about formatting and parsing, not wrapping everything that CLDR provides. So assuming CLDR actually exposes the RTL boolean in the JSON packages, what could Globalize do with that?
Is there feature for RTL in globalize?
i have checked a text file for RTL in CLDR data (core/common/properties/scriptMetadata.txt)
and if we convert it to json format than we could support RTL
scriptMetaData.json
[
{
"IDENTIFIER":"Zyyy",
"RANK":1,
"RTL":"UNKNOWN"
},
{
"IDENTIFIER":"Latn",
"RANK":2,
"RTL":"NO"
...
]
function isRTL(locale){
var local = Globalize.locale().attributes.script,
result = null;
if(scriptMetaData){ // -> defined some where in the first place
scriptMetaData.forEach(function(item){
if(item.IDENTIFIER === local){
switch(item.RTL){
case 'YES':
result = true;
break;
case 'NO':
result = false;
break;
case 'UNKNOWN':
result = true;
break;
}
return;
}
});
return result;
}
reference
http://www.unicode.org/Public/cldr/26.0.1/core.zip
https://github.com/enyojs/enyo-ilib/blob/master/ilib/locale/scripts.json