Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

Commit

Permalink
Fix deprecation warning Ember.assign for ember@2.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
urbany committed Apr 9, 2016
1 parent 472ec32 commit a98bdae
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 3 additions & 1 deletion addon/utils/add-translations.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import Ember from "ember";

const assign = Ember.assign || Ember.merge;

export default function addTranslations(locale, newTranslations, owner) {
const key = `locale:${locale}/translations`;
var existingTranslations = owner._lookupFactory(key);
Expand All @@ -9,5 +11,5 @@ export default function addTranslations(locale, newTranslations, owner) {
owner.register(key, existingTranslations);
}

Ember.merge(existingTranslations, newTranslations);
assign(existingTranslations, newTranslations);
}
7 changes: 4 additions & 3 deletions addon/utils/locale.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Ember from "ember";
const { assert, merge, typeOf, warn } = Ember;
const { assert, typeOf, warn } = Ember;
const assign = Ember.assign || Ember.merge;

// @private
//
Expand Down Expand Up @@ -111,11 +112,11 @@ function getFlattenedTranslations(id, owner) {

const parentId = parentLocale(id);
if (parentId) {
merge(result, getFlattenedTranslations(parentId, owner));
assign(result, getFlattenedTranslations(parentId, owner));
}

const translations = owner._lookupFactory(`locale:${id}/translations`) || {};
merge(result, withFlattenedKeys(translations));
assign(result, withFlattenedKeys(translations));

return result;
}
Expand Down
6 changes: 4 additions & 2 deletions tests/helpers/start-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import Application from '../../app';
import config from '../../config/environment';
import './ember-i18n/test-helpers';

const assign = Ember.assign || Ember.merge;

export default function startApp(attrs) {
var application;

var attributes = Ember.merge({}, config.APP);
attributes = Ember.merge(attributes, attrs); // use defaults, but you can override;
var attributes = assign({}, config.APP);
attributes = assign(attributes, attrs); // use defaults, but you can override;

Ember.run(function() {
application = Application.create(attributes);
Expand Down

0 comments on commit a98bdae

Please sign in to comment.