@abp/core
Advanced tools
Comparing version 2.6.2 to 2.7.0
{ | ||
"version": "2.6.2", | ||
"version": "2.7.0", | ||
"name": "@abp/core", | ||
@@ -8,5 +8,5 @@ "publishConfig": { | ||
"dependencies": { | ||
"@abp/utils": "^2.6.2" | ||
"@abp/utils": "^2.7.0" | ||
}, | ||
"gitHead": "eb4a0e507f492e275865b72caeb02ce28d69ae56" | ||
"gitHead": "0ea3895f3b0b489e3ea81fc88f8f0896b22b61bd" | ||
} |
@@ -79,6 +79,13 @@ var abp = abp || {}; | ||
abp.localization.localize = function (key, sourceName) { | ||
if (sourceName === '_') { //A convention to suppress the localization | ||
return key; | ||
} | ||
sourceName = sourceName || abp.localization.defaultResourceName; | ||
if (!sourceName) { | ||
abp.log.warn('Localization source name is not specified and the defaultResourceName was not defined!'); | ||
return key; | ||
} | ||
var source = abp.localization.values[sourceName]; | ||
if (!source) { | ||
@@ -101,2 +108,25 @@ abp.log.warn('Could not find localization source: ' + sourceName); | ||
abp.localization.isLocalized = function (key, sourceName) { | ||
if (sourceName === '_') { //A convention to suppress the localization | ||
return true; | ||
} | ||
sourceName = sourceName || abp.localization.defaultResourceName; | ||
if (!sourceName) { | ||
return false; | ||
} | ||
var source = abp.localization.values[sourceName]; | ||
if (!source) { | ||
return false; | ||
} | ||
var value = source[key]; | ||
if (value === undefined) { | ||
return false; | ||
} | ||
return true; | ||
}; | ||
abp.localization.getResource = function (name) { | ||
@@ -103,0 +133,0 @@ return function () { |
21830
572
Updated@abp/utils@^2.7.0