diff --git a/deploy/core.gbapp/dialogs/WelcomeDialog.ts b/deploy/core.gbapp/dialogs/WelcomeDialog.ts index e41666f7..80258ee4 100644 --- a/deploy/core.gbapp/dialogs/WelcomeDialog.ts +++ b/deploy/core.gbapp/dialogs/WelcomeDialog.ts @@ -35,8 +35,7 @@ import { IGBDialog } from "botlib" import { GBMinInstance } from "botlib" import { BotAdapter } from "botbuilder" -const localize = require("localize")(__dirname) -const _T = localize.translate +const messages = require("./strings.json").messages export class WelcomeDialog extends IGBDialog { /** @@ -52,17 +51,18 @@ export class WelcomeDialog extends IGBDialog { async (dc, args) => { const user = min.userState.get(dc.context) - localize.setLocale(dc.context.activity.locale.split("-")[0]) + let loc = dc.context.activity.locale; if (!user.once) { user.once = true var a = new Date() const date = a.getHours() var msg = - date < 12 ? _T("good morning") : date < 18 ? localize.translate("good evening") : _T("good night") + date < 12 ? messages[loc].good_morning : date < 18 ? + messages[loc].good_evening : messages[loc].good_night - let messages = [`Oi, ${msg}.`, `Oi!`, `Olá, ${msg}`, `Olá!`] - await dc.context.sendActivity(messages[0]) + let messages1 = [`Oi, ${msg}.`, `Oi!`, `Olá, ${msg}`, `Olá!`] + await dc.context.sendActivity(messages1[0]) if (dc.context.activity && dc.context.activity.type == "message" && dc.context.activity.text != "") { diff --git a/deploy/core.gbapp/dialogs/strings.json b/deploy/core.gbapp/dialogs/strings.json new file mode 100644 index 00000000..f2e3aecd --- /dev/null +++ b/deploy/core.gbapp/dialogs/strings.json @@ -0,0 +1,16 @@ +{ + "messages": { + "en-US": { + "show_video": "I will show you a video, please wait...", + "good_morning": "good morning", + "good_evening": "good evening", + "good_night": "good night" + }, + "pt-BR": { + "show_video": "Vou te mostrar um vídeo. Por favor, aguarde...", + "good_morning": "bom dia", + "good_evening": "boa tarde", + "good_night": "boa noite" + } + } +} diff --git a/deploy/core.gbapp/dialogs/translations.json b/deploy/core.gbapp/dialogs/translations.json deleted file mode 100644 index ddc8a37e..00000000 --- a/deploy/core.gbapp/dialogs/translations.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "I will show you a video, please wait...": { - "pt": "Vou te mostrar um vídeo. Por favor, aguarde..." - }, - "good morning": { - "pt": "bom dia" - }, - "good evening": { - "pt": "boa tarde" - }, - "good night": { - "pt": "boa noite" - } -} \ No newline at end of file diff --git a/deploy/core.gbapp/services/GBMinService.ts b/deploy/core.gbapp/services/GBMinService.ts index 9f4fa5cf..8ab4eff1 100644 --- a/deploy/core.gbapp/services/GBMinService.ts +++ b/deploy/core.gbapp/services/GBMinService.ts @@ -36,6 +36,7 @@ const { TextPrompt } = require("botbuilder-dialogs") const UrlJoin = require("url-join") const express = require("express") const logger = require("../../../src/logger") +const request = require('request-promise-native') import { BotFrameworkAdapter, @@ -47,7 +48,6 @@ import { import { GBCoreService } from "./GBCoreService" import { GBConversationalService } from "./GBConversationalService" -import * as request from "request-promise-native" import { GBMinInstance, IGBPackage } from "botlib" import { GBAnalyticsPackage } from "../../analytics.gblib" import { GBCorePackage } from "../../core.gbapp" diff --git a/tsconfig.json b/tsconfig.json index e8fb0b5e..f1eea6e8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,26 +3,23 @@ "allowJs": false, "baseUrl": "./", "declaration": false, + "allowSyntheticDefaultImports": true, + "esModuleInterop" : true, "emitDecoratorMetadata": true, "experimentalDecorators": true, "skipLibCheck": true, "mapRoot": "./dist/", "module": "commonjs", "moduleResolution": "node", + "resolveJsonModule": true, "outDir": "./dist", "paths": { - "botlib/*": [ - "node_modules/botlib/*" - ], - "pragmatismo-io-framework/*": [ - "node_modules/pragmatismo-io-framework/*" - ] + "botlib/*": ["node_modules/botlib/*"], + "pragmatismo-io-framework/*": ["node_modules/pragmatismo-io-framework/*"] }, "sourceMap": true, "target": "es6", - "typeRoots": [ - "node_modules/@types" - ] + "typeRoots": ["node_modules/@types"] }, "include": [ "test/**/*", @@ -30,8 +27,5 @@ "deploy/*.gbapp/**/*", "deploy/*.gblib/**/*" ], - "exclude": [ - "dist", - "node_modules" - ] -} \ No newline at end of file + "exclude": ["dist", "node_modules"] +}