@jargon/sdk-core
Advanced tools
Comparing version 1.0.9 to 1.1.0
@@ -0,1 +1,10 @@ | ||
### 1.1.0 | ||
Add built-in resources for common scenarios. These resources are available using the `RenderItem` keys: | ||
* `Jargon.unhandledResponse` -- provides a response for when you can't otherwise process an intent | ||
* `Jargon.defaultReprompt` -- provides a generic reprompt | ||
A customer-provided definition for these resource keys is used in preference to the built-in resources. | ||
Currently the SDK includes variants of these resources for English, with other languages coming soon. | ||
### 1.0.9 | ||
@@ -16,3 +25,3 @@ Fix bad release | ||
### 1.0.4 | ||
#### Suport RenderItem instances as RenderParams values | ||
#### Support RenderItem instances as RenderParams values | ||
@@ -31,2 +40,2 @@ The use of a RenderItem instance as a parameter value makes it easy to compose multiple | ||
### 1.0.0 | ||
* Intitial Release | ||
* Initial Release |
@@ -20,5 +20,5 @@ import * as i18n from 'i18next'; | ||
private _opts; | ||
constructor(options: ResourceManagerOptions); | ||
constructor(options: ResourceManagerOptions, appendedResources?: any); | ||
forLocale(locale: string): ResourceManager; | ||
private baseTranslator; | ||
} |
@@ -64,2 +64,3 @@ "use strict"; | ||
var icuFormat_1 = require("./icuFormat"); | ||
var jargonResources_1 = require("./jargonResources"); | ||
var _1 = require("."); | ||
@@ -196,4 +197,11 @@ var I18NextResourceManager = /** @class */ (function () { | ||
var I18NextResourceManagerFactory = /** @class */ (function () { | ||
function I18NextResourceManagerFactory(options) { | ||
function I18NextResourceManagerFactory(options, appendedResources) { | ||
if (appendedResources === void 0) { appendedResources = jargonResources_1.JargonResources; } | ||
this._opts = Object.assign({}, _1.DefaultResourceManagerOptions, options); | ||
var lang; | ||
for (lang in appendedResources) { | ||
if (this._opts.localesToPreload.indexOf(lang) === -1) { | ||
this._opts.localesToPreload.push(lang); | ||
} | ||
} | ||
this.baseTranslator = i18n | ||
@@ -212,2 +220,5 @@ .use(syncBackend) | ||
}); | ||
for (lang in appendedResources) { | ||
this.baseTranslator.addResourceBundle(lang, 'translation', appendedResources[lang], true, false); | ||
} | ||
} | ||
@@ -214,0 +225,0 @@ I18NextResourceManagerFactory.prototype.forLocale = function (locale) { |
@@ -79,3 +79,3 @@ import { I18NextResourceManagerFactory } from './i18next'; | ||
/** | ||
* Options control additional rendering behavior, overridding the | ||
* Options control additional rendering behavior, overriding the | ||
* settings configured at the ResourceManager level. | ||
@@ -82,0 +82,0 @@ */ |
{ | ||
"name": "@jargon/sdk-core", | ||
"version": "1.0.9", | ||
"version": "1.1.0", | ||
"description": "Core components of Jargon's NodeJS SDK", | ||
@@ -5,0 +5,0 @@ "author": "jargon.com", |
@@ -75,3 +75,3 @@ # `@jargon/sdk-core` | ||
`ResourceManager` allows clients to access content resources stored in locale-specifc | ||
`ResourceManager` allows clients to access content resources stored in locale-specific | ||
files, and to render those resources at runtime, substituting parameters. | ||
@@ -82,5 +82,15 @@ | ||
Resource files live in "resources" subdirectory of the process's runtime directory; this will soon be customizeable via | ||
Resource files live in "resources" subdirectory of the process's runtime directory; this will soon be customizable via | ||
`ResourceManagerOptions`. | ||
### Built-in Resources | ||
This SDK includes default responses for some common scenarios. These responses are available using the following `RenderItem` keys: | ||
* `Jargon.unhandledResponse` -- provides a response for when you can't otherwise process an intent | ||
* `Jargon.defaultReprompt` -- provides a generic reprompt | ||
You can render these resources as you would any of your own, as described in the following section. You can also define your own version for these keys in your resource file to override the Jargon-provided responses. | ||
Currently the SDK includes variants of these resources for English, with other languages coming soon. | ||
## Runtime Interface | ||
@@ -233,3 +243,3 @@ | ||
/** | ||
* Options control additional rendering behavior, overridding the | ||
* Options control additional rendering behavior, overriding the | ||
* settings configured at the ResourceManager level. | ||
@@ -236,0 +246,0 @@ */ |
Sorry, the diff of this file is not supported yet
65405
22
705
265