forked from sorayuki/obs-multi-rtmp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SyncEngLocale.ps1
36 lines (33 loc) · 840 Bytes
/
SyncEngLocale.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
function ReadLocaleAsArray {
param (
$fileName
)
return Get-Content $fileName | Foreach-Object {
$x = $_.Split("=")
return @{Key=$x[0]; Value=$x[1]}
}
}
function ReadLocale {
param (
$fileName
)
$r = @{}
Get-Content $fileName | Foreach-Object {
$x = $_.Split("=")
$r[$x[0]] = $x[1]
}
return $r
}
$en_locale = ReadLocaleAsArray ".\data\locale\en-US.ini"
Get-ChildItem ".\data\locale" -File | ForEach-Object {
$cur_locale = ReadLocale (".\data\locale" + "\" + $_.Name)
$en_locale `
| ForEach-Object {
if ($cur_locale.ContainsKey($_.Key)) {
return $_.Key + "=" + $cur_locale[$_.Key]
} else {
return $_.Key + "=" + $_.Value
}
} `
| Set-Content -Path (".\data\locale" + "\" + $_.Name)
}