Skip to content

Commit

Permalink
chore(all): prepare release 2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Nov 15, 2017
1 parent cce3b09 commit 187c891
Show file tree
Hide file tree
Showing 48 changed files with 367 additions and 194 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": "2.0.0",
"version": "2.1.0",
"description": "A plugin that provides i18n support.",
"keywords": [
"aurelia",
Expand Down
7 changes: 7 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
System.config({
defaultJSExtensions: true,
transpiler: "babel",
babelOptions: {
"optional": [
"runtime",
"optimisation.modules.system"
]
},
paths: {
"github:*": "jspm_packages/github/*",
"npm:*": "jspm_packages/npm/*"
Expand Down
4 changes: 2 additions & 2 deletions dist/amd/aurelia-i18n-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ define(['exports'], function (exports) {
};

function Backend(services) {
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};



Expand All @@ -25,7 +25,7 @@ define(['exports'], function (exports) {
}

Backend.prototype.init = function init(services) {
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

this.services = services;
this.options = defaults(options, this.options || {}, getDefaults());
Expand Down
50 changes: 19 additions & 31 deletions dist/amd/aurelia-i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ define(['exports', 'aurelia-logging', 'aurelia-event-aggregator', 'aurelia-templ
}
}

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;
};

function registerI18N(frameworkConfig, cb) {
var instance = new _i18n.I18N(frameworkConfig.container.get(_aureliaEventAggregator.EventAggregator), frameworkConfig.container.get(_aureliaTemplatingResources.BindingSignaler));
frameworkConfig.container.registerInstance(_i18n.I18N, instance);
Expand Down Expand Up @@ -69,32 +63,26 @@ define(['exports', 'aurelia-logging', 'aurelia-event-aggregator', 'aurelia-templ
frameworkConfig.globalResources(_aureliaPal.PLATFORM.moduleName('./df'));
frameworkConfig.globalResources(_aureliaPal.PLATFORM.moduleName('./rt'));

if (window.Intl === undefined) {
var _ret = function () {
var i18nLogger = LogManager.getLogger('i18n');
i18nLogger.warn('Intl API is not available. Trying to load the polyfill.');
var loader = frameworkConfig.container.get(_aureliaLoader.Loader);
var normalizeErrorMessage = 'Failed to normalize {module} while loading the Intl polyfill.';

return {
v: loader.normalize('aurelia-i18n').then(function (i18nName) {
return loader.normalize('intl', i18nName).then(function (intlName) {
return loader.loadModule(intlName).then(function (poly) {
window.Intl = poly;
return registerI18N(frameworkConfig, cb);
}, function () {
return i18nLogger.warn('Failed to load the Intl polyfill.');
});
}, function () {
return i18nLogger.warn(normalizeErrorMessage.replace('{module}', 'intl'));
});
if (_aureliaPal.PLATFORM.global.Intl === undefined) {
var i18nLogger = LogManager.getLogger('i18n');
i18nLogger.warn('Intl API is not available. Trying to load the polyfill.');
var loader = frameworkConfig.container.get(_aureliaLoader.Loader);
var normalizeErrorMessage = 'Failed to normalize {module} while loading the Intl polyfill.';

return loader.normalize('aurelia-i18n').then(function (i18nName) {
return loader.normalize('intl', i18nName).then(function (intlName) {
return loader.loadModule(intlName).then(function (poly) {
_aureliaPal.PLATFORM.global.Intl = poly;
return registerI18N(frameworkConfig, cb);
}, function () {
return i18nLogger.warn(normalizeErrorMessage.replace('{module}', 'aurelia-i18n'));
})
};
}();

if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
return i18nLogger.warn('Failed to load the Intl polyfill.');
});
}, function () {
return i18nLogger.warn(normalizeErrorMessage.replace('{module}', 'intl'));
});
}, function () {
return i18nLogger.warn(normalizeErrorMessage.replace('{module}', 'aurelia-i18n'));
});
}

return Promise.resolve(registerI18N(frameworkConfig, cb));
Expand Down
4 changes: 2 additions & 2 deletions dist/amd/base-i18n.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define(['exports', './i18n', 'aurelia-event-aggregator'], function (exports, _i18n, _aureliaEventAggregator) {
define(['exports', './i18n', 'aurelia-pal', 'aurelia-event-aggregator'], function (exports, _i18n, _aureliaPal, _aureliaEventAggregator) {
'use strict';

Object.defineProperty(exports, "__esModule", {
Expand Down Expand Up @@ -33,5 +33,5 @@ define(['exports', './i18n', 'aurelia-event-aggregator'], function (exports, _i1
};

return BaseI18N;
}(), _class.inject = [_i18n.I18N, Element, _aureliaEventAggregator.EventAggregator], _temp);
}(), _class.inject = [_i18n.I18N, _aureliaPal.DOM.Element, _aureliaEventAggregator.EventAggregator], _temp);
});
21 changes: 21 additions & 0 deletions dist/amd/defaultTranslations/relative.time.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,27 @@ define(['exports'], function (exports) {
'day_in_plural': 'om __count__ dager'
}
},
ja: {
translation: {
'now': 'たった今',
'second_ago': '__count__ 秒前',
'second_ago_plural': '__count__ 秒前',
'second_in': 'あと __count__ 秒',
'second_in_plural': 'あと __count__ 秒',
'minute_ago': '__count__ 分前',
'minute_ago_plural': '__count__ 分前',
'minute_in': 'あと __count__ 分',
'minute_in_plural': 'あと __count__ 分',
'hour_ago': '__count__ 時間前',
'hour_ago_plural': '__count__ 時間前',
'hour_in': 'あと __count__ 時間',
'hour_in_plural': 'あと __count__ 時間',
'day_ago': '__count__ 日間前',
'day_ago_plural': '__count__ 日間前',
'day_in': 'あと __count__ 日間',
'day_in_plural': 'あと __count__ 日間'
}
},
jp: {
translation: {
'now': 'たった今',
Expand Down
6 changes: 5 additions & 1 deletion dist/amd/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ define(['exports', 'aurelia-logging', 'i18next', 'aurelia-pal', 'aurelia-event-a

this.i18next = _i18next2.default;
this.ea = ea;
this.Intl = window.Intl;
this.Intl = _aureliaPal.PLATFORM.global.Intl;
this.signaler = signaler;
this.i18nextDefered.promise = new Promise(function (resolve) {
return _this.i18nextDefered.resolve = resolve;
Expand All @@ -71,6 +71,10 @@ define(['exports', 'aurelia-logging', 'i18next', 'aurelia-pal', 'aurelia-event-a
debug: false
};

if (options && !options.lng) {
throw new Error('You need to provide the lng option');
}

_i18next2.default.init(options || defaultOptions, function (err, t) {
if (_i18next2.default.options.attributes instanceof String) {
_i18next2.default.options.attributes = [_i18next2.default.options.attributes];
Expand Down
2 changes: 1 addition & 1 deletion dist/amd/rt.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ define(['exports', './relativeTime', 'aurelia-templating-resources', 'aurelia-bi
}

RtBindingBehavior.prototype.bind = function bind(binding, source) {
this.signalBindingBehavior.bind(binding, source, 'aurelia-translation-signal');
this.signalBindingBehavior.bind(binding, source, 'aurelia-translation-signal', 'aurelia-relativetime-signal');

var sourceExpression = binding.sourceExpression;

Expand Down
6 changes: 3 additions & 3 deletions dist/amd/t.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define(['exports', './i18n', 'aurelia-event-aggregator', 'aurelia-metadata', 'aurelia-templating', 'aurelia-templating-resources', 'aurelia-binding', './utils'], function (exports, _i18n, _aureliaEventAggregator, _aureliaMetadata, _aureliaTemplating, _aureliaTemplatingResources, _aureliaBinding, _utils) {
define(['exports', './i18n', 'aurelia-event-aggregator', 'aurelia-metadata', 'aurelia-templating', 'aurelia-templating-resources', 'aurelia-binding', 'aurelia-pal', './utils'], function (exports, _i18n, _aureliaEventAggregator, _aureliaMetadata, _aureliaTemplating, _aureliaTemplatingResources, _aureliaBinding, _aureliaPal, _utils) {
'use strict';

Object.defineProperty(exports, "__esModule", {
Expand Down Expand Up @@ -43,7 +43,7 @@ define(['exports', './i18n', 'aurelia-event-aggregator', 'aurelia-metadata', 'au
TParamsCustomAttribute.prototype.valueChanged = function valueChanged() {};

return TParamsCustomAttribute;
}(), _class2.inject = [Element], _temp)) || _class);
}(), _class2.inject = [_aureliaPal.DOM.Element], _temp)) || _class);
var TCustomAttribute = exports.TCustomAttribute = (_dec2 = (0, _aureliaTemplating.customAttribute)('t'), _dec2(_class3 = (_temp2 = _class4 = function () {
TCustomAttribute.configureAliases = function configureAliases(aliases) {
var r = _aureliaMetadata.metadata.getOrCreateOwn(_aureliaMetadata.metadata.resource, _aureliaTemplating.HtmlBehaviorResource, TCustomAttribute);
Expand Down Expand Up @@ -94,7 +94,7 @@ define(['exports', './i18n', 'aurelia-event-aggregator', 'aurelia-metadata', 'au
};

return TCustomAttribute;
}(), _class4.inject = [Element, _i18n.I18N, _aureliaEventAggregator.EventAggregator, _utils.LazyOptional.of(TParamsCustomAttribute)], _temp2)) || _class3);
}(), _class4.inject = [_aureliaPal.DOM.Element, _i18n.I18N, _aureliaEventAggregator.EventAggregator, _utils.LazyOptional.of(TParamsCustomAttribute)], _temp2)) || _class3);
var TBindingBehavior = exports.TBindingBehavior = (_temp3 = _class5 = function () {
function TBindingBehavior(signalBindingBehavior) {

Expand Down
2 changes: 1 addition & 1 deletion dist/amd/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ define(['exports', 'aurelia-dependency-injection'], function (exports, _aureliaD
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};

var extend = exports.extend = function extend(destination, source) {
Expand Down
3 changes: 2 additions & 1 deletion dist/aurelia-i18n.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import {
resolver
} from 'aurelia-dependency-injection';
import {
DOM
DOM,
PLATFORM
} from 'aurelia-pal';
import {
EventAggregator
Expand Down
37 changes: 31 additions & 6 deletions dist/aurelia-i18n.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as LogManager from 'aurelia-logging';
import i18next from 'i18next';
import {resolver} from 'aurelia-dependency-injection';
import {DOM} from 'aurelia-pal';
import {DOM,PLATFORM} from 'aurelia-pal';
import {EventAggregator} from 'aurelia-event-aggregator';
import {BindingSignaler,SignalBindingBehavior} from 'aurelia-templating-resources';
import {ValueConverter} from 'aurelia-binding';
Expand Down Expand Up @@ -289,6 +289,27 @@ export const translations = {
'day_in_plural': 'om __count__ dager'
}
},
ja: {
translation: {
'now': 'たった今',
'second_ago': '__count__ 秒前',
'second_ago_plural': '__count__ 秒前',
'second_in': 'あと __count__ 秒',
'second_in_plural': 'あと __count__ 秒',
'minute_ago': '__count__ 分前',
'minute_ago_plural': '__count__ 分前',
'minute_in': 'あと __count__ 分',
'minute_in_plural': 'あと __count__ 分',
'hour_ago': '__count__ 時間前',
'hour_ago_plural': '__count__ 時間前',
'hour_in': 'あと __count__ 時間',
'hour_in_plural': 'あと __count__ 時間',
'day_ago': '__count__ 日間前',
'day_ago_plural': '__count__ 日間前',
'day_in': 'あと __count__ 日間',
'day_in_plural': 'あと __count__ 日間'
}
},
jp: {
translation: {
'now': 'たった今',
Expand Down Expand Up @@ -525,7 +546,7 @@ export class I18N {
constructor(ea, signaler) {
this.i18next = i18next;
this.ea = ea;
this.Intl = window.Intl;
this.Intl = PLATFORM.global.Intl;
this.signaler = signaler;
this.i18nextDefered.promise = new Promise((resolve) => this.i18nextDefered.resolve = resolve);
}
Expand All @@ -540,6 +561,10 @@ export class I18N {
debug: false
};

if (options && !options.lng) {
throw new Error('You need to provide the lng option');
}

i18next.init(options || defaultOptions, (err, t) => {
//make sure attributes is an array in case a string was provided
if (i18next.options.attributes instanceof String) {
Expand Down Expand Up @@ -876,7 +901,7 @@ function defaults(obj) {

export class BaseI18N {

static inject = [I18N, Element, EventAggregator];
static inject = [I18N, DOM.Element, EventAggregator];

constructor(i18n, element, ea) {
this.i18n = i18n;
Expand Down Expand Up @@ -1125,7 +1150,7 @@ export class TValueConverter {

@customAttribute('t-params')
export class TParamsCustomAttribute {
static inject = [Element];
static inject = [DOM.Element];
static configureAliases(aliases) {
let r = metadata.getOrCreateOwn(metadata.resource, HtmlBehaviorResource, TParamsCustomAttribute);
r.aliases = aliases;
Expand All @@ -1144,7 +1169,7 @@ export class TParamsCustomAttribute {
@customAttribute('t')
export class TCustomAttribute {

static inject = [Element, I18N, EventAggregator, LazyOptional.of(TParamsCustomAttribute)];
static inject = [DOM.Element, I18N, EventAggregator, LazyOptional.of(TParamsCustomAttribute)];
static configureAliases(aliases) {
let r = metadata.getOrCreateOwn(metadata.resource, HtmlBehaviorResource, TCustomAttribute);
r.aliases = aliases;
Expand Down Expand Up @@ -1257,7 +1282,7 @@ export class RtBindingBehavior {

bind(binding, source) {
// bind the signal behavior
this.signalBindingBehavior.bind(binding, source, 'aurelia-translation-signal');
this.signalBindingBehavior.bind(binding, source, 'aurelia-translation-signal', 'aurelia-relativetime-signal');

// rewrite the expression to use the RtValueConverter.
// pass through any args to the binding behavior to the RtValueConverter
Expand Down
4 changes: 2 additions & 2 deletions dist/commonjs/aurelia-i18n-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var Backend = exports.Backend = (_temp = _class = function () {
};

function Backend(services) {
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};



Expand All @@ -24,7 +24,7 @@ var Backend = exports.Backend = (_temp = _class = function () {
}

Backend.prototype.init = function init(services) {
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

this.services = services;
this.options = defaults(options, this.options || {}, getDefaults());
Expand Down
46 changes: 19 additions & 27 deletions dist/commonjs/aurelia-i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
});
exports.Backend = exports.EventAggregator = exports.BaseI18N = exports.TParamsCustomAttribute = exports.TCustomAttribute = exports.TBindingBehavior = exports.TValueConverter = exports.RtBindingBehavior = exports.RtValueConverter = exports.NfBindingBehavior = exports.NfValueConverter = exports.DfBindingBehavior = exports.DfValueConverter = exports.RelativeTime = exports.I18N = exports.configure = undefined;

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };

var _aureliaLogging = require('aurelia-logging');

var LogManager = _interopRequireWildcard(_aureliaLogging);
Expand Down Expand Up @@ -77,32 +75,26 @@ function configure(frameworkConfig, cb) {
frameworkConfig.globalResources(_aureliaPal.PLATFORM.moduleName('./df'));
frameworkConfig.globalResources(_aureliaPal.PLATFORM.moduleName('./rt'));

if (window.Intl === undefined) {
var _ret = function () {
var i18nLogger = LogManager.getLogger('i18n');
i18nLogger.warn('Intl API is not available. Trying to load the polyfill.');
var loader = frameworkConfig.container.get(_aureliaLoader.Loader);
var normalizeErrorMessage = 'Failed to normalize {module} while loading the Intl polyfill.';

return {
v: loader.normalize('aurelia-i18n').then(function (i18nName) {
return loader.normalize('intl', i18nName).then(function (intlName) {
return loader.loadModule(intlName).then(function (poly) {
window.Intl = poly;
return registerI18N(frameworkConfig, cb);
}, function () {
return i18nLogger.warn('Failed to load the Intl polyfill.');
});
}, function () {
return i18nLogger.warn(normalizeErrorMessage.replace('{module}', 'intl'));
});
if (_aureliaPal.PLATFORM.global.Intl === undefined) {
var i18nLogger = LogManager.getLogger('i18n');
i18nLogger.warn('Intl API is not available. Trying to load the polyfill.');
var loader = frameworkConfig.container.get(_aureliaLoader.Loader);
var normalizeErrorMessage = 'Failed to normalize {module} while loading the Intl polyfill.';

return loader.normalize('aurelia-i18n').then(function (i18nName) {
return loader.normalize('intl', i18nName).then(function (intlName) {
return loader.loadModule(intlName).then(function (poly) {
_aureliaPal.PLATFORM.global.Intl = poly;
return registerI18N(frameworkConfig, cb);
}, function () {
return i18nLogger.warn(normalizeErrorMessage.replace('{module}', 'aurelia-i18n'));
})
};
}();

if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
return i18nLogger.warn('Failed to load the Intl polyfill.');
});
}, function () {
return i18nLogger.warn(normalizeErrorMessage.replace('{module}', 'intl'));
});
}, function () {
return i18nLogger.warn(normalizeErrorMessage.replace('{module}', 'aurelia-i18n'));
});
}

return Promise.resolve(registerI18N(frameworkConfig, cb));
Expand Down
Loading

0 comments on commit 187c891

Please sign in to comment.