7. Dezember 2014 22:43
function Create_DEU_DES_diff
{
function EditCHfile
{
Write-Host 'Extracting DES lines from ENU-DES-FRS-ITS language file'
get-content c:\ps\p1\CH.txt | select-string -pattern '-A2055-' -simplematch | Out-File c:\ps\p1\CH_DES.txt -width 1024
}
function RemoveLangCodeinCHfile
{
Write-Host 'Replacing -A2055- with -DE-'
$a = get-content c:\ps\p1\CH_DES.txt
$a = $a -replace '-A2055-','-DE-'
Out-File -filepath c:\ps\p1\CH_DES_DE.txt -inputobject $a -width 1024
}
function EditDEfile
{
Write-Host 'Extracting DEU lines from ENU-DEU language file'
get-content c:\ps\p1\DE.txt | select-string -pattern '-A1031-' -simplematch | Out-File c:\ps\p1\DE_DEU.txt -width 1024
}
function RemoveLangCodeinDEfile
{
Write-host 'Replacing -A1031- with -DE-'
$a = get-content c:\ps\p1\DE_DEU.txt
$a = $a -replace '-A1031-', '-DE-'
Out-File -filepath c:\ps\p1\DE_DEU_DE.txt -inputobject $a -width 1024
}
EditCHfile
RemoveLangCodeinCHfile
EditDEfile
RemoveLangCodeinDEfile
}
function Create_ENU_NA_ENU_DE_diff
{
function ExtractENUfromNAfile
{
Write-Host 'Extracting ENU lines from NA language file'
get-content c:\ps\p3\NA.txt | select-string -pattern '-A1033-' -simplematch | Out-File c:\ps\p3\NA_ENU.txt -width 1024
}
function ExtractENUfromDEfile
{
Write-Host 'Extracting ENU lines from DE language file'
get-content c:\ps\p3\DE.txt | select-string -pattern '-A1033-' -simplematch | Out-File c:\ps\p3\DE_ENU.txt -width 1024
}
ExtractENUfromNAfile
ExtractENUfromDEfile
}
10. Dezember 2014 01:53
function Create_ENU_ENG_diff
{
function EditGBfile1
{
Write-Host 'Extracting ENU lines from GB language file'
get-content c:\ps\p4\GB.txt | select-string -pattern '-A2057-' -simplematch | Out-File c:\ps\p4\GB_ENG.txt -width 1024
}
function RemoveLangCodeinGBfile1
{
Write-Host 'Replacing -A2057- with -EN-'
$a = get-content c:\ps\p4\GB_ENG.txt
$a = $a -replace '-A2057-','-EN-'
Out-File -filepath c:\ps\p4\GB_ENG_EN.txt -inputobject $a -width 1024
}
function EditGBfile2
{
Write-Host 'Extracting ENU lines from GB language file'
get-content c:\ps\p4\GB.txt | select-string -pattern '-A1033-' | Out-File c:\ps\p4\GB_ENU.txt -width 1024
}
function RemoveLangCodeinGBfile2
{
Write-host 'Replacing -A1033- with -EN-'
$a = get-content c:\ps\p4\GB_ENU.txt
$a = $a -replace '-A1033-', '-EN-'
Out-File -filepath c:\ps\p4\GB_ENU_EN.txt -inputobject $a -width 1024
}
EditGBfile1
RemoveLangCodeinGBfile1
EditGBfile2
RemoveLangCodeinGBfile2
}
15. Dezember 2014 15:57
-width 1024
19. Dezember 2014 01:56
-encoding UTF8
function Create_UTF8_DEU_DES_diff
{
function ConvertFilesOEM850ToUTF8
{
$OEM850filename1 = Resolve-Path '.\CH.txt'
$OEM850filename2 = Resolve-Path '.\DE.txt'
if (Test-path '.\CHunicode.txt') {Remove-Item -path '.\CHunicode.txt'}
if (Test-path '.\DEunicode.txt') {Remove-Item -path '.\DEunicode.txt'}
$unicodefilename1 = New-Item -path '.\CHunicode.txt' -type file
$unicodefilename2 = New-Item -path '.\DEunicode.txt' -type file
# European codepage 850
$encodingOEM850 = [System.Text.Encoding]::GetEncoding(850)
$encodingUTF8 = [System.Text.Encoding]::GetEncoding(65001)
Write-host "Converting $OEM850filename1 to $unicodefilename1"
$textfile1 = [System.IO.File]::ReadAllText($OEM850filename1, $encodingOEM850)
[System.IO.File]::WriteAllText($unicodefilename1, $textfile1, $encodingUTF8)
Write-host "Converting $OEM850filename2 to $unicodefilename2"
$textfile2 = [System.IO.File]::ReadAllText($OEM850filename2, $encodingOEM850)
[System.IO.File]::WriteAllText($unicodefilename2, $textfile2, $encodingUTF8)
}
function EditCHfile
{
Write-Host 'Extracting DES lines from ENU-DES-FRS-ITS language file'
get-content .\CHunicode.txt | select-string -pattern '-A2055-' -simplematch | Out-File .\CH_DES.txt -width 1024 -encoding UTF8
}
function RemoveLangCodeinCHfile
{
Write-Host 'Replacing -A2055- with -DE-'
$a = get-content .\CH_DES.txt
$a = $a -replace '-A2055-','-DE-'
Out-File -filepath .\CH_DES_DE.txt -inputobject $a -width 1024 -encoding UTF8
}
function EditDEfile
{
Write-Host 'Extracting DEU lines from ENU-DEU language file'
get-content .\DEunicode.txt | select-string -pattern '-A1031-' -simplematch | Out-File .\DE_DEU.txt -width 1024 -encoding UTF8
}
function RemoveLangCodeinDEfile
{
Write-host 'Replacing -A1031- with -DE-'
$a = get-content .\DE_DEU.txt
$a = $a -replace '-A1031-', '-DE-'
Out-File -filepath .\DE_DEU_DE.txt -inputobject $a -width 1024 -encoding UTF8
}
ConvertFilesOEM850ToUTF8
EditCHfile
RemoveLangCodeinCHfile
EditDEfile
RemoveLangCodeinDEfile
}
20. Dezember 2014 01:00
function CreateDiffFile_DEU_DES
{
if (test-path '.\CH_DE_CaptionDiff.txt') {Remove-Item -path '.\CH_DE_CaptionDiff.txt'}
$filename3 = New-Item -path '.\CH_DE_CaptionDiff.txt' -type file
$DEUcode = 'DEU'
$DEScode = 'DES'
out-file -FilePath $filename3 -inputobject "Code`t$DEUcode`t$DESCode" -width 1024 -Encoding UTF8
foreach ($line in get-content DE_DEU_DE.txt)
{
$PosColon = $line.indexof(":")
if ($PosColon -gt 0)
{
$SearchPattern = $line.substring(0,$PosColon)
$CaptionFile1 = $line.substring($PosColon + 1)
$CaptionFile1 = $CaptionFile1 -replace "`t|`n|`r",""
write-host "Seaching for:" $SearchPattern
$lineFile2 = get-content CH_DES_DE.txt | select-string -pattern $SearchPattern -simplematch | Out-String
$PosColon2 = $lineFile2.indexof(":")
$ResultCodeString = $line.substring(0,$SearchPattern.length)
if ($ResultCodeString -eq $SearchPattern)
{
$CaptionFile2 = $lineFile2.substring($PosColon2 + 1)
$CaptionFile2 = $CaptionFile2 -replace "`t|`n|`r",""
$CaptionFile1 = $CaptionFile1.trim()
$CaptionFile2 = $CaptionFile2.trim()
if ($CaptionFile1 -ne $CaptionFile2)
{
out-file -FilePath $filename3 -inputobject "$SearchPattern`t$CaptionFile1`t$CaptionFile2" -width 2148 -append -Encoding UTF8
write-host "DEU:" $CaptionFile1.trim() -foregroundcolor "green"
write-host "DES:" $CaptionFile2.trim() -foregroundcolor "yellow"
}
}
}
}
}
21. Februar 2015 23:25
function Create_UTF8_DEU_DEA_diff
{
function ConvertFilesOEM850ToUTF8
{
$OEM850filename1 = Resolve-Path '.\AT.txt'
$OEM850filename2 = Resolve-Path '.\DE.txt'
if (Test-path '.\ATunicode.txt') {Remove-Item -path '.\ATunicode.txt'}
if (Test-path '.\DEunicode.txt') {Remove-Item -path '.\DEunicode.txt'}
$unicodefilename1 = New-Item -path '.\ATunicode.txt' -type file
$unicodefilename2 = New-Item -path '.\DEunicode.txt' -type file
# European codepage 850
$encodingOEM850 = [System.Text.Encoding]::GetEncoding(850)
$encodingUTF8 = [System.Text.Encoding]::GetEncoding(65001)
Write-host "Converting $OEM850filename1 to $unicodefilename1"
$textfile1 = [System.IO.File]::ReadAllText($OEM850filename1, $encodingOEM850)
[System.IO.File]::WriteAllText($unicodefilename1, $textfile1, $encodingUTF8)
Write-host "Converting $OEM850filename2 to $unicodefilename2"
$textfile2 = [System.IO.File]::ReadAllText($OEM850filename2, $encodingOEM850)
[System.IO.File]::WriteAllText($unicodefilename2, $textfile2, $encodingUTF8)
}
function EditATfile
{
Write-Host 'Extracting DEA lines from ENU-DEA language file'
get-content .\ATunicode.txt | select-string -pattern '-A3079-' -simplematch | Out-File .\AT_DEA.txt -width 1024 -encoding UTF8
}
function RemoveLangCodeinATfile
{
Write-Host 'Replacing -A3079- with -DE-'
$a = get-content .\AT_DEA.txt
$a = $a -replace '-A3079-','-DE-'
Out-File -filepath .\AT_DEA_DE.txt -inputobject $a -width 1024 -encoding UTF8
}
function EditDEfile
{
Write-Host 'Extracting DEU lines from ENU-DEU language file'
get-content .\DEunicode.txt | select-string -pattern '-A1031-' -simplematch | Out-File .\DE_DEU.txt -width 1024 -encoding UTF8
}
function RemoveLangCodeinDEfile
{
Write-host 'Replacing -A1031- with -DE-'
$a = get-content .\DE_DEU.txt
$a = $a -replace '-A1031-', '-DE-'
Out-File -filepath .\DE_DEU_DE.txt -inputobject $a -width 1024 -encoding UTF8
}
ConvertFilesOEM850ToUTF8
EditATfile
RemoveLangCodeinATfile
EditDEfile
RemoveLangCodeinDEfile
}
22. Februar 2015 01:32
function CreateDiffFile_DEU_DEA
{
if (test-path '.\AT_DE_CaptionDiff.txt') {Remove-Item -path '.\AT_DE_CaptionDiff.txt'}
$filename3 = New-Item -path '.\AT_DE_CaptionDiff.txt' -type file
$DEUcode = 'DEU'
$DEAcode = 'DEA'
out-file -FilePath $filename3 -inputobject "Code`t$DEUcode`t$DEACode" -width 1024 -Encoding UTF8
foreach ($line in get-content DE_DEU_DE.txt)
{
$PosColon = $line.indexof(":")
if ($PosColon -gt 0)
{
$SearchPattern = $line.substring(0,$PosColon)
$CaptionFile1 = $line.substring($PosColon + 1)
$CaptionFile1 = $CaptionFile1 -replace "`t|`n|`r",""
write-host "Seaching for:" $SearchPattern
$lineFile2 = get-content AT_DEA_DE.txt | select-string -pattern $SearchPattern -simplematch | Out-String
$PosColon2 = $lineFile2.indexof(":")
$ResultCodeString = $line.substring(0,$SearchPattern.length)
if ($ResultCodeString -eq $SearchPattern)
{
$CaptionFile2 = $lineFile2.substring($PosColon2 + 1)
$CaptionFile2 = $CaptionFile2 -replace "`t|`n|`r",""
$CaptionFile1 = $CaptionFile1.trim()
$CaptionFile2 = $CaptionFile2.trim()
if ($CaptionFile1 -ne $CaptionFile2)
{
out-file -FilePath $filename3 -inputobject "$SearchPattern`t$CaptionFile1`t$CaptionFile2" -width 2148 -append -Encoding UTF8
write-host "DEU:" $CaptionFile1.trim() -foregroundcolor "green"
write-host "DEA:" $CaptionFile2.trim() -foregroundcolor "yellow"
}
}
}
}
}
23. April 2015 13:13