diff --git a/angular-localization.js b/angular-localization.js new file mode 100644 index 0000000..ced9b29 --- /dev/null +++ b/angular-localization.js @@ -0,0 +1,409 @@ +/** + * angular-localization :: v1.2.3 :: 2015-09-10 + * web: https://github.com/doshprompt/angular-localization + * + * Copyright (c) 2015 | Rahul Doshi + * License: MIT + */ +;(function (angular, window, document, undefined) { + 'use strict'; +angular.module('ngLocalize.Config', []) + .value('localeConf', { + basePath: 'languages', + defaultLocale: 'en-US', + sharedDictionary: 'common', + fileExtension: '.lang.json', + persistSelection: true, + cookieName: 'COOKIE_LOCALE_LANG', + observableAttrs: new RegExp('^data-(?!ng-|i18n)'), + delimiter: '::' + }); +angular.module('ngLocalize.Events', []) + .constant('localeEvents', { + resourceUpdates: 'ngLocalizeResourcesUpdated', + localeChanges: 'ngLocalizeLocaleChanged' + }); +angular.module('ngLocalize', ['ngSanitize', 'ngLocalize.Config', 'ngLocalize.Events', 'ngLocalize.InstalledLanguages']) + .service('locale', function ($injector, $http, $q, $log, $rootScope, $window, localeConf, localeEvents, localeSupported, localeFallbacks) { + var TOKEN_REGEX = new RegExp('^[\\w\\.-]+\\.[\\w\\s\\.-]+\\w(:.*)?$'), + + currentLocale, + deferrences, + bundles, + cookieStore; + + if (localeConf.persistSelection && $injector.has('$cookieStore')) { + cookieStore = $injector.get('$cookieStore'); + } + + function isToken(str) { + return (str && str.length && TOKEN_REGEX.test(str)); + } + + function getPath(tok) { + var path = tok ? tok.split('.') : '', + result = ''; + + if (path.length > 1) { + result = path.slice(0, -1).join('.'); + } + + return result; + } + + function getKey(tok) { + var path = tok ? tok.split('.') : [], + result = ''; + + if (path.length) { + result = path[path.length - 1]; + } + + return result; + } + + function getBundle(tok) { + var result = null, + path = tok ? tok.split('.') : [], + i; + + if (path.length > 1) { + result = bundles; + + for (i = 0; i < path.length - 1; i++) { + if (result[path[i]]) { + result = result[path[i]]; + } else { + result = null; + break; + } + } + } + + return result; + } + + function loadBundle(token) { + var path = token ? token.split('.') : '', + root = bundles, + url = localeConf.basePath + '/' + currentLocale, + i; + + if (path.length > 1) { + for (i = 0; i < path.length - 1; i++) { + if (!root[path[i]]) { + root[path[i]] = {}; + } + root = root[path[i]]; + url += "/" + path[i]; + } + + if (!root._loading) { + root._loading = true; + + url += localeConf.fileExtension; + + $http.get(url) + .success(function (data) { + var key, + path = getPath(token); + // Merge the contents of the obtained data into the stored bundle. + for (key in data) { + if (data.hasOwnProperty(key)) { + root[key] = data[key]; + } + } + + // Mark the bundle as having been "loaded". + delete root._loading; + + // Notify anyone who cares to know about this event. + $rootScope.$broadcast(localeEvents.resourceUpdates); + + // If we issued a Promise for this file, resolve it now. + if (deferrences[path]) { + deferrences[path].resolve(path); + } + }) + .error(function (data) { + $log.error("[localizationService] Failed to load: " + url); + + // We can try it again later. + delete root._loading; + }); + } + } + } + + function bundleReady(path) { + var bundle, + token; + + path = path || localeConf.langFile; + token = path + "._LOOKUP_"; + + bundle = getBundle(token); + + if (!deferrences[path]) { + deferrences[path] = $q.defer(); + } + + if (bundle && !bundle._loading) { + deferrences[path].resolve(path); + } else { + if (!bundle) { + loadBundle(token); + } + } + + return deferrences[path].promise; + } + + function ready(path) { + var paths, + deferred, + outstanding; + + if (angular.isString(path)) { + paths = path.split(','); + } else if (angular.isArray(path)) { + paths = path; + } else { + throw new Error("locale.ready requires either an Array or comma-separated list."); + } + + if (paths.length > 1) { + outstanding = []; + paths.forEach(function (path) { + outstanding.push(bundleReady(path)); + }); + deferred = $q.all(outstanding); + } else { + deferred = bundleReady(path); + } + + return deferred; + } + + function applySubstitutions(text, subs) { + var res = text, + firstOfKind = 0; + + if (subs) { + if (angular.isArray(subs)) { + angular.forEach(subs, function (sub, i) { + res = res.replace('%' + (i + 1), sub); + res = res.replace('{' + (i + 1) + '}', sub); + }); + } else { + angular.forEach(subs, function (v, k) { + ++firstOfKind; + + res = res.replace('{' + k + '}', v); + res = res.replace('%' + k, v); + res = res.replace('%' + (firstOfKind), v); + res = res.replace('{' + (firstOfKind) + '}', v); + }); + } + } + res = res.replace(/\n/g, '
'); + + return res; + } + + function getLocalizedString(txt, subs) { + var result = '', + bundle, + key, + A, + isValidToken = false; + + if (angular.isString(txt) && !subs && txt.indexOf(localeConf.delimiter) != -1) { + A = txt.split(localeConf.delimiter); + txt = A[0]; + subs = angular.fromJson(A[1]); + } + + isValidToken = isToken(txt); + if (isValidToken) { + if (!angular.isObject(subs)) { + subs = [subs]; + } + + bundle = getBundle(txt); + if (bundle && !bundle._loading) { + key = getKey(txt); + + if (bundle[key]) { + result = applySubstitutions(bundle[key], subs); + } else { + $log.info("[localizationService] Key not found: " + txt); + result = "%%KEY_NOT_FOUND%%"; + } + } else { + if (!bundle) { + loadBundle(txt); + } + } + } else { + result = txt; + } + + return result; + } + + function setLocale(value) { + var lang; + + if (angular.isString(value)) { + value = value.trim(); + if (localeSupported.indexOf(value) != -1) { + lang = value; + } else { + lang = localeFallbacks[value.split('-')[0]] + if (angular.isUndefined(lang)) { + lang = localeConf.defaultLocale; + } + } + } else { + lang = localeConf.defaultLocale; + } + + if (lang != currentLocale) { + bundles = {}; + deferrences = {}; + currentLocale = lang; + + $rootScope.$broadcast(localeEvents.localeChanges, currentLocale); + $rootScope.$broadcast(localeEvents.resourceUpdates); + + if (cookieStore) { + cookieStore.put(localeConf.cookieName, lang); + } + } + } + + function getLocale() { + return currentLocale; + } + + setLocale(cookieStore ? cookieStore.get(localeConf.cookieName) : $window.navigator.userLanguage || $window.navigator.language); + + return { + ready: ready, + isToken: isToken, + getPath: getPath, + getKey: getKey, + setLocale: setLocale, + getLocale: getLocale, + getString: getLocalizedString + }; + }) + .filter('i18n', function (locale) { + var i18nFilter = function (input, args) { + return locale.getString(input, args); + }; + + i18nFilter.$stateful = true; + + return i18nFilter; + }) + .directive('i18n', function ($sce, locale, localeEvents, localeConf) { + function setText(elm, tag) { + if (tag !== elm.html()) { + elm.html($sce.getTrustedHtml(tag)); + } + } + + function update(elm, string, optArgs) { + if (locale.isToken(string)) { + locale.ready(locale.getPath(string)).then(function () { + setText(elm, locale.getString(string, optArgs)); + }); + } else { + setText(elm, string); + } + } + + return function (scope, elm, attrs) { + var hasObservers; + + attrs.$observe('i18n', function (newVal, oldVal) { + if (newVal && newVal != oldVal) { + update(elm, newVal, hasObservers); + } + }); + + angular.forEach(attrs.$attr, function (attr, normAttr) { + if (localeConf.observableAttrs.test(attr)) { + attrs.$observe(normAttr, function (newVal, oldVal) { + if ((newVal && newVal != oldVal) || !hasObservers || !hasObservers[normAttr]) { + hasObservers = hasObservers || {}; + hasObservers[normAttr] = attrs[normAttr]; + update(elm, attrs.i18n, hasObservers); + } + }); + } + }); + + scope.$on(localeEvents.resourceUpdates, function () { + update(elm, attrs.i18n, hasObservers); + }); + scope.$on(localeEvents.localeChanges, function () { + update(elm, attrs.i18n, hasObservers); + }); + }; + }) + .directive('i18nAttr', function (locale, localeEvents) { + return function (scope, elem, attrs) { + var lastValues = {}; + + function updateText(target, attributes) { + var values = scope.$eval(attributes), + langFiles = [], + exp; + + for(var key in values) { + exp = values[key]; + if (locale.isToken(exp) && langFiles.indexOf(locale.getPath(exp)) == -1) { + langFiles.push(locale.getPath(exp)); + } + } + + locale.ready(langFiles).then(function () { + var value = ''; + + for(var key in values) { + exp = values[key]; + value = locale.getString(exp); + if (lastValues[key] !== value) { + attrs.$set(key, lastValues[key] = value); + } + } + }); + } + + attrs.$observe('i18nAttr', function (newVal, oldVal) { + if (newVal && newVal != oldVal) { + updateText(elem, newVal); + } + }); + + scope.$on(localeEvents.resourceUpdates, function () { + updateText(elem, attrs.i18nAttr); + }); + scope.$on(localeEvents.localeChanges, function () { + updateText(elem, attrs.i18nAttr); + }); + }; + }); +angular.module('ngLocalize.InstalledLanguages', []) + .value('localeSupported', [ + 'en-US' + ]) + .value('localeFallbacks', { + 'en': 'en-US' + }); +angular.module('ngLocalize.Version', []) + .constant('localeVer', '1.2.3'); +})(window.angular, window, document); \ No newline at end of file diff --git a/angular-localization.min.js b/angular-localization.min.js new file mode 100644 index 0000000..412f3f1 --- /dev/null +++ b/angular-localization.min.js @@ -0,0 +1,9 @@ +/** + * angular-localization :: v1.2.3 :: 2015-09-10 + * web: https://github.com/doshprompt/angular-localization + * + * Copyright (c) 2015 | Rahul Doshi + * License: MIT + */ +!function(a,b,c,d){"use strict";a.module("ngLocalize.Config",[]).value("localeConf",{basePath:"languages",defaultLocale:"en-US",sharedDictionary:"common",fileExtension:".lang.json",persistSelection:!0,cookieName:"COOKIE_LOCALE_LANG",observableAttrs:new RegExp("^data-(?!ng-|i18n)"),delimiter:"::"}),a.module("ngLocalize.Events",[]).constant("localeEvents",{resourceUpdates:"ngLocalizeResourcesUpdated",localeChanges:"ngLocalizeLocaleChanged"}),a.module("ngLocalize",["ngSanitize","ngLocalize.Config","ngLocalize.Events","ngLocalize.InstalledLanguages"]).service("locale",["$injector","$http","$q","$log","$rootScope","$window","localeConf","localeEvents","localeSupported","localeFallbacks",function(b,c,d,e,f,g,h,i,j,k){function l(a){return a&&a.length&&A.test(a)}function m(a){var b=a?a.split("."):"",c="";return b.length>1&&(c=b.slice(0,-1).join(".")),c}function n(a){var b=a?a.split("."):[],c="";return b.length&&(c=b[b.length-1]),c}function o(a){var b,c=null,d=a?a.split("."):[];if(d.length>1)for(c=y,b=0;b1){for(b=0;b1?(f=[],c.forEach(function(a){f.push(q(a))}),e=d.all(f)):e=q(b),e}function s(b,c){var d=b,e=0;return c&&(a.isArray(c)?a.forEach(c,function(a,b){d=d.replace("%"+(b+1),a),d=d.replace("{"+(b+1)+"}",a)}):a.forEach(c,function(a,b){++e,d=d.replace("{"+b+"}",a),d=d.replace("%"+b,a),d=d.replace("%"+e,a),d=d.replace("{"+e+"}",a)})),d=d.replace(/\n/g,"
")}function t(b,c){var d,f,g,i="",j=!1;return a.isString(b)&&!c&&-1!=b.indexOf(h.delimiter)&&(g=b.split(h.delimiter),b=g[0],c=a.fromJson(g[1])),j=l(b),j?(a.isObject(c)||(c=[c]),d=o(b),d&&!d._loading?(f=n(b),d[f]?i=s(d[f],c):(e.info("[localizationService] Key not found: "+b),i="%%KEY_NOT_FOUND%%")):d||p(b)):i=b,i}function u(b){var c;a.isString(b)?(b=b.trim(),-1!=j.indexOf(b)?c=b:(c=k[b.split("-")[0]],a.isUndefined(c)&&(c=h.defaultLocale))):c=h.defaultLocale,c!=w&&(y={},x={},w=c,f.$broadcast(i.localeChanges,w),f.$broadcast(i.resourceUpdates),z&&z.put(h.cookieName,c))}function v(){return w}var w,x,y,z,A=new RegExp("^[\\w\\.-]+\\.[\\w\\s\\.-]+\\w(:.*)?$");return h.persistSelection&&b.has("$cookieStore")&&(z=b.get("$cookieStore")),u(z?z.get(h.cookieName):g.navigator.userLanguage||g.navigator.language),{ready:r,isToken:l,getPath:m,getKey:n,setLocale:u,getLocale:v,getString:t}}]).filter("i18n",["locale",function(a){var b=function(b,c){return a.getString(b,c)};return b.$stateful=!0,b}]).directive("i18n",["$sce","locale","localeEvents","localeConf",function(b,c,d,e){function f(a,c){c!==a.html()&&a.html(b.getTrustedHtml(c))}function g(a,b,d){c.isToken(b)?c.ready(c.getPath(b)).then(function(){f(a,c.getString(b,d))}):f(a,b)}return function(b,c,f){var h;f.$observe("i18n",function(a,b){a&&a!=b&&g(c,a,h)}),a.forEach(f.$attr,function(a,b){e.observableAttrs.test(a)&&f.$observe(b,function(a,d){(a&&a!=d||!h||!h[b])&&(h=h||{},h[b]=f[b],g(c,f.i18n,h))})}),b.$on(d.resourceUpdates,function(){g(c,f.i18n,h)}),b.$on(d.localeChanges,function(){g(c,f.i18n,h)})}}]).directive("i18nAttr",["locale","localeEvents",function(a,b){return function(c,d,e){function f(b,d){var f,h=c.$eval(d),i=[];for(var j in h)f=h[j],a.isToken(f)&&-1==i.indexOf(a.getPath(f))&&i.push(a.getPath(f));a.ready(i).then(function(){var b="";for(var c in h)f=h[c],b=a.getString(f),g[c]!==b&&e.$set(c,g[c]=b)})}var g={};e.$observe("i18nAttr",function(a,b){a&&a!=b&&f(d,a)}),c.$on(b.resourceUpdates,function(){f(d,e.i18nAttr)}),c.$on(b.localeChanges,function(){f(d,e.i18nAttr)})}}]),a.module("ngLocalize.InstalledLanguages",[]).value("localeSupported",["en-US"]).value("localeFallbacks",{en:"en-US"}),a.module("ngLocalize.Version",[]).constant("localeVer","1.2.3")}(window.angular,window,document); +//# sourceMappingURL=angular-localization.min.map \ No newline at end of file diff --git a/angular-localization.min.js.gz b/angular-localization.min.js.gz new file mode 100644 index 0000000..a51af11 Binary files /dev/null and b/angular-localization.min.js.gz differ diff --git a/angular-localization.min.map b/angular-localization.min.map new file mode 100644 index 0000000..adbbf00 --- /dev/null +++ b/angular-localization.min.map @@ -0,0 +1 @@ +{"version":3,"file":"angular-localization.min.js","sources":["angular-localization.js"],"names":["angular","window","document","undefined","module","value","basePath","defaultLocale","sharedDictionary","fileExtension","persistSelection","cookieName","observableAttrs","RegExp","delimiter","constant","resourceUpdates","localeChanges","service","$injector","$http","$q","$log","$rootScope","$window","localeConf","localeEvents","localeSupported","localeFallbacks","isToken","str","length","TOKEN_REGEX","test","getPath","tok","path","split","result","slice","join","getKey","getBundle","i","bundles","loadBundle","token","root","url","currentLocale","_loading","get","success","data","key","hasOwnProperty","$broadcast","deferrences","resolve","error","bundleReady","bundle","langFile","defer","promise","ready","paths","deferred","outstanding","isString","isArray","Error","forEach","push","all","applySubstitutions","text","subs","res","firstOfKind","sub","replace","v","k","getLocalizedString","txt","A","isValidToken","indexOf","fromJson","isObject","info","setLocale","lang","trim","isUndefined","cookieStore","put","getLocale","has","navigator","userLanguage","language","getString","filter","locale","i18nFilter","input","args","$stateful","directive","$sce","setText","elm","tag","html","getTrustedHtml","update","string","optArgs","then","scope","attrs","hasObservers","$observe","newVal","oldVal","$attr","attr","normAttr","i18n","$on","elem","updateText","target","attributes","exp","values","$eval","langFiles","lastValues","$set","i18nAttr","en"],"mappings":";;;;;;;CAOC,SAAWA,EAASC,EAAQC,EAAUC,GACnC,YACJH,GAAQI,OAAO,wBACVC,MAAM,cACHC,SAAU,YACVC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UACxBd,OAAOD,QAASC,OAAQC","sourceRoot":"/Users/bretikehara/dailymotion/angular-localization"} \ No newline at end of file diff --git a/bower.json b/bower.json index 0fa4476..64f427b 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "angular-localization", - "version": "1.2.2", + "version": "1.2.3", "homepage": "https://github.com/doshprompt/angular-localization", "description": "angularjs localization done right", "main": "angular-localization.js", diff --git a/dist/angular-localization.js b/dist/angular-localization.js index 92e2c75..ced9b29 100644 --- a/dist/angular-localization.js +++ b/dist/angular-localization.js @@ -1,5 +1,5 @@ /** - * angular-localization :: v1.2.1 :: 2015-04-17 + * angular-localization :: v1.2.3 :: 2015-09-10 * web: https://github.com/doshprompt/angular-localization * * Copyright (c) 2015 | Rahul Doshi @@ -405,5 +405,5 @@ angular.module('ngLocalize.InstalledLanguages', []) 'en': 'en-US' }); angular.module('ngLocalize.Version', []) - .constant('localeVer', '1.2.1'); + .constant('localeVer', '1.2.3'); })(window.angular, window, document); \ No newline at end of file diff --git a/dist/angular-localization.min.js b/dist/angular-localization.min.js index 6d8ef7b..412f3f1 100644 --- a/dist/angular-localization.min.js +++ b/dist/angular-localization.min.js @@ -1,9 +1,9 @@ /** - * angular-localization :: v1.2.1 :: 2015-04-17 + * angular-localization :: v1.2.3 :: 2015-09-10 * web: https://github.com/doshprompt/angular-localization * * Copyright (c) 2015 | Rahul Doshi * License: MIT */ -!function(a){"use strict";a.module("ngLocalize.Config",[]).value("localeConf",{basePath:"languages",defaultLocale:"en-US",sharedDictionary:"common",fileExtension:".lang.json",persistSelection:!0,cookieName:"COOKIE_LOCALE_LANG",observableAttrs:new RegExp("^data-(?!ng-|i18n)"),delimiter:"::"}),a.module("ngLocalize.Events",[]).constant("localeEvents",{resourceUpdates:"ngLocalizeResourcesUpdated",localeChanges:"ngLocalizeLocaleChanged"}),a.module("ngLocalize",["ngSanitize","ngLocalize.Config","ngLocalize.Events","ngLocalize.InstalledLanguages"]).service("locale",["$injector","$http","$q","$log","$rootScope","$window","localeConf","localeEvents","localeSupported","localeFallbacks",function(b,c,d,e,f,g,h,i,j,k){function l(a){return a&&a.length&&A.test(a)}function m(a){var b=a?a.split("."):"",c="";return b.length>1&&(c=b.slice(0,-1).join(".")),c}function n(a){var b=a?a.split("."):[],c="";return b.length&&(c=b[b.length-1]),c}function o(a){var b,c=null,d=a?a.split("."):[];if(d.length>1)for(c=y,b=0;b1){for(b=0;b1?(f=[],c.forEach(function(a){f.push(q(a))}),e=d.all(f)):e=q(b),e}function s(b,c){var d=b,e=0;return c&&(a.isArray(c)?a.forEach(c,function(a,b){d=d.replace("%"+(b+1),a),d=d.replace("{"+(b+1)+"}",a)}):a.forEach(c,function(a,b){++e,d=d.replace("{"+b+"}",a),d=d.replace("%"+b,a),d=d.replace("%"+e,a),d=d.replace("{"+e+"}",a)})),d=d.replace(/\n/g,"
")}function t(b,c){var d,f,g,i="",j=!1;return a.isString(b)&&!c&&-1!=b.indexOf(h.delimiter)&&(g=b.split(h.delimiter),b=g[0],c=a.fromJson(g[1])),j=l(b),j?(a.isObject(c)||(c=[c]),d=o(b),d&&!d._loading?(f=n(b),d[f]?i=s(d[f],c):(e.info("[localizationService] Key not found: "+b),i="%%KEY_NOT_FOUND%%")):d||p(b)):i=b,i}function u(b){var c;a.isString(b)?(b=b.trim(),-1!=j.indexOf(b)?c=b:(c=k[b.split("-")[0]],a.isUndefined(c)&&(c=h.defaultLocale))):c=h.defaultLocale,c!=w&&(y={},x={},w=c,f.$broadcast(i.localeChanges,w),f.$broadcast(i.resourceUpdates),z&&z.put(h.cookieName,c))}function v(){return w}var w,x,y,z,A=new RegExp("^[\\w\\.-]+\\.[\\w\\s\\.-]+\\w(:.*)?$");return h.persistSelection&&b.has("$cookieStore")&&(z=b.get("$cookieStore")),u(z?z.get(h.cookieName):g.navigator.userLanguage||g.navigator.language),{ready:r,isToken:l,getPath:m,getKey:n,setLocale:u,getLocale:v,getString:t}}]).filter("i18n",["locale",function(a){var b=function(b,c){return a.getString(b,c)};return b.$stateful=!0,b}]).directive("i18n",["$sce","locale","localeEvents","localeConf",function(b,c,d,e){function f(a,c){c!==a.html()&&a.html(b.getTrustedHtml(c))}function g(a,b,d){c.isToken(b)?c.ready(c.getPath(b)).then(function(){f(a,c.getString(b,d))}):f(a,b)}return function(b,c,f){var h;f.$observe("i18n",function(a,b){a&&a!=b&&g(c,a,h)}),a.forEach(f.$attr,function(a,b){e.observableAttrs.test(a)&&f.$observe(b,function(a,d){(a&&a!=d||!h||!h[b])&&(h=h||{},h[b]=f[b],g(c,f.i18n,h))})}),b.$on(d.resourceUpdates,function(){g(c,f.i18n,h)}),b.$on(d.localeChanges,function(){g(c,f.i18n,h)})}}]).directive("i18nAttr",["locale","localeEvents",function(a,b){return function(c,d,e){function f(b,d){var f,h=c.$eval(d),i=[];for(var j in h)f=h[j],a.isToken(f)&&-1==i.indexOf(a.getPath(f))&&i.push(a.getPath(f));a.ready(i).then(function(){var b="";for(var c in h)f=h[c],b=a.getString(f),g[c]!==b&&e.$set(c,g[c]=b)})}var g={};e.$observe("i18nAttr",function(a,b){a&&a!=b&&f(d,a)}),c.$on(b.resourceUpdates,function(){f(d,e.i18nAttr)}),c.$on(b.localeChanges,function(){f(d,e.i18nAttr)})}}]),a.module("ngLocalize.InstalledLanguages",[]).value("localeSupported",["en-US"]).value("localeFallbacks",{en:"en-US"}),a.module("ngLocalize.Version",[]).constant("localeVer","1.2.1")}(window.angular,window,document); +!function(a,b,c,d){"use strict";a.module("ngLocalize.Config",[]).value("localeConf",{basePath:"languages",defaultLocale:"en-US",sharedDictionary:"common",fileExtension:".lang.json",persistSelection:!0,cookieName:"COOKIE_LOCALE_LANG",observableAttrs:new RegExp("^data-(?!ng-|i18n)"),delimiter:"::"}),a.module("ngLocalize.Events",[]).constant("localeEvents",{resourceUpdates:"ngLocalizeResourcesUpdated",localeChanges:"ngLocalizeLocaleChanged"}),a.module("ngLocalize",["ngSanitize","ngLocalize.Config","ngLocalize.Events","ngLocalize.InstalledLanguages"]).service("locale",["$injector","$http","$q","$log","$rootScope","$window","localeConf","localeEvents","localeSupported","localeFallbacks",function(b,c,d,e,f,g,h,i,j,k){function l(a){return a&&a.length&&A.test(a)}function m(a){var b=a?a.split("."):"",c="";return b.length>1&&(c=b.slice(0,-1).join(".")),c}function n(a){var b=a?a.split("."):[],c="";return b.length&&(c=b[b.length-1]),c}function o(a){var b,c=null,d=a?a.split("."):[];if(d.length>1)for(c=y,b=0;b1){for(b=0;b1?(f=[],c.forEach(function(a){f.push(q(a))}),e=d.all(f)):e=q(b),e}function s(b,c){var d=b,e=0;return c&&(a.isArray(c)?a.forEach(c,function(a,b){d=d.replace("%"+(b+1),a),d=d.replace("{"+(b+1)+"}",a)}):a.forEach(c,function(a,b){++e,d=d.replace("{"+b+"}",a),d=d.replace("%"+b,a),d=d.replace("%"+e,a),d=d.replace("{"+e+"}",a)})),d=d.replace(/\n/g,"
")}function t(b,c){var d,f,g,i="",j=!1;return a.isString(b)&&!c&&-1!=b.indexOf(h.delimiter)&&(g=b.split(h.delimiter),b=g[0],c=a.fromJson(g[1])),j=l(b),j?(a.isObject(c)||(c=[c]),d=o(b),d&&!d._loading?(f=n(b),d[f]?i=s(d[f],c):(e.info("[localizationService] Key not found: "+b),i="%%KEY_NOT_FOUND%%")):d||p(b)):i=b,i}function u(b){var c;a.isString(b)?(b=b.trim(),-1!=j.indexOf(b)?c=b:(c=k[b.split("-")[0]],a.isUndefined(c)&&(c=h.defaultLocale))):c=h.defaultLocale,c!=w&&(y={},x={},w=c,f.$broadcast(i.localeChanges,w),f.$broadcast(i.resourceUpdates),z&&z.put(h.cookieName,c))}function v(){return w}var w,x,y,z,A=new RegExp("^[\\w\\.-]+\\.[\\w\\s\\.-]+\\w(:.*)?$");return h.persistSelection&&b.has("$cookieStore")&&(z=b.get("$cookieStore")),u(z?z.get(h.cookieName):g.navigator.userLanguage||g.navigator.language),{ready:r,isToken:l,getPath:m,getKey:n,setLocale:u,getLocale:v,getString:t}}]).filter("i18n",["locale",function(a){var b=function(b,c){return a.getString(b,c)};return b.$stateful=!0,b}]).directive("i18n",["$sce","locale","localeEvents","localeConf",function(b,c,d,e){function f(a,c){c!==a.html()&&a.html(b.getTrustedHtml(c))}function g(a,b,d){c.isToken(b)?c.ready(c.getPath(b)).then(function(){f(a,c.getString(b,d))}):f(a,b)}return function(b,c,f){var h;f.$observe("i18n",function(a,b){a&&a!=b&&g(c,a,h)}),a.forEach(f.$attr,function(a,b){e.observableAttrs.test(a)&&f.$observe(b,function(a,d){(a&&a!=d||!h||!h[b])&&(h=h||{},h[b]=f[b],g(c,f.i18n,h))})}),b.$on(d.resourceUpdates,function(){g(c,f.i18n,h)}),b.$on(d.localeChanges,function(){g(c,f.i18n,h)})}}]).directive("i18nAttr",["locale","localeEvents",function(a,b){return function(c,d,e){function f(b,d){var f,h=c.$eval(d),i=[];for(var j in h)f=h[j],a.isToken(f)&&-1==i.indexOf(a.getPath(f))&&i.push(a.getPath(f));a.ready(i).then(function(){var b="";for(var c in h)f=h[c],b=a.getString(f),g[c]!==b&&e.$set(c,g[c]=b)})}var g={};e.$observe("i18nAttr",function(a,b){a&&a!=b&&f(d,a)}),c.$on(b.resourceUpdates,function(){f(d,e.i18nAttr)}),c.$on(b.localeChanges,function(){f(d,e.i18nAttr)})}}]),a.module("ngLocalize.InstalledLanguages",[]).value("localeSupported",["en-US"]).value("localeFallbacks",{en:"en-US"}),a.module("ngLocalize.Version",[]).constant("localeVer","1.2.3")}(window.angular,window,document); //# sourceMappingURL=angular-localization.min.map \ No newline at end of file diff --git a/dist/angular-localization.min.js.gz b/dist/angular-localization.min.js.gz index 2a51eec..a51af11 100644 Binary files a/dist/angular-localization.min.js.gz and b/dist/angular-localization.min.js.gz differ diff --git a/dist/angular-localization.min.map b/dist/angular-localization.min.map index 3336647..adbbf00 100644 --- a/dist/angular-localization.min.map +++ b/dist/angular-localization.min.map @@ -1 +1 @@ -{"version":3,"file":"angular-localization.min.js","sources":["angular-localization.js"],"names":["angular","module","value","basePath","defaultLocale","sharedDictionary","fileExtension","persistSelection","cookieName","observableAttrs","RegExp","delimiter","constant","resourceUpdates","localeChanges","service","$injector","$http","$q","$log","$rootScope","$window","localeConf","localeEvents","localeSupported","localeFallbacks","isToken","str","length","TOKEN_REGEX","test","getPath","tok","path","split","result","slice","join","getKey","getBundle","i","bundles","loadBundle","token","root","url","currentLocale","_loading","get","success","data","key","hasOwnProperty","$broadcast","deferrences","resolve","error","bundleReady","bundle","langFile","defer","promise","ready","paths","deferred","outstanding","isString","isArray","Error","forEach","push","all","applySubstitutions","text","subs","res","firstOfKind","sub","replace","v","k","getLocalizedString","txt","A","isValidToken","indexOf","fromJson","isObject","info","setLocale","lang","trim","isUndefined","cookieStore","put","getLocale","has","navigator","userLanguage","language","getString","filter","locale","i18nFilter","input","args","$stateful","directive","$sce","setText","elm","tag","html","getTrustedHtml","update","string","optArgs","then","scope","attrs","hasObservers","$observe","newVal","oldVal","$attr","attr","normAttr","i18n","$on","elem","updateText","target","attributes","exp","values","$eval","langFiles","lastValues","$set","i18nAttr","en","window","document"],"mappings":";;;;;;;CAOC,SAAWA,GACR,YACJA,GAAQC,OAAO,wBACVC,MAAM,cACHC,SAAU,YACVC,cAAe,QACfC,iBAAkB,SAClBC,cAAe,aACfC,kBAAkB,EAClBC,WAAY,qBACZC,gBAAiB,GAAIC,QAAO,sBAC5BC,UAAW,OAEnBX,EAAQC,OAAO,wBACVW,SAAS,gBACNC,gBAAiB,6BACjBC,cAAe,4BAEvBd,EAAQC,OAAO,cAAe,aAAc,oBAAqB,oBAAqB,kCACjFc,QAAQ,UAAW,YAAa,QAAS,KAAM,OAAQ,aAAc,UAAW,aAAc,eAAgB,kBAAmB,kBAAmB,SAAUC,EAAWC,EAAOC,EAAIC,EAAMC,EAAYC,EAASC,EAAYC,EAAcC,EAAiBC,GAYvP,QAASC,GAAQC,GACb,MAAQA,IAAOA,EAAIC,QAAUC,EAAYC,KAAKH,GAGlD,QAASI,GAAQC,GACb,G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I,IAGJ,KAAI,GAAIrF,KAAOmF,GACXD,EAAMC,EAAOnF,GACTmD,EAAO5E,QAAQ2G,IAAkD,IAA1CG,EAAUnD,QAAQiB,EAAOvE,QAAQsG,KACxDG,EAAUlE,KAAKgC,EAAOvE,QAAQsG,GAItC/B,GAAOxC,MAAM0E,GAAWnB,KAAK,WACzB,GAAInH,GAAQ,EAEZ,KAAI,GAAIiD,KAAOmF,GACXD,EAAMC,EAAOnF,GACbjD,EAAQoG,EAAOF,UAAUiC,GACrBI,EAAWtF,KAASjD,GACpBqH,EAAMmB,KAAKvF,EAAKsF,EAAWtF,GAAOjD,KArBlD,GAAIuI,KA2BJlB,GAAME,SAAS,WAAY,SAAUC,EAAQC,GACrCD,GAAUA,GAAUC,GACpBO,EAAWD,EAAMP,KAIzBJ,EAAMU,IAAIzG,EAAaV,gBAAiB,WACpCqH,EAAWD,EAAMV,EAAMoB,YAE3BrB,EAAMU,IAAIzG,EAAaT,cAAe,WAClCoH,EAAWD,EAAMV,EAAMoB,gBAIvC3I,EAAQC,OAAO,oCACVC,MAAM,mBACH,UAEHA,MAAM,mBACH0I,GAAM,UAEd5I,EAAQC,OAAO,yBACVW,SAAS,YAAa,UACxBiI,OAAO7I,QAAS6I,OAAQC","sourceRoot":"/Users/r.doshi/Projects/angular-localization"} \ No newline at end of file +{"version":3,"file":"angular-localization.min.js","sources":["angular-localization.js"],"names":["angular","window","document","undefined","module","value","basePath","defaultLocale","sharedDictionary","fileExtension","persistSelection","cookieName","observableAttrs","RegExp","delimiter","constant","resourceUpdates","localeChanges","service","$injector","$http","$q","$log","$rootScope","$window","localeConf","localeEvents","localeSupported","localeFallbacks","isToken","str","length","TOKEN_REGEX","test","getPath","tok","path","split","result","slice","join","getKey","getBundle","i","bundles","loadBundle","token","root","url","currentLocale","_loading","get","success","data","key","hasOwnProperty","$broadcast","deferrences","resolve","error","bundleReady","bundle","langFile","defer","promise","ready","paths","deferred","outstanding","isString","isArray","Error","forEach","push","all","applySubstitutions","text","subs","res","firstOfKind","sub","replace","v","k","getLocalizedString","txt","A","isValidToken","indexOf","fromJson","isObject","info","setLocale","lang","trim","isUndefined","cookieStore","put","getLocale","has","navigator","userLanguage","language","getString","filter","locale","i18nFilter","input","args","$stateful","directive","$sce","setText","elm","tag","html","getTrustedHtml","update","string","optArgs","then","scope","attrs","hasObservers","$observe","newVal","oldVal","$attr","attr","normAttr","i18n","$on","elem","updateText","target","attributes","exp","values","$eval","langFiles","lastValues","$set","i18nAttr","en"],"mappings":";;;;;;;CAOC,SAAWA,EAASC,EAAQC,EAAUC,GACnC,YACJH,GAAQI,OAAO,wBACVC,MAAM,cACHC,SAAU,YACVC,cAAe,QACfC,iBAAkB,SAClBC,cAAe,aACfC,kBAAkB,EAClBC,WAAY,qBACZC,gBAAiB,GAAIC,QAAO,sBAC5BC,UAAW,OAEnBd,EAAQI,OAAO,wBACVW,SAAS,gBACNC,gBAAiB,6BACjBC,cAAe,4BAEvBjB,EAAQI,OAAO,cAAe,aAAc,oBAAqB,oBAAqB,kCACjFc,QAAQ,UAAW,YAAa,QAAS,KAAM,OAAQ,aAAc,UAAW,aAAc,eAAgB,kBAAmB,kBAAmB,SAAUC,EAAWC,EAAOC,EAAIC,EAAMC,EAAYC,EAASC,EAAYC,EAAcC,EAAiBC,GAYvP,QAASC,GAAQC,GACb,MAAQA,IAAOA,EAAIC,QAAUC,EAAYC,KAAKH,GAGlD,QAASI,GAAQC,GACb,GAAIC,GAAOD,EAAMA,EAAIE,MAAM,KAAO,GAC9BC,EAAS,EAMb,OAJIF,GAAKL,OAAS,IACdO,EAASF,EAAKG,MAAM,EAAG,IAAIC,KAAK,MAG7BF,EAGX,QAASG,GAAON,GACZ,GAAIC,GAAOD,EAAMA,EAAIE,MAAM,QACvBC,EAAS,EAMb,OAJIF,GAAKL,SACLO,EAASF,EAAKA,EAAKL,OAAS,IAGzBO,EAGX,QAASI,GAAUP,GACf,GAEIQ,GAFAL,EAAS,KACTF,EAAOD,EAAMA,EAAIE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AASjD,GACpBqH,EAAMmB,KAAKvF,EAAKsF,EAAWtF,GAAOjD,KArBlD,GAAIuI,KA2BJlB,GAAME,SAAS,WAAY,SAAUC,EAAQC,GACrCD,GAAUA,GAAUC,GACpBO,EAAWD,EAAMP,KAIzBJ,EAAMU,IAAIzG,EAAaV,gBAAiB,WACpCqH,EAAWD,EAAMV,EAAMoB,YAE3BrB,EAAMU,IAAIzG,EAAaT,cAAe,WAClCoH,EAAWD,EAAMV,EAAMoB,gBAIvC9I,EAAQI,OAAO,oCACVC,MAAM,mBACH,UAEHA,MAAM,mBACH0I,GAAM,UAEd/I,EAAQI,OAAO,yBACVW,SAAS,YAAa,UACxBd,OAAOD,QAASC,OAAQC","sourceRoot":"/Users/bretikehara/dailymotion/angular-localization"} \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index 5fcbeaa..ea8ffff 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -29,7 +29,7 @@ var banner = [ ].join('\n'); gulp.task('clean', function (cb) { - del([paths.distDir, paths.tempDir], cb); + del([paths.distDir, paths.tempDir, './angular-localization*' ], cb); }); gulp.task('concat', function () { @@ -80,8 +80,13 @@ gulp.task('preprocess', function () { .pipe(gulp.dest(paths.distDir)); }); +gulp.task('copy', function () { + return gulp.src(paths.distDir + "/*") + .pipe(gulp.dest('./')); +}); + gulp.task('build', function () { - runSequence('clean', 'concat', 'preprocess', 'uglify', 'compress'); + runSequence('clean', 'concat', 'preprocess', 'uglify', 'compress', 'copy'); }); gulp.task('test', ['karma']); diff --git a/package.json b/package.json index bf3fbf5..2b8139e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "angular-localization", - "version": "1.2.2", + "version": "1.2.3", "description": "angularjs localization done right.", "main": "dist/angular-localization.js", "scripts": {