| 1 |
(function(){ |
| 2 |
|
| 3 |
var fromJson = dojo.fromJson; |
| 4 |
dojo.fromJson = function(json){ |
| 5 |
json = json.replace(/[\u200E\u200F\u202A-\u202E]/g, function(match){ |
| 6 |
return "\\u" + match.charCodeAt(0).toString(16); |
| 7 |
}) |
| 8 |
return json ? fromJson(json) : ""; |
| 9 |
} |
| 10 |
})(); |
| 11 |
|
| 12 |
function isLocaleAliasSrc(prop, bundle){ |
| 13 |
if(!bundle){ return false; } |
| 14 |
var isAlias = false; |
| 15 |
var LOCALE_ALIAS_MARK = '@localeAlias'; |
| 16 |
|
| 17 |
for(x in bundle){ |
| 18 |
if(x.indexOf(LOCALE_ALIAS_MARK) > 0){ |
| 19 |
var prefix = x.substring(0,x.indexOf(LOCALE_ALIAS_MARK)); |
| 20 |
if(prop.indexOf(prefix) == 0){ |
| 21 |
isAlias = true; |
| 22 |
} |
| 23 |
} |
| 24 |
} |
| 25 |
return isAlias; |
| 26 |
} |
| 27 |
|
| 28 |
function getNativeBundle(filePath){ |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
try{ |
| 34 |
var content = readFile(filePath, "utf-8"); |
| 35 |
return (!content || !content.length) ? {} : dojo.fromJson(content); |
| 36 |
}catch(e){ |
| 37 |
return {}; |
| 38 |
} |
| 39 |
} |
| 40 |
|
| 41 |
function compare(a, b){ |
| 42 |
|
| 43 |
|
| 44 |
if(dojo.isArray(a) && dojo.isArray(b)){ |
| 45 |
for(var i = 0; i < a.length; i++){ |
| 46 |
if(a[i] != b[i]){ return false; } |
| 47 |
} |
| 48 |
return true; |
| 49 |
} |
| 50 |
return a==b; |
| 51 |
} |