Skip to content

Commit

Permalink
Sync resx to xlf on every build. Bump up version of xlftool. (microso…
Browse files Browse the repository at this point in the history
  • Loading branch information
codito authored Oct 25, 2016
1 parent abcb4ed commit 169ad98
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
32 changes: 31 additions & 1 deletion scripts/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ Param(

[Parameter(Mandatory=$false)]
[Alias("ff")]
[System.Boolean] $FailFast = $true
[System.Boolean] $FailFast = $true,

[Parameter(Mandatory=$false)]
[Alias("loc")]
[System.Boolean] $Localized = $false
)

$ErrorActionPreference = "Stop"
Expand Down Expand Up @@ -320,6 +324,31 @@ function Copy-PackageItems($packageName)
Copy-Item -Path $binariesDirectory -Destination $publishDirectory -Recurse -Force
}

function Update-LocalizedResources
{
$timer = Start-Timer

Write-Log "Update-LocalizedResources: Started."

# For each resx file, file the xlf files in all languages
# Sync the resx to xlf to ensure all new resources are added
$xlfTool = Join-Path $env:TP_PACKAGES_DIR "fmdev.xlftool\0.1.2\tools\xlftool.exe"
$resxFiles = Get-ChildItem -Recurse -Include *.resx "$env:TP_ROOT_DIR\src"

foreach ($resxFile in $resxFiles) {
Write-Log "... Resource: $resxFile"

foreach ($lang in @("cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-BR", "ru", "tr", "zh-Hans", "zh-Hant")) {
$xlfFile = Join-Path $($resxFile.Directory.FullName) "xlf\$($resxFile.BaseName).$lang.xlf"

Write-VerboseLog "$xlfTool update -resx $($resxFile.FullName) -xlf $xlfFile -verbose"
& $xlfTool update -resx $resxFile.FullName -xlf $xlfFile -verbose
}
}

Write-Log "Update-LocalizedResources: Complete. {$(Get-ElapsedTime($timer))}"
}

#
# Helper functions
#
Expand Down Expand Up @@ -374,6 +403,7 @@ Get-Variable | Where-Object -FilterScript { $_.Name.StartsWith("TPB_") } | Forma

Install-DotNetCli
Restore-Package
Update-LocalizedResources
Invoke-Build
Publish-Package
Create-VsixPackage
Expand Down
2 changes: 1 addition & 1 deletion src/package/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
},
"fmdev.xlftool": {
"type": "build",
"version": "0.1.1"
"version": "0.1.2"
}
}
},
Expand Down

0 comments on commit 169ad98

Please sign in to comment.