Skip to content

Commit

Permalink
Merge pull request #18 from aurelia/attributes-fix
Browse files Browse the repository at this point in the history
fix(attributes): allow omitting attributes in options
  • Loading branch information
zewa666 committed Sep 21, 2015
2 parents ff9ce63 + 412d8c3 commit 01b64c6
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 7 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aurelia-i18n",
"version": "0.2.1",
"version": "0.2.2",
"description": "A plugin that provides i18n support.",
"keywords": [
"aurelia",
Expand Down
7 changes: 6 additions & 1 deletion dist/amd/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,13 @@ define(['exports', './i18n', 'aurelia-event-aggregator', 'aurelia-templating', '
frameworkConfig.postTask(function () {
var resources = frameworkConfig.container.get(_aureliaTemplating.ViewResources);
var htmlBehaviorResource = resources.getAttribute('t');
var attributes = instance.i18next.options.attributes;

instance.i18next.options.attributes.forEach(function (alias) {
if (!attributes) {
attributes = ['t', 'i18n'];
}

attributes.forEach(function (alias) {
return resources.registerAttribute(alias, htmlBehaviorResource, 't');
});
});
Expand Down
7 changes: 6 additions & 1 deletion dist/commonjs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,13 @@ function configure(frameworkConfig, cb) {
frameworkConfig.postTask(function () {
var resources = frameworkConfig.container.get(_aureliaTemplating.ViewResources);
var htmlBehaviorResource = resources.getAttribute('t');
var attributes = instance.i18next.options.attributes;

instance.i18next.options.attributes.forEach(function (alias) {
if (!attributes) {
attributes = ['t', 'i18n'];
}

attributes.forEach(function (alias) {
return resources.registerAttribute(alias, htmlBehaviorResource, 't');
});
});
Expand Down
8 changes: 7 additions & 1 deletion dist/es6/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,14 @@ export function configure(frameworkConfig, cb) {
frameworkConfig.postTask(() => {
let resources = frameworkConfig.container.get(ViewResources);
let htmlBehaviorResource = resources.getAttribute('t');
let attributes = instance.i18next.options.attributes;

instance.i18next.options.attributes.forEach(alias => resources.registerAttribute(alias, htmlBehaviorResource, 't'));
// Register default attributes if none provided
if (!attributes) {
attributes = ['t', 'i18n'];
}

attributes.forEach(alias => resources.registerAttribute(alias, htmlBehaviorResource, 't'));
});

return ret;
Expand Down
7 changes: 6 additions & 1 deletion dist/system/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,13 @@ System.register(['./i18n', 'aurelia-event-aggregator', 'aurelia-templating', './
frameworkConfig.postTask(function () {
var resources = frameworkConfig.container.get(ViewResources);
var htmlBehaviorResource = resources.getAttribute('t');
var attributes = instance.i18next.options.attributes;

instance.i18next.options.attributes.forEach(function (alias) {
if (!attributes) {
attributes = ['t', 'i18n'];
}

attributes.forEach(function (alias) {
return resources.registerAttribute(alias, htmlBehaviorResource, 't');
});
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aurelia-i18n",
"version": "0.2.1",
"version": "0.2.2",
"description": "A plugin that provides i18n support.",
"keywords": [
"aurelia",
Expand Down
8 changes: 7 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,14 @@ export function configure(frameworkConfig, cb) {
frameworkConfig.postTask(() => {
let resources = frameworkConfig.container.get(ViewResources);
let htmlBehaviorResource = resources.getAttribute('t');
let attributes = instance.i18next.options.attributes;

instance.i18next.options.attributes.forEach(alias => resources.registerAttribute(alias, htmlBehaviorResource, 't'));
// Register default attributes if none provided
if (!attributes) {
attributes = ['t', 'i18n'];
}

attributes.forEach(alias => resources.registerAttribute(alias, htmlBehaviorResource, 't'));
});

return ret;
Expand Down

0 comments on commit 01b64c6

Please sign in to comment.