-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathDownloadAndCopyResx.ps1
63 lines (54 loc) · 2.04 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
59
60
61
62
63
# Download Crowdin zip
Invoke-WebRequest -Uri "https://crowdin.com/backend/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 "ar" "ar"
CopyLanguage "bs" "bs"
CopyLanguage "ca" "ca"
CopyLanguage "cs" "cs"
CopyLanguage "de" "de"
CopyLanguage "el" "el"
CopyLanguage "es-ES" "es"
CopyLanguage "eu" "eu"
CopyLanguage "fr" "fr"
CopyLanguage "hr" "hr"
CopyLanguage "hu" "hu"
CopyLanguage "id" "id"
CopyLanguage "it" "it"
CopyLanguage "ja" "ja"
CopyLanguage "ka" "ka"
CopyLanguage "ko" "ko"
CopyLanguage "nl" "nl"
CopyLanguage "pl" "pl"
CopyLanguage "pt-BR" "pt-BR"
CopyLanguage "pt-PT" "pt"
CopyLanguage "ru" "ru"
CopyLanguage "tr" "tr"
CopyLanguage "vi" "vi"
CopyLanguage "zh-TW" "zh-Hant"
CopyLanguage "zh-CN" "zh"