-
Notifications
You must be signed in to change notification settings - Fork 479
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
531 additions
and
31 deletions.
There are no files selected for viewing
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
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
56 changes: 56 additions & 0 deletions
56
libraries/Microsoft.Bot.Builder.Dialogs/Prompts/PromptCultureModel.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
namespace Microsoft.Bot.Builder.Dialogs.Prompts | ||
{ | ||
/// <summary> | ||
/// Culture model used in Choice and Confirm Prompts. | ||
/// </summary> | ||
public class PromptCultureModel | ||
{ | ||
/// <summary> | ||
/// Gets or Sets Culture Model's Locale. | ||
/// </summary> | ||
/// <value> | ||
/// Ex: Locale. Example: "en-US". | ||
/// </value> | ||
public string Locale { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or Sets Culture Model's InlineSeparator. | ||
/// </summary> | ||
/// <value> | ||
/// Ex: Locale. Example: ", ". | ||
/// </value> | ||
public string Separator { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or Sets Culture Model's InlineOr. | ||
/// </summary> | ||
/// <value> | ||
/// Ex: Locale. Example: " or ". | ||
/// </value> | ||
public string InlineOr { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or Sets Culture Model's InlineOrMore. | ||
/// </summary> | ||
/// <value> | ||
/// Ex: Locale. Example: ", or ". | ||
/// </value> | ||
public string InlineOrMore { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or Sets Equivalent of "Yes" in Culture Model's Language. | ||
/// </summary> | ||
/// <value> | ||
/// Ex: Locale. Example: "Yes". | ||
/// </value> | ||
public string YesInLanguage { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or Sets Equivalent of "No" in Culture Model's Language. | ||
/// </summary> | ||
/// <value> | ||
/// Ex: Locale. Example: "No". | ||
/// </value> | ||
public string NoInLanguage { get; set; } | ||
} | ||
} |
118 changes: 118 additions & 0 deletions
118
libraries/Microsoft.Bot.Builder.Dialogs/Prompts/PromptCultureModels.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
using Microsoft.Recognizers.Text; | ||
|
||
namespace Microsoft.Bot.Builder.Dialogs.Prompts | ||
{ | ||
/// <summary> | ||
/// Class container for currently-supported Culture Models in Confirm and Choice Prompt. | ||
/// </summary> | ||
public static class PromptCultureModels | ||
{ | ||
public static PromptCultureModel Chinese => | ||
new PromptCultureModel | ||
{ | ||
InlineOr = " 要么 ", | ||
InlineOrMore = ", 要么 ", | ||
Locale = Culture.Chinese, | ||
NoInLanguage = "不", | ||
Separator = ", ", | ||
YesInLanguage = "是的", | ||
}; | ||
|
||
public static PromptCultureModel Dutch => | ||
new PromptCultureModel | ||
{ | ||
InlineOr = " of ", | ||
InlineOrMore = ", of ", | ||
Locale = Culture.Dutch, | ||
NoInLanguage = "Nee", | ||
Separator = ", ", | ||
YesInLanguage = "Ja", | ||
}; | ||
|
||
public static PromptCultureModel English => | ||
new PromptCultureModel | ||
{ | ||
InlineOr = " or ", | ||
InlineOrMore = ", or ", | ||
Locale = Culture.English, | ||
NoInLanguage = "No", | ||
Separator = ", ", | ||
YesInLanguage = "Yes", | ||
}; | ||
|
||
public static PromptCultureModel French => | ||
new PromptCultureModel | ||
{ | ||
InlineOr = " ou ", | ||
InlineOrMore = ", ou ", | ||
Locale = Culture.French, | ||
NoInLanguage = "Non", | ||
Separator = ", ", | ||
YesInLanguage = "Oui", | ||
}; | ||
|
||
public static PromptCultureModel German => | ||
new PromptCultureModel | ||
{ | ||
InlineOr = " oder ", | ||
InlineOrMore = ", oder ", | ||
Locale = Culture.German, | ||
NoInLanguage = "Nein", | ||
Separator = ", ", | ||
YesInLanguage = "Ja", | ||
}; | ||
|
||
public static PromptCultureModel Japanese => | ||
new PromptCultureModel | ||
{ | ||
InlineOr = " または ", | ||
InlineOrMore = "、 または ", | ||
Locale = Culture.Japanese, | ||
NoInLanguage = "いいえ", | ||
Separator = "、 ", | ||
YesInLanguage = "はい", | ||
}; | ||
|
||
public static PromptCultureModel Portuguese => | ||
new PromptCultureModel | ||
{ | ||
InlineOr = " ou ", | ||
InlineOrMore = ", ou ", | ||
Locale = Culture.Portuguese, | ||
NoInLanguage = "Não", | ||
Separator = ", ", | ||
YesInLanguage = "Sim", | ||
}; | ||
|
||
public static PromptCultureModel Spanish => | ||
new PromptCultureModel | ||
{ | ||
InlineOr = " o ", | ||
InlineOrMore = ", o ", | ||
Locale = Culture.Spanish, | ||
NoInLanguage = "No", | ||
Separator = ", ", | ||
YesInLanguage = "Sí", | ||
}; | ||
|
||
/// <summary> | ||
/// Use Recognizers-Text to normalize various potential Locale strings to a standard. | ||
/// This mostly exists so that you don't need to directly include Recognizers-Text in other class files (there are some name conflicts). | ||
/// </summary> | ||
/// <param name="culture">Represents locale. Examples: "en-US, en-us, EN".</param> | ||
/// <returns>Normalized locale.</returns> | ||
public static string MapToNearestLanguage(string culture) => Culture.MapToNearestLanguage(culture); | ||
|
||
public static PromptCultureModel[] GetSupportedCultures() => new PromptCultureModel[] | ||
{ | ||
Chinese, | ||
Dutch, | ||
English, | ||
French, | ||
German, | ||
Japanese, | ||
Portuguese, | ||
Spanish, | ||
}; | ||
} | ||
} |
Oops, something went wrong.