forked from RandomEngy/VidCoder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DownloadAndCopyResx.ps1
58 lines (49 loc) · 1.86 KB
/
DownloadAndCopyResx.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Download Crowdin zip
Invoke-WebRequest -Uri "https://crowdin.com/download/project/vidcoder.zip" -OutFile ".\Import\VidCoderResources.zip"
# Extract files from Crowdin zip
if (Test-Path .\Import\Resources) {
Remove-Item .\Import\Resources\* -recurse
}
Add-Type -assembly "system.io.compression.filesystem"
[io.compression.zipfile]::ExtractToDirectory(".\Import\VidCoderResources.zip", "Import\Resources")
# Copy files from holding directory to project directory
$copiedFiles = New-Object System.Collections.Generic.List[System.String]
function CopyLanguage($languageDir, $language) {
$fileEntries = [IO.Directory]::GetFiles(".\Import\Resources\" + $languageDir)
foreach($fullFileName in $fileEntries)
{
$lastSlash = $fullFileName.LastIndexOf("\")
$sourceFileName = $fullFileName.Substring($lastSlash + 1)
if ($languageDir.Contains("-")) {
$destFileName = $sourceFileName.Replace($languageDir, $language)
} else {
$destFileName = $sourceFileName
}
$sourcePath = ".\Import\Resources\" + $languageDir + "\" + $sourceFileName
$destPath = ".\VidCoder\Resources\Translations\" + $destFileName
copy $sourcePath $destPath
Write-Host "Copied $sourcePath to $destPath"
$copiedFiles.Add($destFileName)
}
}
# List of language codes and names: http://msdn.microsoft.com/en-us/goglobal/bb896001.aspx
CopyLanguage "es-ES" "es"
CopyLanguage "fr" "fr"
CopyLanguage "hu" "hu"
CopyLanguage "pt-PT" "pt"
CopyLanguage "pt-BR" "pt-BR"
CopyLanguage "eu" "eu"
CopyLanguage "de" "de"
CopyLanguage "zh-TW" "zh-Hant"
CopyLanguage "zh-CN" "zh"
CopyLanguage "it" "it"
CopyLanguage "ja" "ja"
CopyLanguage "cs" "cs"
CopyLanguage "ru" "ru"
CopyLanguage "pl" "pl"
CopyLanguage "tr" "tr"
CopyLanguage "nl" "nl"
CopyLanguage "ka" "ka"
CopyLanguage "ko" "ko"
CopyLanguage "bs" "bs"
CopyLanguage "id" "id"