Skip to content
This repository was archived by the owner on Sep 11, 2023. It is now read-only.

Commit 7235fb6

Browse files
committed
use TryGetValue for language dictionaries
1 parent 0250e70 commit 7235fb6

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

Interop/TranslationProvider.cs

+7-6
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,14 @@ public TranslationProvider()
4545
/// <returns></returns>
4646
public static string Translate(string phrase)
4747
{
48-
if (_langDictionary.ContainsKey(phrase))
48+
49+
if (_langDictionary.TryGetValue(phrase, out var result))
4950
{
50-
return _langDictionary[phrase];
51+
return result;
5152
}
52-
else if (_defaultDictionary.ContainsKey(phrase))
53+
else if (_defaultDictionary.TryGetValue(phrase, out result))
5354
{
54-
return _defaultDictionary[phrase];
55+
return result;
5556
}
5657
else
5758
{
@@ -170,7 +171,7 @@ public void UpdateTranslations()
170171
try
171172
{
172173
// Clear temp folder before beggining
173-
DirUtils.ClearTempFolder();
174+
DirUtils.ClearSPCodeTempFolder();
174175

175176
// Download latest release zip file
176177
var wc = new WebClient();
@@ -196,7 +197,7 @@ public void UpdateTranslations()
196197
}
197198

198199
// Delete all temp folder contents
199-
DirUtils.ClearTempFolder();
200+
DirUtils.ClearSPCodeTempFolder();
200201

201202
// Update version to options object
202203
Program.OptionsObject.TranslationsVersion = int.Parse(_latestVersion.Name);

0 commit comments

Comments
 (0)