GrammarBuilder.Culture Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the culture of the speech recognition grammar.
public:
property System::Globalization::CultureInfo ^ Culture { System::Globalization::CultureInfo ^ get(); void set(System::Globalization::CultureInfo ^ value); };
public System.Globalization.CultureInfo Culture { get; set; }
member this.Culture : System.Globalization.CultureInfo with get, set
Public Property Culture As CultureInfo
Property Value
The culture of the GrammarBuilder. The default is the executing thread's CurrentUICulture property.
Examples
The following example creates a speech recognition grammar for ordering a pizza with up to four toppings. It specifically sets the GrammarBuilder object's culture to English (United States).
private static Grammar CreatePizzaGrammar()
{
// Create a Choices object with alternatives for toppings.
Choices toppings = new Choices(new string[] {
"cheese", "mushroom", "tomato", "onion",
"anchovy", "chicken", "pepperoni"});
// Create a GrammarBuilder and append the Choices object.
GrammarBuilder andToppings = new GrammarBuilder("and", 0, 1);
andToppings.Append(toppings);
// Construct the phrase.
GrammarBuilder gb = new GrammarBuilder("I would like a", 0, 1);
gb.Append(toppings);
gb.Append(new GrammarBuilder(andToppings, 0, 3));
gb.Append("pizza");
// Create the Grammar from the GrammarBuilder.
Grammar grammar = new Grammar(gb);
grammar.Name = "Pizza Order";
return grammar;
}
Remarks
The Grammar constructor creates a Grammar object that can be used by a speech recognizer of the corresponding culture. Only the Culture property of the GrammarBuilder that is provided as the parameter to the Grammar constructor is used to set the culture of the resulting speech recognition grammar.
Microsoft Windows and the System.Speech API accept all valid language-country codes. To perform speech recognition using the language specified in the Culture
property, a speech recognition engine that supports that language-country code must be installed. The speech recognition engines that shipped with Microsoft Windows 7 work with the following language-country codes.
en-GB. English (United Kingdom)
en-US. English (United States)
de-DE. German (Germany)
es-ES. Spanish (Spain)
fr-FR. French (France)
ja-JP. Japanese (Japan)
zh-CN. Chinese (China)
zh-TW. Chinese (Taiwan)
Two-letter language codes such as "en", "fr", or "es" are also permitted.
Applies to
See also
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기