Skip to content
This repository was archived by the owner on Jun 30, 2022. It is now read-only.

Commit 7814965

Browse files
KayMKMlzc850612
authored andcommitted
localize the contact name separator (#490)
1 parent 32070e1 commit 7814965

File tree

4 files changed

+32
-5
lines changed

4 files changed

+32
-5
lines changed

solutions/Virtual-Assistant/src/csharp/skills/calendarskill/Dialogs/CreateEvent/CreateEventDialog.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ public CreateEventDialog(
450450
{
451451
if (userInput != null)
452452
{
453-
var nameList = userInput.Split(new string[] { ",", "and", ";" }, StringSplitOptions.None)
453+
var nameList = userInput.Split(CreateEventWhiteList.GetContactNameSeparator(), StringSplitOptions.None)
454454
.Select(x => x.Trim())
455455
.Where(x => !string.IsNullOrWhiteSpace(x))
456456
.ToList();

solutions/Virtual-Assistant/src/csharp/skills/calendarskill/Dialogs/CreateEvent/Resources/CreateEventWhiteList.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ private class WhiteList
2020

2121
[JsonProperty("DefaultTitle")]
2222
public List<string> DefaultTitle;
23+
24+
[JsonProperty("ContactSeparator")]
25+
public string[] ContactSeparator;
2326
}
2427

2528
private static Dictionary<string, WhiteList> WhiteLists;
@@ -65,5 +68,17 @@ public static string GetDefaultTitle()
6568
int rand = Random.Next(0, WhiteLists[locale].DefaultTitle.Count);
6669
return WhiteLists[locale].DefaultTitle[rand];
6770
}
71+
72+
public static string[] GetContactNameSeparator()
73+
{
74+
var locale = CultureInfo.CurrentUICulture.Name.Split("-")[0].ToLower();
75+
76+
if (!WhiteLists.ContainsKey(locale))
77+
{
78+
locale = DefaultCulture;
79+
}
80+
81+
return WhiteLists[locale].ContactSeparator;
82+
}
6883
}
6984
}

solutions/Virtual-Assistant/src/csharp/skills/calendarskill/Dialogs/CreateEvent/Resources/CreateEventWhiteList.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@
55
"no",
66
"No"
77
],
8-
"DefaultTitle": [
9-
"Meeting"
10-
]
8+
"DefaultTitle": [
9+
"Meeting"
10+
],
11+
"ContactSeparator": [
12+
",",
13+
"and",
14+
";"
15+
]
1116
}

solutions/Virtual-Assistant/src/csharp/skills/calendarskill/Dialogs/CreateEvent/Resources/CreateEventWhiteList.zh.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,12 @@
77
],
88
"DefaultTitle": [
99
"会议"
10+
],
11+
"ContactSeparator": [
12+
",",
13+
"",
14+
";",
15+
"",
16+
""
1017
]
11-
}
18+
}

0 commit comments

Comments
 (0)