Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Documentation/workflow/Localization.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ so when adding a new message, follow these steps:

6. The [OneLocBuild][oneloc] task will manage handoff and handback for string translations.

### Templates

All updates to `src/Microsoft.Android.Templates` should be built locally to update the
`templatestrings.*.json` used for localization. The [OneLocBuild][oneloc] task
will manage handoff and handback for string translations after the
`templatestrings.*.json` changes are committed.

## Guidelines

* When an error or warning code is used with more than one output string, use
Expand Down
2 changes: 1 addition & 1 deletion Localize/LocProject.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"CopyOption": "LangIDOnName",
"SourceFile": ".\\src\\Xamarin.Android.Build.Tasks\\Properties\\Resources.resx",
"OutputPath": ".\\src\\Xamarin.Android.Build.Tasks\\Properties\\"
},
}
]
}
]
Expand Down
28 changes: 28 additions & 0 deletions Localize/update-locproject.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
param ($SourcesDirectory, $LocProjectPath)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Should this use a shebang and be +x on Unix?
  2. If we do use a shebang, then this file needs to be Unix formatted.
  3. If this file needs to be Unix formatted, then we should update .gitattributes accordingly.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would lean towards no as I don't anticipate us needing to invoke this script much (if ever) outside of CI, and running the script with a pwsh prefix in those cases doesn't feel like too much overhead. I will make these changes if you would prefer though?


$jsonFiles = @()
$jsonTemplateFiles = Get-ChildItem -Recurse -Path "$SourcesDirectory" | Where-Object { $_.FullName -Match "\.template\.config\\localize\\.+\.en\.json" } # .NET templating pattern
$jsonTemplateFiles | ForEach-Object {
$null = $_.Name -Match "(.+)\.[\w-]+\.json" # matches '[filename].[langcode].json

$destinationFile = "$($_.Directory.FullName)\$($Matches.1).json"
$jsonFiles += Copy-Item "$($_.FullName)" -Destination $destinationFile -PassThru
Write-Host "Template loc file generated: $destinationFile"
}

Push-Location "$SourcesDirectory"
$projectObject = Get-Content $LocProjectPath | ConvertFrom-Json
$jsonFiles | ForEach-Object {
$sourceFile = ($_.FullName | Resolve-Path -Relative)
$outputPath = "$(($_.DirectoryName | Resolve-Path -Relative) + "\")"
$projectObject.Projects[0].LocItems += (@{
SourceFile = $sourceFile
CopyOption = "LangIDOnName"
OutputPath = $outputPath
})
}
Pop-Location

