Skip to content

Commit

Permalink
Onboard Localization pipeline (#5990)
Browse files Browse the repository at this point in the history
* Prep for localization

* Add package.nls.json and one LOC strings for test sample

* Install l10n and l10n-dev

* Uninstall vscode-nls-dev

* Add l10n path

* Modify package

* Update to vscode 1.73

* Add one localized target string

* Add script

* Add reverse script

* Add a stub task

* Clean up

* Clean up

* Add LOCProject.json

* Add loc.yml

* Temp skip the build to verify

* Use script

* Add back prerequest

* Checkout build.yml back

* Update loc.yml

* Fix :

* Checkout repo

* Fix path

* Referencing PAT

* Comment out the pacakge ID

* Add lclPacakgeId

* Add publish build artifacts task

* Comment out task

* Modity the task

* Use LCL-JUNO-PROD-VSCODECS

* Install vscode-l10n

* Add script

* Fix typo

* Import xlf back to json

* Also publish l10n file

* Include xlf files in gitignore

* Part of the script

* Install octokit

* Uninstall simple-git

* Script in progress

* Script in progress

* Script in progress

* Link script to yml

* Install gulp

* Update gulp file

* Update filter

* Update task

* Update script

* Remove

* Add target branch

* Change diff

* Modify task

* Fix git diff

* Add rest of git command

* Modify the script

* Add GitHub PullRequest Creation

* Add code owner

* Install gulp

* Check the existence of pull request

* Check if PR is open

* Merge script

* Debug

* Debug

* Modify script

* Use path.basename

* Use a different pool

* Fix style problem

* Use git reset

* Remote add

* Alias

* Polish output

* Remote add with token

* Fix syntax

* Try use node 18

* Put token in client

* Fix style

* Remove auth()

* Change code owner

* Fix Uri

* Fix owner and repo

* Debug

* Fix issue when checking PR

* Clean up

* Clean up yml

* Add condition to only loc from a branch

* Change package.json

* Change this back to main

* Clean up

* Remove unused packages

* Remove unused packages

* Clean up

* Add bundle.json generation to compile task

* Hardcode dotnet and make userName and email optional

* Revert back the \u200b changes

* Generated bundle.l10n.json

* Optimize script

* Fix the namespace problem after merge

* Add the content change for razor

* Use path.sep

* Compare head

* Check if file exist

* Use log error in vso

* Revert "Check if file exist"

This reverts commit 11a6c97.

* Update package.json.lock

---------

Co-authored-by: Arun Chander <[email protected]>
  • Loading branch information
Cosifne and arunchndr authored Aug 4, 2023
1 parent 78b8603 commit 301f9b3
Show file tree
Hide file tree
Showing 23 changed files with 1,492 additions and 142 deletions.
73 changes: 73 additions & 0 deletions azure-pipelines/loc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
trigger: none
pr: none

parameters:
- name: publishLocalizationFile
type: boolean
default: true

variables:
# Variable group contains the PAT to LOC
- group: OneLocBuildVariables

stages:
- stage: LocalizationStage
condition: eq(variables['Build.SourceBranch'], 'refs/heads/main')
jobs:
- job: Localization
pool:
name: NetCore1ESPool-Internal
demands: ImageOverride -equals windows.vs2022preview.amd64
steps:
- task: NodeTool@0
displayName: 'Install Node.js 18.x'
inputs:
# Octokit client needs 18.x to have 'fetch' function.
versionSpec: '18.x'
- checkout: self
clean: true
submodules: true
fetchTags: false
fetchDepth: 0
- pwsh: |
npm install
npm install -g @vscode/l10n-dev
npm install -g gulp
displayName: 'Install tools'
- pwsh: npm run compile
displayName: 'Compile'
- pwsh: npm run l10nDevGenerateLocalizationBundle
displayName: 'Generate bundle.l10.json'
- pwsh: npm run l10nDevGenerateXlf
displayName: 'Generate xlf files from bundle.10n.json'
- task: OneLocBuild@2
env:
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
inputs:
locProj: loc/LocProject.json
outDir: '$(Build.SourcesDirectory)/loc'
isCreatePrSelected: false
patVariable: $(dn-bot-ceapex-package-r)
packageSourceAuth: patAuth
lclSource: lclFilesfromPackage
LclPackageId: 'LCL-JUNO-PROD-VSCODECS'
- pwsh: npm run l10nDevImportXlf
displayName: 'Import xlf to json.'
- pwsh: gulp 'publish localization content' --userName dotnet-bot --email [email protected] --commitSha $(Build.SourceVersion) --targetRemoteRepo vscode-csharp --baseBranch 'main'
displayName: 'Create PR in GitHub.'
env:
GitHubPAT: $(BotAccount-dotnet-bot-repo-PAT)
- task: PublishBuildArtifacts@1
displayName: 'Publish Localization Files'
inputs:
PathtoPublish: '$(Build.SourcesDirectory)/loc'
PublishLocation: Container
ArtifactName: Loc
condition: ${{ parameters.publishLocalizationFile }}
- task: PublishBuildArtifacts@1
displayName: 'Publish l10n file'
inputs:
PathtoPublish: '$(Build.SourcesDirectory)/l10n'
PublishLocation: Container
ArtifactName: l10n
condition: ${{ parameters.publishLocalizationFile }}
1 change: 1 addition & 0 deletions gulpfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import * as packageDependencyUpdater from './src/tools/updatePackageDependencies
require('./tasks/testTasks');
require('./tasks/offlinePackagingTasks');
require('./tasks/backcompatTasks');
require('./tasks/localizationTasks');

// Disable warning about wanting an async function
// tslint:disable-next-line
Expand Down
85 changes: 85 additions & 0 deletions l10n/bundle.l10n.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
"Cannot load Razor language server because the directory was not found: '{0}'": "Cannot load Razor language server because the directory was not found: '{0}'",
"Could not find '{0}' in or above '{1}'.": "Could not find '{0}' in or above '{1}'.",
"Invalid trace setting for Razor language server. Defaulting to '{0}'": "Invalid trace setting for Razor language server. Defaulting to '{0}'",
"Could not find Razor Language Server executable within directory '{0}'": "Could not find Razor Language Server executable within directory '{0}'",
"Server failed to start after retrying 5 times.": "Server failed to start after retrying 5 times.",
"Razor Language Server failed to start unexpectedly, please check the 'Razor Log' and report an issue.": "Razor Language Server failed to start unexpectedly, please check the 'Razor Log' and report an issue.",
"Tried to send requests while server is not started.": "Tried to send requests while server is not started.",
"Tried to bind on request logic while server is not started.": "Tried to bind on request logic while server is not started.",
"Tried to bind on notification logic while server is not started.": "Tried to bind on notification logic while server is not started.",
"Cannot stop Razor Language Server as it is already stopped.": "Cannot stop Razor Language Server as it is already stopped.",
"Razor Language Server failed to stop correctly, please check the 'Razor Log' and report an issue.": "Razor Language Server failed to stop correctly, please check the 'Razor Log' and report an issue.",
"Would you like to restart the Razor Language Server to enable the Razor trace configuration change?": "Would you like to restart the Razor Language Server to enable the Razor trace configuration change?",
"Restart": "Restart",
"Razor HTML Preview": "Razor HTML Preview",
"Unexpected error when attaching to HTML preview window.": "Unexpected error when attaching to HTML preview window.",
"Razor HTML copied to clipboard": "Razor HTML copied to clipboard",
"Report a Razor issue": "Report a Razor issue",
"Host document file path": "Host document file path",
"Virtual document file path": "Virtual document file path",
"Copy Html": "Copy Html",
"Token cancellation requested: {0}": "Token cancellation requested: {0}",
"Synchronization timed out": "Synchronization timed out",
"Report Razor Issue": "Report Razor Issue",
"Unexpected error when attaching to report Razor issue window.": "Unexpected error when attaching to report Razor issue window.",
"You must first start the data collection before copying.": "You must first start the data collection before copying.",
"Razor issue copied to clipboard": "Razor issue copied to clipboard",
"Razor issue data collection started. Reproduce the issue then press \"Stop\"": "Razor issue data collection started. Reproduce the issue then press \"Stop\"",
"You must first start the data collection before stopping.": "You must first start the data collection before stopping.",
"Razor issue data collection stopped. Copying issue content...": "Razor issue data collection stopped. Copying issue content...",
"Start": "Start",
"Press {0}": "Press {0}",
"Perform the actions (or no action) that resulted in your Razor issue": "Perform the actions (or no action) that resulted in your Razor issue",
"Stop": "Stop",
"Click {0}. This will copy all relevant issue information.": "Click {0}. This will copy all relevant issue information.",
"Go to GitHub": "Go to GitHub",
"{0}, paste your issue contents as the body of the issue. Don't forget to fill out any details left unfilled.": "{0}, paste your issue contents as the body of the issue. Don't forget to fill out any details left unfilled.",
"Privacy Alert! The contents copied to your clipboard may contain personal data. Prior to posting to GitHub, please remove any personal data which should not be publicly viewable.": "Privacy Alert! The contents copied to your clipboard may contain personal data. Prior to posting to GitHub, please remove any personal data which should not be publicly viewable.",
"Copy issue content again": "Copy issue content again",
"Cannot start collecting Razor logs when {0} is set to {1}. Please set {0} to {2} and then reload your VSCode environment and re-run the report Razor issue command.": "Cannot start collecting Razor logs when {0} is set to {1}. Please set {0} to {2} and then reload your VSCode environment and re-run the report Razor issue command.",
"Non Razor file as active document": "Non Razor file as active document",
"Could not determine CSharp content": "Could not determine CSharp content",
"Could not determine Html content": "Could not determine Html content",
"A valid dotnet installation could not be found: {0}": "A valid dotnet installation could not be found: {0}",
"Is this a Bug or Feature request?": "Is this a Bug or Feature request?",
"Bug": "Bug",
"Steps to reproduce": "Steps to reproduce",
"Please fill in this section": "Please fill in this section",
"Description of the problem": "Description of the problem",
"Expected behavior": "Expected behavior",
"Actual behavior": "Actual behavior",
"Logs": "Logs",
"OmniSharp": "OmniSharp",
"Razor": "Razor",
"Expand": "Expand",
"Workspace information": "Workspace information",
"Razor document": "Razor document",
"Projected CSharp document": "Projected CSharp document",
"Projected Html document": "Projected Html document",
"Machine information": "Machine information",
"Razor.VSCode version": "Razor.VSCode version",
"VSCode version": "VSCode version",
"Extensions": "Extensions",
"Projected CSharp as seen by extension": "Projected CSharp as seen by extension",
"Unable to resolve VSCode's version of CSharp": "Unable to resolve VSCode's version of CSharp",
"Projected Html as seen by extension": "Projected Html as seen by extension",
"Unable to resolve VSCode's version of Html": "Unable to resolve VSCode's version of Html",
"Unable to find Razor extension version.": "Unable to find Razor extension version.",
"Extension": "Extension",
"Author": "Author",
"Version": "Version",
"Razor C# Preview": "Razor C# Preview",
"Unexpected error when attaching to C# preview window.": "Unexpected error when attaching to C# preview window.",
"Razor C# copied to clipboard": "Razor C# copied to clipboard",
"Copy C#": "Copy C#",
"Unexpected completion trigger kind: {0}": "Unexpected completion trigger kind: {0}",
"1 reference": "1 reference",
"{0} references": "{0} references",
"Run and Debug: auto-detection found {0} for a launch browser": "Run and Debug: auto-detection found {0} for a launch browser",
"There was an unexpected error while launching your debugging session. Check the console for helpful logs and visit the debugging docs for more info.": "There was an unexpected error while launching your debugging session. Check the console for helpful logs and visit the debugging docs for more info.",
"View Debug Docs": "View Debug Docs",
"Ignore": "Ignore",
"Run and Debug: A valid browser is not installed": "Run and Debug: A valid browser is not installed",
"Restart Language Server": "Restart Language Server"
}
14 changes: 14 additions & 0 deletions loc/LocProject.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"Projects": [
{
"LanguageSet": "VS_Main_Languages",
"LocItems": [
{
"SourceFile": "./loc/vscode-csharp.xlf",
"CopyOption": "LangIDOnName",
"OutputPath": "./loc/"
}
]
}
]
}
Loading

0 comments on commit 301f9b3

Please sign in to comment.