Skip to content

Commit da1df37

Browse files
committed
tr-TR culture problem fix #1095
1 parent 1f855ac commit da1df37

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

Engine/Settings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ private void parseSettingsHashtable(Hashtable settingsHashtable)
395395
var settings = GetDictionaryFromHashtable(settingsHashtable);
396396
foreach (var settingKey in settings.Keys)
397397
{
398-
var key = settingKey.ToLower();
398+
var key = settingKey.ToLowerInvariant();
399399
object val = settings[key];
400400
switch (key)
401401
{
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Describe "Issue 1095: An exception is thrown when CurrentCulture is Turkish (tr-TR)" {
2+
It "Should not throw an exception when CurrentCulture is tr-TR" {
3+
# https://github.com/PowerShell/PSScriptAnalyzer/issues/1095
4+
5+
$initialCulture = Get-Culture
6+
$initialUICulture = Get-UICulture
7+
8+
{
9+
$trTRculture = [System.Globalization.CultureInfo]::GetCultureInfo('tr-TR')
10+
[System.Threading.Thread]::CurrentThread.CurrentUICulture = $trTRculture
11+
[System.Threading.Thread]::CurrentThread.CurrentCulture = $trTRculture
12+
Invoke-Formatter "`$test" -ErrorAction Stop
13+
14+
} | Should -Throw -Not
15+
16+
[System.Threading.Thread]::CurrentThread.CurrentCulture = $initialCulture
17+
[System.Threading.Thread]::CurrentThread.CurrentUICulture = $initialUICulture
18+
19+
}
20+
}

0 commit comments

Comments
 (0)