1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- 'use strict';
- define([], function () {
- var _singletonInstance = null;
- var _LocaleUtil = null;
- _LocaleUtil = function LocaleUtil() {
-
- if (_LocaleUtil.prototype._singletonInstance) {
- return _LocaleUtil.prototype._singletonInstance;
- }
- this.locale = this.getLocale();
- this.isRTL = this.isLocaleRTL(this.locale);
- _LocaleUtil.prototype._singletonInstance = this;
- };
-
- _LocaleUtil.prototype.getLocale = function () {
- if (!this.locale) {
- this.locale = document.documentElement.getAttribute('lang');
- }
- return this.locale;
- };
-
- _LocaleUtil.prototype.isLocaleRTL = function (sLocale) {
- if (!this.isRTL) {
- var aRtlLocales = ['ar', 'he'];
- this.isRTL = aRtlLocales.indexOf(sLocale) >= 0;
- }
- return this.isRTL;
- };
- var _static = {
- getInstance: function getInstance() {
- if (!_singletonInstance) {
- _singletonInstance = new _LocaleUtil();
- }
- return _singletonInstance;
- }
- };
- return _static.getInstance();
- });
|