Skip to content

Commit

Permalink
fixed timing of localization initialization (#660)
Browse files Browse the repository at this point in the history
  • Loading branch information
wachterjohannes authored and danrot committed Jun 15, 2016
1 parent 9124277 commit dac3617
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 17 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# CHANGELOG for husky

* dev-master
* HOTFIX #660 Fixed timing of localization initialization
* ENHANCEMENT #657 Added new function 'records.set' for datagrid

* 0.19.3 (2016-06-01)
Expand Down
29 changes: 21 additions & 8 deletions dist/husky.js
Original file line number Diff line number Diff line change
Expand Up @@ -51104,15 +51104,26 @@ define("datepicker-zh-TW", function(){});
app.setLanguage = function(cultureName, messages, defaultMessages) {
cultureName = normalizeCultureName(cultureName);

if (cultureName !== 'en') {
require(['cultures/globalize.culture.' + cultureName]);
}

Globalize.culture(cultureName);

app.sandbox.globalize.addCultureInfo(cultureName, messages);
app.sandbox.globalize.addCultureInfo('default', defaultMessages);
};

app.loadLanguage = function(cultureName) {
var deferred = $.Deferred();

if (cultureName !== 'en') {
require(['cultures/globalize.culture.' + cultureName], function() {
deferred.resolve();
});
} else {
deferred.resolve();
}

return deferred.promise();
}
},

afterAppStart: function(app) {
Expand All @@ -51121,11 +51132,13 @@ define("datepicker-zh-TW", function(){});
app.config.culture.messages = {};
}

app.setLanguage(
app.config.culture.name,
app.config.culture.messages,
app.config.culture.defaultMessages
);
app.loadLanguage(app.config.culture.name).then(function() {
app.setLanguage(
app.config.culture.name,
app.config.culture.messages,
app.config.culture.defaultMessages
);
});
}

app.sandbox.globalize.setCurrency('');
Expand Down
2 changes: 1 addition & 1 deletion dist/husky.min.js

Large diffs are not rendered by default.

29 changes: 21 additions & 8 deletions husky_extensions/globalize.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,26 @@
app.setLanguage = function(cultureName, messages, defaultMessages) {
cultureName = normalizeCultureName(cultureName);

if (cultureName !== 'en') {
require(['cultures/globalize.culture.' + cultureName]);
}

Globalize.culture(cultureName);

app.sandbox.globalize.addCultureInfo(cultureName, messages);
app.sandbox.globalize.addCultureInfo('default', defaultMessages);
};

app.loadLanguage = function(cultureName) {
var deferred = $.Deferred();

if (cultureName !== 'en') {
require(['cultures/globalize.culture.' + cultureName], function() {
deferred.resolve();
});
} else {
deferred.resolve();
}

return deferred.promise();
}
},

afterAppStart: function(app) {
Expand All @@ -201,11 +212,13 @@
app.config.culture.messages = {};
}

app.setLanguage(
app.config.culture.name,
app.config.culture.messages,
app.config.culture.defaultMessages
);
app.loadLanguage(app.config.culture.name).then(function() {
app.setLanguage(
app.config.culture.name,
app.config.culture.messages,
app.config.culture.defaultMessages
);
});
}

app.sandbox.globalize.setCurrency('');
Expand Down

0 comments on commit dac3617

Please sign in to comment.