Loads all TypeScript, JavaScript and JSON files from locales directory, if i18next backend is not configured. .ts
files shadow .js
files, .js
files shadow .json
files. The folder/file structure is resembled in the final locales object, while the filenames are camelcased, i.e. a folder main-state
will be a key mainState
, which will contain all content from that folder. If LocalesLoader finds an ES6 default export or an export the same name as the camelcased file name, only this is taken from the file. In any other case, everything is exported. Files and folders of the same name are merged. An example can be found here.
Last active
April 26, 2019 08:25
-
-
Save baflo/b88e636948b6b57c3f07af2672088961 to your computer and use it in GitHub Desktop.
Example locales configuration as of Dialogbits Framework 0.5.0
config│
└───locales
└───en
│ entities.ts
│
├───translation
│ │ help-state.ts
│ │ main-state.ts
│ │
│ └───main-state
│ time-intent.ts
│
└───utterances
cancel-intents.ts
invoke-generic-intent.ts
small-talk-intents.ts
{
"en": {
"entities": {},
"translation": {
"helpState": {
"showFaqIntent": "I can't show my FAQ yet."
},
"mainState": {
"timeIntent": "It's chatbot time.",
"testIntent": "Yep, I'm here :)",
"sportResultsIntent": "I don't know. I'm not interested in human sports and there's not bot league, yet."
}
},
"utterances": {
"cancelIntents": {
"cancelGenericIntent": [
"cancel"
],
"stopGenericIntent": [
"stop"
]
},
"invokeGenericIntent": [],
"small-talkIntents": {
"helloIntent": [
"Hello"
],
"whatsYourNameIntent": [
"What's your name"
]
}
}
}
}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { PlatformGenerator } from "assistant-source"; | |
const entities: PlatformGenerator.CustomEntityMapping = {}; | |
export = entities; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const helpState = { | |
showFaqIntent: "I can't show my FAQ yet.", | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default { | |
testIntent: "Yep, I'm here :)", | |
sportResultsIntent: "I don't know. I'm not interested in human sports and there's not bot league, yet.", | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default "It's chatbot time."; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default { | |
cancelGenericIntent: ["cancel"], | |
stopGenericIntent: ["stop"], | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const invokeGenericIntent = []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const helloIntent = ["Hello"]; | |
export const whatsYourNameIntent = ["What's your name"]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment