new(core.gbapp): TRANSLATOR_DISABLED added to .env before migrating to .gbot.
This commit is contained in:
parent
57f9965132
commit
1a2d1f3346
4 changed files with 13 additions and 23 deletions
|
@ -525,6 +525,10 @@ export class GBConversationalService {
|
|||
language: string
|
||||
): Promise<string> {
|
||||
|
||||
if (process.env.TRANSLATOR_DISABLED === "true"){
|
||||
return text;
|
||||
}
|
||||
|
||||
let options = {
|
||||
method: 'POST',
|
||||
baseUrl: endPoint,
|
||||
|
@ -588,22 +592,4 @@ export class GBConversationalService {
|
|||
await step.context.sendActivity(text);
|
||||
}
|
||||
|
||||
public async checkLanguage(step: GBDialogStep, min, text) {
|
||||
const locale = await AzureText.getLocale(min.instance.textAnalyticsKey, min.instance.textAnalyticsEndpoint, text);
|
||||
if (locale !== step.context.activity.locale.split('-')[0]) {
|
||||
switch (locale) {
|
||||
case 'pt':
|
||||
step.context.activity.locale = 'pt-BR';
|
||||
await min.conversationalService.sendText(min, step, Messages[locale].changing_language);
|
||||
break;
|
||||
case 'en':
|
||||
step.context.activity.locale = 'en-US';
|
||||
await min.conversationalService.sendText(min, step, Messages[locale].changing_language);
|
||||
break;
|
||||
default:
|
||||
await min.conversationalService.sendText(min, step, `; Unknown; language: $;{locale;}`);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -682,8 +682,11 @@ export class GBMinService {
|
|||
|
||||
let query = context.activity.text;
|
||||
|
||||
const locale = await AzureText.getLocale(min.instance.textAnalyticsKey,
|
||||
let locale = 'pt';
|
||||
if (process.env.TRANSLATOR_DISABLED !== "true"){
|
||||
locale = await AzureText.getLocale(min.instance.textAnalyticsKey,
|
||||
min.instance.textAnalyticsEndpoint, query);
|
||||
}
|
||||
|
||||
let sec = new SecService();
|
||||
const member = step.context.activity.from;
|
||||
|
|
|
@ -103,9 +103,12 @@ export class AskDialog extends IGBDialog {
|
|||
|
||||
let query = step.result;
|
||||
|
||||
const locale = await AzureText.getLocale(min.instance.textAnalyticsKey,
|
||||
let locale = 'pt';
|
||||
if (process.env.TRANSLATOR_DISABLED !== "true"){
|
||||
locale = await AzureText.getLocale(min.instance.textAnalyticsKey,
|
||||
min.instance.textAnalyticsEndpoint, query);
|
||||
|
||||
}
|
||||
|
||||
let sec = new SecService();
|
||||
const member = step.context.activity.from;
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
export const Messages = {
|
||||
'en-US': {
|
||||
did_not_find: 'I\'m sorry I didn\'t find anything.',
|
||||
changing_language: 'OK, changing language to English...',
|
||||
going_answer: 'Great choice, now looking for your answer...',
|
||||
wider_answer: subjectText =>
|
||||
`Answering to you in a broader way... Not just about ${subjectText}.`,
|
||||
|
@ -18,7 +17,6 @@ export const Messages = {
|
|||
},
|
||||
'pt-BR': {
|
||||
did_not_find: 'Desculpe-me, não encontrei nada a respeito.',
|
||||
changing_language: 'OK, mundando de idioma para o Português...',
|
||||
going_answer: 'Ótima escolha, procurando resposta para sua questão...',
|
||||
wider_answer: subjectText =>
|
||||
`Vou te responder de modo mais abrangente... Não apenas sobre ${subjectText}`,
|
||||
|
|
Loading…
Add table
Reference in a new issue