Skip to content

Commit

Permalink
Add locales to Alexa and dialogflow
Browse files Browse the repository at this point in the history
  • Loading branch information
rmberrios committed May 8, 2019
1 parent 62b95cf commit 57c5cdb
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 22 deletions.
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

## [2.1.2] - 2019-05-08

### Added

- Added more locales to Alexa and Dialogflow
- Added support for webhookForSlotFilling (dialogflow)
- Added support for webhookUsed (dialogflow)
- Added suppport for intent responses (dialogflow)
- Added support for intent responses (dialogflow)
- Added support for required slots

### Fixed
Expand All @@ -22,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed empty suggestion chip on VUI
- Fixed overlap on utterance and slots
- Fixed views have an array path with object
- Fixed issue with pt-br is not attached to it's parent

### Removed

Expand Down Expand Up @@ -98,7 +102,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add support for Alexa, Dialogflow
- Add support to download other sheet

[unreleased]: https://github.com/VoxaAI/voxa-cli/compare/2.1.1...staging
[unreleased]: https://github.com/VoxaAI/voxa-cli/compare/2.1.2...staging
[2.1.2]: https://github.com/VoxaAI/voxa-cli/compare/2.1.1...2.1.2
[2.1.1]: https://github.com/VoxaAI/voxa-cli/compare/2.1.0...2.1.1
[2.1.0]: https://github.com/VoxaAI/voxa-cli/compare/2.0.1...2.1.0
[2.0.1]: https://github.com/VoxaAI/voxa-cli/compare/2.0.0...2.0.1
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "voxa-cli",
"version": "2.1.2-alpha10",
"version": "2.1.2",
"description": "The Voxa CLI tools",
"bin": {
"voxa": "./bin/voxa.js"
Expand Down
1 change: 1 addition & 0 deletions src/AlexaSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const AVAILABLE_LOCALES = [
"ja-JP",
"es-ES",
"es-MX",
"es-US",
"fr-FR",
"fr-CA",
"it-IT",
Expand Down
46 changes: 27 additions & 19 deletions src/DialogflowSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,9 @@ import { IFileContent, IIntent, Schema } from "./Schema";
import { IVoxaSheet } from "./VoxaSheet";

const NAMESPACE = "dialogflow";
const AVAILABLE_LOCALES = [
"en",
"de",
"fr",
"ja",
"ko",
"es",
"pt",
"it",
"ru",
"hi",
"th",
"id",
"da",
"no",
"nl",
"sv",
// https://developers.google.com/actions/localization/languages-locales

const LOCALES = _.chain([
"en-US",
"en-AU",
"en-CA",
Expand All @@ -57,6 +43,7 @@ const AVAILABLE_LOCALES = [
"ja-JP",
"ko-KR",
"es-ES",
"es-US",
"es-MX",
"pt-BR",
"it-IT",
Expand All @@ -67,8 +54,22 @@ const AVAILABLE_LOCALES = [
"da-DK",
"no-NO",
"nl-NL",
"sv-SE"
];
"sv-SE",
"ko-KR",
"ru-RU",
"hi-IN",
"th-TH",
"id-ID"
])
.uniq()
.value();

const LANG_BUT_LOCALE = _.chain(LOCALES)
.map(item => item.split("-")[0]) // es, en, du etc.
.uniq()
.value();

const AVAILABLE_LOCALES = LANG_BUT_LOCALE.concat(LOCALES);

export interface IDialogflowMessage {
type: number;
Expand Down Expand Up @@ -111,6 +112,13 @@ export class DialogflowSchema extends Schema {
}

public getLocale(locale: string) {
locale = locale.toLowerCase();
const localesNotAttachedToParentLang = ["pt-br"];

if (localesNotAttachedToParentLang.find(item => locale === item)) {
return locale;
}

return locale.split("-")[0];
}

Expand Down

0 comments on commit 57c5cdb

Please sign in to comment.