Skip to content

Commit ffd4f5e

Browse files
default locale condition handle in the ctor
default locale condition handle in the ctor & removed from the on_recognize function
1 parent f77682e commit ffd4f5e

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

libraries/botbuilder-community-dialogs-prompts/source/number_with_type_prompt.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ def __init__(
2121
):
2222
super().__init__(dialog_id, validator)
2323

24+
if default_locale is None:
25+
default_locale = Culture.English
26+
2427
self._default_locale = default_locale
2528
self._prompt_type = prompt_type
2629

@@ -54,11 +57,8 @@ async def on_recognize(
5457
if turn_context.activity.type == ActivityTypes.message:
5558
utterance = turn_context.activity.text
5659

57-
if turn_context.activity.locale is not None:
58-
turn_context.activity.locale = self._default_locale
59-
else:
60-
turn_context.activity.locale = Culture.English
61-
60+
turn_context.activity.locale = self._default_locale
61+
6262
recognizer_result = PromptRecognizerResult()
6363

6464
recognizer = NumberRecognizer(turn_context.activity.locale)

libraries/botbuilder-community-dialogs-prompts/source/number_with_unit_prompt.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ def __init__(
3535
):
3636
super().__init__(dialog_id, validator)
3737

38+
if default_locale is None:
39+
default_locale = Culture.English
40+
3841
self._default_locale = default_locale
3942
self._prompt_type = prompt_type
4043

@@ -68,11 +71,8 @@ async def on_recognize(
6871
if turn_context.activity.type == ActivityTypes.message:
6972
utterance = turn_context.activity.text
7073

71-
if turn_context.activity.locale is not None:
72-
turn_context.activity.locale = self._default_locale
73-
else:
74-
turn_context.activity.locale = Culture.English
75-
74+
turn_context.activity.locale = self._default_locale
75+
7676
recognizer_result = PromptRecognizerResult()
7777

7878
recognizer = NumberWithUnitRecognizer(turn_context.activity.locale)

0 commit comments

Comments
 (0)