Skip to content

Commit 46a8971

Browse files
tj-devel709TJ Lambert
andauthored
[Localization] Update the Lcl paths (#14811)
* Get the lcl paths * Test the string split for null and use Join-Path Co-authored-by: TJ Lambert <[email protected]>
1 parent d800a46 commit 46a8971

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

tools/devops/LocProject.json.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"Languages": "",
99
"CopyOption": "LangIDOnName",
1010
"OutputPath": "@WORKING_DIRECTORY@/../../msbuild/Xamarin.Localization.MSBuild/TranslatedAssemblies",
11-
"LclFile": "",
11+
"LclFile": "@WORKING_DIRECTORY@/../../Localize/loc/{Lang}/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl",
1212
"LciFile": "",
1313
"Parser": "",
1414
"LssFiles": []
@@ -18,7 +18,7 @@
1818
"Languages": "",
1919
"CopyOption": "LangIDOnName",
2020
"OutputPath": "@WORKING_DIRECTORY@/../../tools/mtouch/TranslatedAssemblies",
21-
"LclFile": "",
21+
"LclFile": "@WORKING_DIRECTORY@/../../Localize/loc/{Lang}/tools/mtouch/Errors.resx.lcl",
2222
"LciFile": "",
2323
"Parser": "",
2424
"LssFiles": []

tools/devops/automation/scripts/update-locproject.ps1

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
param ($SourcesDirectory, $LocProjectPath)
1+
param ($SourcesDirectory, $LocalizeDirectory, $LocProjectPath)
22

33
$jsonFiles = @()
44
$jsonTemplateFiles = Get-ChildItem -Recurse -Path "$SourcesDirectory" | Where-Object { $_.FullName -Match "\.template\.config\\localize\\.+\.en\.json" } # .NET templating pattern
@@ -15,10 +15,19 @@ $projectObject = Get-Content $LocProjectPath | ConvertFrom-Json
1515
$jsonFiles | ForEach-Object {
1616
$sourceFile = $_.FullName
1717
$outputPath = "$($_.DirectoryName + "\")"
18+
$fullNameString = Convert-Path -Path $_.FullName
19+
$maciosPathArray = $fullNameString -split "xamarin-macios", 2
20+
$maciosPath = $maciosPathArray[1]
21+
if ($null -eq $maciosPath) {
22+
Write-Host "'fullNameString' could not be split at 'xamarin-macios'!"
23+
exit 1
24+
}
25+
$lclFile = Join-Path -Path $LocalizeDirectory -ChildPath "$($maciosPath).lcl"
1826
$projectObject.Projects[0].LocItems += (@{
1927
SourceFile = $sourceFile
2028
CopyOption = "LangIDOnName"
2129
OutputPath = $outputPath
30+
LclFile = $lclFile
2231
})
2332
}
2433
Pop-Location

tools/devops/automation/templates/loc-translations.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ steps:
1313
inputs:
1414
targetType: 'filePath'
1515
filePath: $(Build.SourcesDirectory)\\xamarin-macios\\tools\\devops\\automation\\scripts\\update-locproject.ps1
16-
arguments: -SourcesDirectory "$(Build.SourcesDirectory)\\xamarin-macios" -LocProjectPath "$(Build.SourcesDirectory)\\xamarin-macios\\Localize\\LocProject.json"
16+
arguments: -SourcesDirectory "$(Build.SourcesDirectory)\\xamarin-macios" -LocalizeDirectory "$(Build.SourcesDirectory)\xamarin-macios\Localize\loc\{Lang}" -LocProjectPath "$(Build.SourcesDirectory)\\xamarin-macios\\Localize\\LocProject.json"
1717

1818
- pwsh: |
1919
git remote remove origin

0 commit comments

Comments
 (0)