Skip to content

Commit ff01a32

Browse files
using angular test functions to test for arrays and objects and null to
ignore arguments
1 parent 7b45bbc commit ff01a32

4 files changed

Lines changed: 9 additions & 9 deletions

File tree

dist/angular-gettext.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ angular.module('gettext').factory('gettextCatalog', ["gettextPlurals", "$http",
4040

4141
for (var key in strings) {
4242
var val = strings[key];
43-
if (!( val instanceof Array )) {
43+
if (!angular.isArray(val)) {
4444
this.strings[language][key] = [val];
4545
} else {
4646
this.strings[language][key] = val;
@@ -52,7 +52,7 @@ angular.module('gettext').factory('gettextCatalog', ["gettextPlurals", "$http",
5252
var stringTable = this.strings[this.currentLanguage] || {};
5353
var plurals = stringTable[string] || [];
5454
var translation = plurals[n];
55-
if (typeof translation === 'object'){
55+
if (angular.isObject(translation)){
5656
//Translation is an object with context bound translations for the string
5757
translation = translation[gettextContext];
5858
}
@@ -129,9 +129,9 @@ angular.module('gettext').directive('translate', ["gettextCatalog", "$parse", "$
129129
if (translatePlural) {
130130
scope = pluralScope || (pluralScope = scope.$new());
131131
scope.$count = countFn(scope);
132-
translated = gettextCatalog.getPlural(scope.$count, msgid, translatePlural, undefined, translateContext);
132+
translated = gettextCatalog.getPlural(scope.$count, msgid, translatePlural, null, translateContext);
133133
} else {
134-
translated = gettextCatalog.getString(msgid, undefined, translateContext);
134+
translated = gettextCatalog.getString(msgid, null, translateContext);
135135
}
136136

137137
// Swap in the translation

dist/angular-gettext.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/catalog.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ angular.module('gettext').factory('gettextCatalog', function (gettextPlurals, $h
2828

2929
for (var key in strings) {
3030
var val = strings[key];
31-
if (!( val instanceof Array )) {
31+
if (!angular.isArray(val)) {
3232
this.strings[language][key] = [val];
3333
} else {
3434
this.strings[language][key] = val;
@@ -40,7 +40,7 @@ angular.module('gettext').factory('gettextCatalog', function (gettextPlurals, $h
4040
var stringTable = this.strings[this.currentLanguage] || {};
4141
var plurals = stringTable[string] || [];
4242
var translation = plurals[n];
43-
if (typeof translation === 'object'){
43+
if (angular.isObject(translation)){
4444
//Translation is an object with context bound translations for the string
4545
translation = translation[gettextContext];
4646
}

src/directive.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ angular.module('gettext').directive('translate', function (gettextCatalog, $pars
4141
if (translatePlural) {
4242
scope = pluralScope || (pluralScope = scope.$new());
4343
scope.$count = countFn(scope);
44-
translated = gettextCatalog.getPlural(scope.$count, msgid, translatePlural, undefined, translateContext);
44+
translated = gettextCatalog.getPlural(scope.$count, msgid, translatePlural, null, translateContext);
4545
} else {
46-
translated = gettextCatalog.getString(msgid, undefined, translateContext);
46+
translated = gettextCatalog.getString(msgid, null, translateContext);
4747
}
4848

4949
// Swap in the translation

0 commit comments

Comments
 (0)