Repository navigation
Redo localization for onboarding #63987
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Jake Bailey (jakebailey)
merged 16 commits into
microsoft:main
from
jakebailey:localization-update
Sep 23, 2026
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
c83fafa
Merge native diagnostics into main catalog
jakebailey 4fd5bfa
Use OneLoc JSON handbacks for localization
jakebailey 275296b
Add localization update pipeline
jakebailey 45c715c
Simplify localization pipeline PowerShell
jakebailey d47bd1d
Fix localization test lint
jakebailey c85fbc2
Read localization Go version from go.mod
jakebailey e765900
Correct OneLocBuild handoff flow
jakebailey acb3a38
Document localization update flow
jakebailey 5afd8bd
Focus localization documentation on contributors
jakebailey f857731
Simplify localized diagnostics README
jakebailey df22081
Harden localization updates
jakebailey 73929b4
Configure localization GitHub App
jakebailey f36fa75
Integrate localization with incremental codegen
jakebailey d0c8111
Limit OneLoc updates to compiler diagnostics
jakebailey 8658651
Set up Node for localization generation
jakebailey 81fe7f2
Fix localization artifact generation
jakebailey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| { | ||
| "Projects": [ | ||
| { | ||
| "LocItems": [ | ||
| { | ||
| "SourceFile": "tsc\\internal\\diagnostics\\diagnosticMessages.generated.json", | ||
| "Languages": "zh-CN;zh-TW;cs-CZ;de-DE;es-ES;fr-FR;it-IT;ja-JP;ko-KR;pl-PL;pt-BR;ru-RU;tr-TR", | ||
| "CopyOption": "UsePlaceholders", | ||
| "OutputPath": "tsc\\internal\\diagnostics\\loc\\{Lang}.generated.json" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,198 @@ | ||
| trigger: none | ||
| pr: none | ||
|
|
||
| # OneLocBuild materializes packaged LCL handbacks under the artifact directory. | ||
| # Its manifests map those files to their native repository paths. After applying | ||
| # them, the diagnostics generator produces deterministic runtime gzip files. | ||
| # The resulting changes update a stable GitHub branch and pull request. | ||
| schedules: | ||
| - cron: '0 7 * * *' | ||
| displayName: Daily localization update | ||
| always: true | ||
| branches: | ||
| include: | ||
| - main | ||
|
|
||
| variables: | ||
| - name: TYPESCRIPT_AUTOMATION_GITHUB_APP_CLIENT_ID | ||
| value: Iv23li4GolzJSEp1mzHI | ||
| - name: TYPESCRIPT_AUTOMATION_GITHUB_APP_KEY_ID | ||
| value: https://jststeam-passwords.vault.azure.net/keys/typescript-automation | ||
|
|
||
| jobs: | ||
| - job: Generate | ||
| displayName: Generate localization update | ||
| pool: | ||
| vmImage: windows-latest | ||
|
|
||
| steps: | ||
| - checkout: self | ||
| clean: true | ||
| fetchDepth: 1 | ||
| fetchTags: false | ||
| submodules: false | ||
|
|
||
| - template: /tools/pipelines/steps/setup-node-npm-ci.yml@self | ||
|
|
||
| - pwsh: | | ||
| $ErrorActionPreference = "Stop" | ||
| $match = Select-String -Path tsc/go.mod -Pattern '^go ([0-9]+\.[0-9]+)$' | ||
| if (!$match) { | ||
| throw "Unable to determine the Go version from tsc/go.mod" | ||
| } | ||
| Write-Host "##vso[task.setvariable variable=GoVersion]$($match.Matches[0].Groups[1].Value)" | ||
| displayName: Determine Go version | ||
|
|
||
| - task: GoTool@0 | ||
| displayName: Install Go | ||
| inputs: | ||
| version: $(GoVersion) | ||
| goDownloadUrl: https://aka.ms/golang/release/latest | ||
|
|
||
| - task: AzureCLI@2 | ||
| displayName: Create OneLocBuild token | ||
| inputs: | ||
| azureSubscription: devdiv-onelocbuild-ceapex | ||
| scriptType: pscore | ||
| scriptLocation: inlineScript | ||
| inlineScript: | | ||
| $ErrorActionPreference = "Stop" | ||
| $PSNativeCommandUseErrorActionPreference = $true | ||
| $token = az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 -o tsv | ||
| Write-Host "##vso[task.setvariable variable=OneLocBuildToken;issecret=true]$token" | ||
|
|
||
| - task: OneLocBuild@3 | ||
| displayName: Generate localized files | ||
| env: | ||
| SYSTEM_ACCESSTOKEN: $(System.AccessToken) | ||
| inputs: | ||
| locProj: tools/LocProject.json | ||
| outDir: $(Build.ArtifactStagingDirectory) | ||
| LclSource: lclFilesfromPackage | ||
| LclPackageId: $(OneLocLclPackageId) | ||
| packageSourceAuth: patAuth | ||
| patVariable: $(OneLocBuildToken) | ||
| isCreatePrSelected: false | ||
|
|
||
| - pwsh: | | ||
| $ErrorActionPreference = "Stop" | ||
| # OneLoc leaves native files in the artifact directory. Its manifests | ||
| # pair each generated path with the repository path selected by the | ||
| # LocProject CopyOption and OutputPath. | ||
| $locRoot = Join-Path "$(Build.ArtifactStagingDirectory)" "loc" | ||
| $generatedFiles = @(Get-Content -LiteralPath (Join-Path $locRoot "XLocFileList.txt")) | ||
| $destinationFiles = @(Get-Content -LiteralPath (Join-Path $locRoot "AllFileList.txt")) | ||
| if ($generatedFiles.Count -eq 0) { | ||
| throw "OneLocBuild did not produce any localized files" | ||
| } | ||
| if ($generatedFiles.Count -ne $destinationFiles.Count) { | ||
| throw "OneLocBuild produced mismatched source and destination manifests" | ||
| } | ||
|
|
||
| $sourceRoot = [IO.Path]::GetFullPath("$(Build.SourcesDirectory)") + [IO.Path]::DirectorySeparatorChar | ||
| $manifestDestinations = [Collections.Generic.HashSet[string]]::new([StringComparer]::OrdinalIgnoreCase) | ||
| for ($i = 0; $i -lt $generatedFiles.Count; $i++) { | ||
| $source = [IO.Path]::GetFullPath($generatedFiles[$i]) | ||
| $destination = [IO.Path]::GetFullPath($destinationFiles[$i]) | ||
| if (!$destination.StartsWith($sourceRoot, [StringComparison]::OrdinalIgnoreCase)) { | ||
| throw "Refusing to write localized file outside the checkout: $destination" | ||
| } | ||
| if (!(Test-Path -LiteralPath $source -PathType Leaf)) { | ||
| throw "OneLocBuild did not produce $source" | ||
| } | ||
| $null = $manifestDestinations.Add($destination) | ||
| } | ||
|
|
||
| $handbackDirectory = Join-Path $sourceRoot "tsc/internal/diagnostics/loc" | ||
| Get-ChildItem -LiteralPath $handbackDirectory -Filter "*.generated.json" -File | | ||
| Where-Object { !$manifestDestinations.Contains($_.FullName) } | | ||
| Remove-Item -Force | ||
|
|
||
| for ($i = 0; $i -lt $generatedFiles.Count; $i++) { | ||
| $source = [IO.Path]::GetFullPath($generatedFiles[$i]) | ||
| $destination = [IO.Path]::GetFullPath($destinationFiles[$i]) | ||
| New-Item -Path (Split-Path -Parent $destination) -ItemType Directory -Force | Out-Null | ||
| Copy-Item -LiteralPath $source -Destination $destination -Force | ||
| } | ||
| displayName: Apply localized files | ||
|
|
||
| - pwsh: | | ||
| $ErrorActionPreference = "Stop" | ||
| $PSNativeCommandUseErrorActionPreference = $true | ||
| npx hereby generate:diagnostics | ||
| displayName: Generate localization artifacts | ||
|
|
||
| - task: CopyFiles@2 | ||
| displayName: Add localization project to handoff | ||
| inputs: | ||
| SourceFolder: $(Build.SourcesDirectory)/tools | ||
| Contents: LocProject.json | ||
| TargetFolder: $(Build.ArtifactStagingDirectory)/loc | ||
|
|
||
| - task: PublishPipelineArtifact@1 | ||
| displayName: Publish localization handoff | ||
| inputs: | ||
| targetPath: $(Build.ArtifactStagingDirectory)/loc | ||
| artifact: Loc | ||
|
|
||
| - template: /tools/pipelines/steps/create-github-app-token.yml | ||
| parameters: | ||
| azureSubscription: TypeScript-DevDiv-KeyVault | ||
| repositories: TypeScript | ||
| permissions: contents:write,pull_requests:write | ||
| insertSteps: | ||
| - pwsh: | | ||
| $ErrorActionPreference = "Stop" | ||
| $PSNativeCommandUseErrorActionPreference = $true | ||
|
|
||
| git add --all -- tsc/internal/diagnostics/loc tsc/internal/diagnostics/loc_generated.go | ||
| $changes = @(git diff --cached --name-only) | ||
| if ($changes.Count -eq 0) { | ||
| Write-Host "Localization files are already up to date." | ||
| exit 0 | ||
| } | ||
|
|
||
| $branch = "localization-update" | ||
| git switch -c $branch | ||
| git config user.email "290192711+typescript-automation[bot]@users.noreply.github.com" | ||
| git config user.name "typescript-automation[bot]" | ||
| $hooksPath = Join-Path $env:AGENT_TEMPDIRECTORY "empty-git-hooks" | ||
| New-Item -Path $hooksPath -ItemType Directory -Force | Out-Null | ||
| git config core.hooksPath $hooksPath | ||
| git commit -m "Update localization files" | ||
|
|
||
| $basicAuth = [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes("x-access-token:$env:GH_TOKEN")) | ||
| Write-Host "##vso[task.setsecret]$basicAuth" | ||
| git config --local http.https://github.com/.extraheader "AUTHORIZATION: basic $basicAuth" | ||
| git remote set-url origin https://github.com/microsoft/TypeScript.git | ||
|
|
||
| $remoteBranch = git ls-remote --heads origin $branch | ||
| $branchExists = [bool] $remoteBranch | ||
| if ($branchExists) { | ||
| git fetch origin "refs/heads/${branch}:refs/remotes/origin/${branch}" | ||
| } | ||
|
|
||
| $shouldPush = $true | ||
| if ($branchExists) { | ||
| $localTree = git rev-parse 'HEAD^{tree}' | ||
| $remoteTree = git rev-parse "origin/${branch}^{tree}" | ||
| if ($localTree -eq $remoteTree) { | ||
| Write-Host "Remote branch already contains the same files." | ||
| $shouldPush = $false | ||
| } | ||
| } | ||
|
|
||
| if ($shouldPush) { | ||
| git push --force-with-lease --set-upstream origin $branch | ||
| } | ||
|
|
||
| $existingPr = gh pr list --repo microsoft/TypeScript --base main --head $branch --state open --json url --jq '.[0].url // empty' | ||
| if ($existingPr) { | ||
| Write-Host "Updated existing pull request: $existingPr" | ||
| } | ||
| else { | ||
| gh pr create --repo microsoft/TypeScript --base main --head $branch --title "Update localization files" --body "Updates localization handbacks and their generated runtime artifacts." | ||
| } | ||
| displayName: Create or update localization pull request | ||
| env: | ||
| GH_TOKEN: $(GH_TOKEN) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.