parent
a951c40ba0
commit
cdce25374f
3 changed files with 24 additions and 1 deletions
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
## Refactor
|
## Refactor
|
||||||
* Use string-direction gem for rtl detection [#7181](https://github.com/diaspora/diaspora/pull/7181)
|
* Use string-direction gem for rtl detection [#7181](https://github.com/diaspora/diaspora/pull/7181)
|
||||||
|
* Reduce i18n.load side effects [#7184](https://github.com/diaspora/diaspora/pull/7184)
|
||||||
|
|
||||||
## Bug fixes
|
## Bug fixes
|
||||||
* Fix fetching comments after fetching likes [#7167](https://github.com/diaspora/diaspora/pull/7167)
|
* Fix fetching comments after fetching likes [#7167](https://github.com/diaspora/diaspora/pull/7167)
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ Diaspora.I18n = {
|
||||||
},
|
},
|
||||||
|
|
||||||
updateLocale: function(locale, data) {
|
updateLocale: function(locale, data) {
|
||||||
locale.data = $.extend(locale.data, data);
|
locale.data = $.extend({}, locale.data, data);
|
||||||
|
|
||||||
var rule = locale.data.pluralization_rule;
|
var rule = locale.data.pluralization_rule;
|
||||||
if (typeof rule !== "undefined") {
|
if (typeof rule !== "undefined") {
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,28 @@ describe("Diaspora.I18n", function() {
|
||||||
|
|
||||||
expect(Diaspora.I18n.locale.data).toEqual(extended);
|
expect(Diaspora.I18n.locale.data).toEqual(extended);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("overrides existing translations", function() {
|
||||||
|
var oldLocale = {name: "Bob"};
|
||||||
|
var newLocale = {name: "Alice"};
|
||||||
|
Diaspora.I18n.load(oldLocale, "en");
|
||||||
|
expect(Diaspora.I18n.locale.data.name).toBe("Bob");
|
||||||
|
Diaspora.I18n.load(newLocale, "en");
|
||||||
|
expect(Diaspora.I18n.locale.data.name).toBe("Alice");
|
||||||
|
|
||||||
|
Diaspora.I18n.reset(oldLocale);
|
||||||
|
expect(Diaspora.I18n.locale.data.name).toBe("Bob");
|
||||||
|
Diaspora.I18n.load(newLocale, "en");
|
||||||
|
expect(Diaspora.I18n.locale.data.name).toBe("Alice");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("doesn't change locale objects given in ealier calls", function() {
|
||||||
|
var oldLocale = {name: "Bob"};
|
||||||
|
var newLocale = {name: "Alice"};
|
||||||
|
Diaspora.I18n.reset(oldLocale);
|
||||||
|
Diaspora.I18n.load(newLocale, "en");
|
||||||
|
expect(oldLocale.name).toBe("Bob");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("::t", function() {
|
describe("::t", function() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue