aurelia-i18n
Advanced tools
Comparing version 1.6.1 to 1.6.2
{ | ||
"name": "aurelia-i18n", | ||
"version": "1.6.1", | ||
"version": "1.6.2", | ||
"description": "A plugin that provides i18n support.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -65,3 +65,3 @@ define(['exports'], function (exports) { | ||
try { | ||
ret = _this.options.parse(response, url); | ||
ret = response instanceof Object ? response : _this.options.parse(response, url); | ||
} catch (e) { | ||
@@ -68,0 +68,0 @@ err = 'failed parsing ' + url + ' to json'; |
@@ -795,3 +795,3 @@ import * as LogManager from 'aurelia-logging'; | ||
try { | ||
ret = this.options.parse(response, url); | ||
ret = (response instanceof Object) ? response : this.options.parse(response, url); | ||
} catch (e) { | ||
@@ -798,0 +798,0 @@ err = 'failed parsing ' + url + ' to json'; |
@@ -64,3 +64,3 @@ 'use strict'; | ||
try { | ||
ret = _this.options.parse(response, url); | ||
ret = response instanceof Object ? response : _this.options.parse(response, url); | ||
} catch (e) { | ||
@@ -67,0 +67,0 @@ err = 'failed parsing ' + url + ' to json'; |
@@ -49,3 +49,3 @@ var _class, _temp; | ||
try { | ||
ret = this.options.parse(response, url); | ||
ret = response instanceof Object ? response : this.options.parse(response, url); | ||
} catch (e) { | ||
@@ -52,0 +52,0 @@ err = 'failed parsing ' + url + ' to json'; |
@@ -58,3 +58,3 @@ var _class, _temp; | ||
try { | ||
ret = _this.options.parse(response, url); | ||
ret = response instanceof Object ? response : _this.options.parse(response, url); | ||
} catch (e) { | ||
@@ -61,0 +61,0 @@ err = 'failed parsing ' + url + ' to json'; |
@@ -85,3 +85,3 @@ 'use strict'; | ||
try { | ||
ret = _this.options.parse(response, url); | ||
ret = response instanceof Object ? response : _this.options.parse(response, url); | ||
} catch (e) { | ||
@@ -88,0 +88,0 @@ err = 'failed parsing ' + url + ' to json'; |
@@ -797,3 +797,3 @@ 'use strict'; | ||
try { | ||
ret = _this5.options.parse(response, url); | ||
ret = response instanceof Object ? response : _this5.options.parse(response, url); | ||
} catch (e) { | ||
@@ -800,0 +800,0 @@ err = 'failed parsing ' + url + ' to json'; |
@@ -48,3 +48,3 @@ --- | ||
`npm install aurelia-i18n` | ||
`npm install aurelia-i18n --save` | ||
@@ -54,3 +54,3 @@ Since Aurelia-I18N is backed by i18next, you should install it and a backend plugin of your choice. You can use the built-in backend that uses aurelia's loader or any of your choice. | ||
`npm install i18next i18next-xhr-backend` | ||
`npm install i18next i18next-xhr-backend --save` | ||
@@ -100,3 +100,3 @@ After that we need to tell our CLI App about the new dependencies. To do so we're going to open the file *aurelia_project/aurelia.json* and scroll down to the section named *dependencies*. In there add the following three entries: | ||
```shell | ||
npm install aurelia-i18n | ||
npm install aurelia-i18n --save | ||
``` | ||
@@ -107,3 +107,3 @@ | ||
```shell | ||
npm install i18next-xhr-backend | ||
npm install i18next-xhr-backend --save | ||
``` | ||
@@ -167,2 +167,4 @@ | ||
> Notice that Aurelia I18N makes use of a non-standard attributes option, which is used to define custom aliases besides the default ones, being `t` and `i18n`. Calling `TCustomAttribute.configureAliases` is currently necessary in order make sure that the aliases are defined before view templates are fully processed. | ||
<code-listing heading="Registering the Plugin - using the built-in aurelia loader backed:"> | ||
@@ -245,2 +247,4 @@ <source-code lang="ES 2015"> | ||
You may also group your translations by namespaces, spread across multiple files. Say you have the standard translation.json and an additional `nav.json` for the navigation items, you can configure aurelia-i18n by passing the `ns` setting in the config object containing the different namespaces as well as the default namespace. | ||
When using namespaces, you will need to prepend string references with `ns:` for those strings that are not in the | ||
defaultNS. For example `t='nav:profile'` would access the `profile` string in `nav.json`. | ||
@@ -374,3 +378,3 @@ <code-listing heading="Setting up Multiple Namespaces"> | ||
### Translating via code | ||
Translating stuff via code works by using the method `tr`. You pass in the `key` as its first parameter, followed by the optional second parameter `options` to specify in detail how the translations should be performed. Please consult the [i18next docs](http://i18next.com/translate/#overrideoptions for a detailed list of those: | ||
Translating stuff via code works by using the method `tr`. You pass in the `key` as its first parameter, followed by the optional second parameter `options` to specify in detail how the translations should be performed. Please consult the [i18next docs](http://i18next.com/translate/#overrideoptions) for a detailed list of those: | ||
@@ -1063,3 +1067,3 @@ <code-listing heading="Translating using the i18n.tr function"> | ||
`npm install intl` | ||
`npm install intl --save` | ||
@@ -1066,0 +1070,0 @@ After that open up the *aurelia_project/aurelia.json* file and add the following dependency: |
@@ -0,1 +1,8 @@ | ||
<a name="1.6.2"></a> | ||
## [1.6.2](https://github.com/aurelia/i18n/compare/1.6.1...v1.6.2) (2017-07-10) | ||
### Bug Fixes | ||
* Don't try to parse translation json if already parsed. | ||
<a name="1.6.1"></a> | ||
@@ -2,0 +9,0 @@ ## [1.6.1](https://github.com/aurelia/i18n/compare/1.6.0...v1.6.1) (2017-05-31) |
{ | ||
"name": "aurelia-i18n", | ||
"version": "1.6.1", | ||
"version": "1.6.2", | ||
"description": "A plugin that provides i18n support.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -58,3 +58,3 @@ // aurelia-i18n-loader | ||
try { | ||
ret = this.options.parse(response, url); | ||
ret = (response instanceof Object) ? response : this.options.parse(response, url); | ||
} catch (e) { | ||
@@ -61,0 +61,0 @@ err = 'failed parsing ' + url + ' to json'; |
559178