$locProjectJson = ConvertTo-Json $projectObject -Depth 5
Set-Content $LocProjectPath $locProjectJson
Write-Host "LocProject.json was updated to contain template localizations:`n`n$locProjectJson`n`n"
9 changes: 8 additions & 1 deletion build-tools/automation/azure-pipelines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1880,7 +1880,7 @@ stages:
# Check - "Xamarin.Android (Tenets OneLocBuild)"
- job: OneLocBuild
displayName: OneLocBuild
condition: eq(variables['MicroBuildSignType'], 'Real')
condition: and(eq(variables['MicroBuildSignType'], 'Real'), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
pool: VSEngSS-MicroBuild2022-1ES
timeoutInMinutes: 30
variables:
Expand All @@ -1891,6 +1891,13 @@ stages:
- checkout: self
clean: true

- task: PowerShell@2
displayName: Update LocProject.json
inputs:
targetType: filePath
filePath: $(Build.SourcesDirectory)\Localize\update-locproject.ps1
arguments: -SourcesDirectory "$(Build.SourcesDirectory)" -LocProjectPath "$(Build.SourcesDirectory)\Localize\LocProject.json"

- task: OneLocBuild@2
displayName: OneLocBuild
env:
Expand Down
4 changes: 4 additions & 0 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,9 @@
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>70831f0d126fe88b81d7dc8de11358e17a5ce364</Sha>
</Dependency>
<Dependency Name="Microsoft.TemplateEngine.Tasks" Version="7.0.100-rc.1.22410.7">
<Uri>https://github.com/dotnet/templating</Uri>
<Sha>66ccf71bc4f0ba64f66b1674803e9999cd8111c8</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
1 change: 1 addition & 0 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<MicrosoftDotNetBuildTasksFeedPackageVersion>7.0.0-beta.22103.1</MicrosoftDotNetBuildTasksFeedPackageVersion>
<MicrosoftNETWorkloadEmscriptenManifest70100Version>7.0.0-rc.1.22368.1</MicrosoftNETWorkloadEmscriptenManifest70100Version>
<MicrosoftNETWorkloadEmscriptenPackageVersion>$(MicrosoftNETWorkloadEmscriptenManifest70100Version)</MicrosoftNETWorkloadEmscriptenPackageVersion>
<MicrosoftTemplateEngineTasksPackageVersion>7.0.100-rc.1.22410.7</MicrosoftTemplateEngineTasksPackageVersion>
</PropertyGroup>
<PropertyGroup>
<!-- Match the first three version numbers and append 00 -->
Expand Down
1 change: 1 addition & 0 deletions src/Microsoft.Android.Templates/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
templatestrings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<Description>Templates for Android platforms.</Description>
<IncludeContentInPack>true</IncludeContentInPack>
<IncludeBuildOutput>false</IncludeBuildOutput>
<LocalizeTemplates Condition=" '$(RunningOnCI)' != 'true' ">true</LocalizeTemplates>
<ContentTargetFolders>content</ContentTargetFolders>
<OutputPath>..\..\bin\Build$(Configuration)\nuget-unsigned\</OutputPath>
<!-- Remove the `<group targetFramework=".NETStandard2.0" />` entry from the .nuspec. -->
Expand All @@ -22,4 +23,8 @@
<Compile Remove="**\*" />
</ItemGroup>

<ItemGroup Condition=" '$(RunningOnCI)' != 'true' ">
<PackageReference Include="Microsoft.TemplateEngine.Tasks" Version="$(MicrosoftTemplateEngineTasksPackageVersion)" PrivateAssets="all" IsImplicitlyDefined="true" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"author": "Microsoft",
"name": "Android Activity template",
"description": "An Android Activity class",
"symbols/namespace/description": "namespace for the generated code"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"author": "Microsoft",
"name": "Android Activity template",
"description": "An Android Activity class",
"symbols/namespace/description": "namespace for the generated code"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"author": "Microsoft",
"name": "Android Activity template",
"description": "An Android Activity class",
"symbols/namespace/description": "namespace for the generated code"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"author": "Microsoft",
"name": "Android Activity template",
"description": "An Android Activity class",
"symbols/namespace/description": "namespace for the generated code"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"author": "Microsoft",
"name": "Android Activity template",
"description": "An Android Activity class",
"symbols/namespace/description": "namespace for the generated code"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"author": "Microsoft",
"name": "Android Activity template",
"description": "An Android Activity class",
"symbols/namespace/description": "namespace for the generated code"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"author": "Microsoft",
"name": "Android Activity template",
"description": "An Android Activity class",
"symbols/namespace/description": "namespace for the generated code"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"author": "Microsoft",
"name": "Android Activity template",
"description": "An Android Activity class",
"symbols/namespace/description": "namespace for the generated code"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"author": "Microsoft",
"name": "Android Activity template",
"description": "An Android Activity class",
"symbols/namespace/description": "namespace for the generated code"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"author": "Microsoft",
"name": "Android Activity template",
"description": "An Android Activity class",
"symbols/namespace/description": "namespace for the generated code"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"author": "Microsoft",
"name": "Android Activity template",
"description": "An Android Activity class",
"symbols/namespace/description": "namespace for the generated code"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"author": "Microsoft",
"name": "Android Activity template",
"description": "An Android Activity class",
"symbols/namespace/description": "namespace for the generated code"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"author": "Microsoft",
"name": "Android Activity template",
"description": "An Android Activity class",
"symbols/namespace/description": "namespace for the generated code"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"author": "Microsoft",
"name": "Android Activity template",
"description": "An Android Activity class",
"symbols/namespace/description": "namespace for the generated code"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"author": "Microsoft",
"name": "Android Java Library Binding",
"description": "A project for creating a .NET Android class library that binds to a native Java library",
"symbols/supportedOSVersion/description": "Overrides $(SupportedOSPlatformVersion) in the project"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"author": "Microsoft",
"name": "Android Java Library Binding",
"description": "A project for creating a .NET Android class library that binds to a native Java library",
"symbols/supportedOSVersion/description": "Overrides $(SupportedOSPlatformVersion) in the project"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"author": "Microsoft",
"name": "Android Java Library Binding",
"description": "A project for creating a .NET Android class library that binds to a native Java library",
"symbols/supportedOSVersion/description": "Overrides $(SupportedOSPlatformVersion) in the project"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"author": "Microsoft",
"name": "Android Java Library Binding",
"description": "A project for creating a .NET Android class library that binds to a native Java library",
"symbols/supportedOSVersion/description": "Overrides $(SupportedOSPlatformVersion) in the project"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"author": "Microsoft",
"name": "Android Java Library Binding",
"description": "A project for creating a .NET Android class library that binds to a native Java library",
"symbols/supportedOSVersion/description": "Overrides $(SupportedOSPlatformVersion) in the project"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"author": "Microsoft",
"name": "Android Java Library Binding",
"description": "A project for creating a .NET Android class library that binds to a native Java library",
"symbols/supportedOSVersion/description": "Overrides $(SupportedOSPlatformVersion) in the project"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"author": "Microsoft",
"name": "Android Java Library Binding",
"description": "A project for creating a .NET Android class library that binds to a native Java library",
"symbols/supportedOSVersion/description": "Overrides $(SupportedOSPlatformVersion) in the project"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"author": "Microsoft",
"name": "Android Java Library Binding",
"description": "A project for creating a .NET Android class library that binds to a native Java library",
"symbols/supportedOSVersion/description": "Overrides $(SupportedOSPlatformVersion) in the project"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"author": "Microsoft",
"name": "Android Java Library Binding",
"description": "A project for creating a .NET Android class library that binds to a native Java library",
"symbols/supportedOSVersion/description": "Overrides $(SupportedOSPlatformVersion) in the project"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"author": "Microsoft",
"name": "Android Java Library Binding",
"description": "A project for creating a .NET Android class library that binds to a native Java library",
"symbols/supportedOSVersion/description": "Overrides $(SupportedOSPlatformVersion) in the project"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"author": "Microsoft",
"name": "Android Java Library Binding",
"description": "A project for creating a .NET Android class library that binds to a native Java library",
"symbols/supportedOSVersion/description": "Overrides $(SupportedOSPlatformVersion) in the project"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"author": "Microsoft",
"name": "Android Java Library Binding",
"description": "A project for creating a .NET Android class library that binds to a native Java library",
"symbols/supportedOSVersion/description": "Overrides $(SupportedOSPlatformVersion) in the project"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"author": "Microsoft",
"name": "Android Java Library Binding",
"description": "A project for creating a .NET Android class library that binds to a native Java library",
"symbols/supportedOSVersion/description": "Overrides $(SupportedOSPlatformVersion) in the project"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"author": "Microsoft",
"name": "Android Java Library Binding",
"description": "A project for creating a .NET Android class library that binds to a native Java library",
"symbols/supportedOSVersion/description": "Overrides $(SupportedOSPlatformVersion) in the project"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"author": "Microsoft",
"name": "Android Layout template",
"description": "An Android layout (XML) file"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"author": "Microsoft",
"name": "Android Layout template",
"description": "An Android layout (XML) file"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"author": "Microsoft",
"name": "Android Layout template",
"description": "An Android layout (XML) file"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"author": "Microsoft",
"name": "Android Layout template",
"description": "An Android layout (XML) file"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"author": "Microsoft",
"name": "Android Layout template",
"description": "An Android layout (XML) file"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"author": "Microsoft",
"name": "Android Layout template",
"description": "An Android layout (XML) file"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"author": "Microsoft",
"name": "Android Layout template",
"description": "An Android layout (XML) file"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"author": "Microsoft",
"name": "Android Layout template",
"description": "An Android layout (XML) file"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"author": "Microsoft",
"name": "Android Layout template",
"description": "An Android layout (XML) file"
}
Loading