Skip to content

Commit a0bae6d

Browse files
committed
updated LKG build and package.json version.
1 parent 4d30861 commit a0bae6d

13 files changed

+73
-34
lines changed

Node/core/lib/DefaultLocalizer.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ var fs = require('fs');
33
var async = require('async');
44
var logger = require('./logger');
55
var DefaultLocalizer = (function () {
6-
function DefaultLocalizer() {
7-
}
8-
DefaultLocalizer.prototype.initialize = function (settings) {
6+
function DefaultLocalizer(settings) {
97
if (settings === void 0) { settings = {}; }
108
if (settings.botLocalePath) {
119
this.botLocalePath = settings.botLocalePath.toLowerCase();
@@ -22,7 +20,7 @@ var DefaultLocalizer = (function () {
2220
else {
2321
this.defaultLocale("en");
2422
}
25-
};
23+
}
2624
DefaultLocalizer.prototype.defaultLocale = function (locale) {
2725
if (locale) {
2826
this._defaultLocale = locale;
@@ -162,7 +160,9 @@ var DefaultLocalizer = (function () {
162160
logger.debug("localizer::load requested for: %s", localeRequestKey);
163161
if (DefaultLocalizer.localeRequests[localeRequestKey]) {
164162
logger.debug("localizer::already loaded requested locale: %s", localeRequestKey);
165-
done(null);
163+
if (done) {
164+
done(null);
165+
}
166166
return;
167167
}
168168
var fb = this.getFallback(locale);
@@ -214,13 +214,12 @@ var DefaultLocalizer = (function () {
214214
}
215215
},
216216
], function (err, results) {
217-
if (err) {
218-
done(err);
219-
}
220-
else {
217+
if (!err) {
221218
DefaultLocalizer.localeRequests[localeRequestKey] = true;
222219
logger.debug("localizer::loaded requested locale: %s", localeRequestKey);
223-
done();
220+
}
221+
if (done) {
222+
done(err);
224223
}
225224
});
226225
};

Node/core/lib/Session.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,11 @@ var Session = (function (_super) {
2828
this.localizer = null;
2929
this.library = options.library;
3030
if (!options.localizer) {
31-
this.localizer = new dfLoc.DefaultLocalizer();
31+
this.localizer = new dfLoc.DefaultLocalizer(options.localizerSettings);
3232
}
3333
else {
3434
this.localizer = options.localizer;
3535
}
36-
this.localizer.initialize(options.localizerSettings);
3736
if (typeof this.options.autoBatchDelay !== 'number') {
3837
this.options.autoBatchDelay = 250;
3938
}
@@ -471,7 +470,8 @@ var Session = (function (_super) {
471470
var cur = this.curDialog();
472471
if (cur && this.message.text.indexOf('action?') !== 0) {
473472
var dialog = this.findDialog(cur.id);
474-
dialog.recognize({ message: this.message, dialogData: cur.state, activeDialog: true }, done);
473+
var locale = this.preferredLocale();
474+
dialog.recognize({ message: this.message, locale: locale, dialogData: cur.state, activeDialog: true }, done);
475475
}
476476
else {
477477
done(null, { score: 0.0 });

Node/core/lib/botbuilder.d.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,8 @@ export interface IIsFact {
310310
toFact(): IFact;
311311
}
312312

313-
interface ILocalizerSettings {
313+
/** Settings used to initialize an ILocalizer implementation. */
314+
interface IDefaultLocalizerSettings {
314315
/** The path to the parent of the bot's locale directory */
315316
botLocalePath?: string;
316317

@@ -320,12 +321,6 @@ interface ILocalizerSettings {
320321

321322
/** Plugin for localizing messages sent to the user by a bot. */
322323
export interface ILocalizer {
323-
/**
324-
* Intitializes the localizer.
325-
* @param localizerSettings (Optional) settings to supply to the localizer.
326-
*/
327-
initialize(localizerSettings?: ILocalizerSettings): void;
328-
329324
/**
330325
* Loads the localied table for the supplied locale, and call's the supplied callback once the load is complete.
331326
* @param locale The locale to load.
@@ -477,6 +472,9 @@ export interface IPromptOptions {
477472

478473
/** (Optional) flag used to control the reprompting of a user after a dialog started by an action ends. The default value is true. */
479474
promptAfterAction?: boolean;
475+
476+
/** (Optional) namespace to use when localizing a passed in prompt. */
477+
localizationNamespace?: string;
480478
}
481479

482480
/** Arguments passed to the built-in prompts beginDialog() call. */
@@ -738,9 +736,12 @@ export interface IUniversalBotSettings {
738736
/** (Optional) arguments to pass to the initial dialog for a conversation. */
739737
defaultDialogArgs?: any;
740738

741-
/** (Optional) localizer used to localize the bots responses to the user. */
739+
/** (Optional) cutstom localizer used to localize the bots responses to the user. */
742740
localizer?: ILocalizer;
743741

742+
/** (Optional) settings used to configure the frameworks built in default localizer. */
743+
localizerSettings?: IDefaultLocalizerSettings;
744+
744745
/** (Optional) function used to map the user ID for an incoming message to another user ID. This can be used to implement user account linking. */
745746
lookupUser?: (address: IAddress, done: (err: Error, user: IIdentity) => void) => void;
746747

@@ -1822,8 +1823,9 @@ export class Prompts extends Dialog {
18221823
* * __prompt:__ _{string}_ - Initial message to send the user.
18231824
* * __prompt:__ _{string[]}_ - Array of possible messages to send user. One will be chosen at random.
18241825
* * __prompt:__ _{IMessage|IIsMessage}_ - Initial message to send the user. Message can contain attachments.
1826+
* @param options (Optional) parameters to control the behaviour of the prompt.
18251827
*/
1826-
static text(session: Session, prompt: string|string[]|IMessage|IIsMessage): void;
1828+
static text(session: Session, prompt: string|string[]|IMessage|IIsMessage, options?: IPromptOptions): void;
18271829

18281830
/**
18291831
* Prompts the user to enter a number.

Node/core/lib/dialogs/IntentDialog.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ var IntentDialog = (function (_super) {
6969
IntentDialog.prototype.replyReceived = function (session, recognizeResult) {
7070
var _this = this;
7171
if (!recognizeResult) {
72-
this.recognize({ message: session.message, dialogData: session.dialogData, activeDialog: true }, function (err, result) {
72+
var locale = session.preferredLocale();
73+
this.recognize({ message: session.message, locale: locale, dialogData: session.dialogData, activeDialog: true }, function (err, result) {
7374
if (!err) {
7475
_this.invokeIntent(session, result);
7576
}

Node/core/lib/dialogs/LuisRecognizer.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ var LuisRecognizer = (function () {
1313
var result = { score: 0.0, intent: null };
1414
if (context && context.message && context.message.text) {
1515
var utterance = context.message.text;
16-
var locale = context.message.textLocale || '*';
17-
var model = this.models.hasOwnProperty(locale) ? this.models[locale] : this.models['*'];
16+
var model = this.models.hasOwnProperty(context.locale || '*') ? this.models[context.locale] : this.models['*'];
1817
if (model) {
1918
LuisRecognizer.recognize(utterance, model, function (err, intents, entities) {
2019
if (!err) {
@@ -49,7 +48,7 @@ var LuisRecognizer = (function () {
4948
});
5049
}
5150
else {
52-
cb(new Error("LUIS model not found for locale '" + locale + "'."), null);
51+
cb(new Error("LUIS model not found for locale '" + context.locale + "'."), null);
5352
}
5453
}
5554
else {

Node/core/lib/dialogs/Prompts.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -252,11 +252,11 @@ var Prompts = (function (_super) {
252252
}
253253
}
254254
};
255-
Prompts.text = function (session, prompt) {
256-
beginPrompt(session, {
257-
promptType: PromptType.text,
258-
prompt: prompt
259-
});
255+
Prompts.text = function (session, prompt, options) {
256+
var args = options || {};
257+
args.promptType = PromptType.text;
258+
args.prompt = prompt;
259+
beginPrompt(session, args);
260260
};
261261
Prompts.number = function (session, prompt, options) {
262262
var args = options || {};

Node/core/lib/locale/en/BotBuilder.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"confirm_yes": "yes",
88
"confirm_no": "no",
99
"default_choice": "I didn't understand. Please choose an option from the list.",
10-
"default_time": "I didn't recognize the time you entered. Please try again.",
10+
"default_time": "I didn't recognize the time you entered. Please try again using a format of (MM/DD/YYYY HH:MM:SS).",
1111
"default_file": "I didn't receive a file. Please try again.",
1212
"default_error": "Oops. Something went wrong and we need to start over."
1313
}
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
{
2+
"default_text": "No se pudo reconocer su respuesta. Por favor vuelva a intentar.",
3+
"default_number": "No se pudo reconocer el texto como número. Vuelva a intentar sólo con números.",
4+
"default_confirm": "No se pudo reconocer la confirmación. Por favor responda con 'si' o 'no'.",
25
"list_or": " o ",
36
"list_or_more": ", o ",
47
"confirm_yes": "si",
5-
"confirm_no": "no"
8+
"confirm_no": "no",
9+
"default_choice": "No se pudo reconocer su respuesta. Por favor seleccione una opción de la lista.",
10+
"default_time": "No se pudo reconocer el formato de la fecha. Por favor vuelva a intentar (MM/DD/YYYY HH:MM:SS).",
11+
"default_file": "No se pudo recibir el archivo. Por favor vuelva a intentar.",
12+
"default_error": "Oops. Ocurrió un problema. Por favor vuelva a intentar."
613
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"default_text": "Non ho capito. Riprova per favore.",
3+
"default_number": "Il valore inserito non sembra essere un numero. Per favore inserisci un numero.",
4+
"default_confirm": "Non ho capito. Per favore rispondi 'sì' o 'no'.",
5+
"list_or": " o ",
6+
"list_or_more": " o ",
7+
"confirm_yes": "",
8+
"confirm_no": "no",
9+
"default_choice": "Non ho capito. Per favore scegli un'opzione dalla lista.",
10+
"default_time": "Il valore inserito non sembra essere una data. Attualmente capisco solo date in inglese. Per favore riprova specificando la data in inglese (p.es. 17 August 2013, 08/17/2013 [nota: il mese viene prima in questo formato!], 5 days ago, Today, ecc.).",
11+
"default_file": "Non ho ricevuto nessun file. Riprova per favore.",
12+
"default_error": "Ops. Qualcosa è andato storto e dobbiamo ricominciare da capo."
13+
}

Node/core/lib/locale/it/index.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"Hello World": "HOLA DESDE BOT"
3+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"default_text": "我没听明白。请重复。",
3+
"default_number": "这好像不是数字. 请输入数字",
4+
"default_confirm": "我没听明白。 请选择'是'或'否'。",
5+
"list_or": "",
6+
"list_or_more": ", 或",
7+
"confirm_yes": "",
8+
"confirm_no": "",
9+
"default_choice": "我没听明白。请从可选项中选择。",
10+
"default_time": "这好像不是日期,时间。 请输入日期,时间 (月月/日日/年年年年 时时:分分:秒秒)。",
11+
"default_file": "我没有收到文件,请再传一次。",
12+
"default_error": "啊呀。发生故障了,我需要重启。"
13+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{
2+
}

Node/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "botbuilder",
33
"author": "Microsoft Corp.",
44
"description": "Bot Builder is a dialog system for building rich bots on virtually any platform.",
5-
"version": "3.3.0",
5+
"version": "3.3.1",
66
"license": "MIT",
77
"keywords": [
88
"botbuilder",

0 commit comments

Comments
 (0)