Skip to content
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

Onboard Localization pipeline #5990

Merged
merged 107 commits into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from 101 commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
2b232a8
Prep for localization
arunchndr Jul 8, 2023
b49ec5e
Add package.nls.json and one LOC strings for test sample
Cosifne Jul 20, 2023
3df5a53
Install l10n and l10n-dev
Cosifne Jul 20, 2023
50278d2
Uninstall vscode-nls-dev
Cosifne Jul 20, 2023
4348c51
Add l10n path
Cosifne Jul 20, 2023
569c788
Modify package
Cosifne Jul 20, 2023
88073a4
Update to vscode 1.73
Cosifne Jul 20, 2023
2e946b9
Add one localized target string
Cosifne Jul 20, 2023
c64fe45
Add script
Cosifne Jul 20, 2023
8c0f234
Add reverse script
Cosifne Jul 20, 2023
78825e0
Add a stub task
Cosifne Jul 20, 2023
9323f1f
Clean up
Cosifne Jul 20, 2023
973f0d4
Clean up
Cosifne Jul 20, 2023
1ec8dea
Add LOCProject.json
Cosifne Jul 21, 2023
6ef36d7
Add loc.yml
Cosifne Jul 21, 2023
b6f77b6
Temp skip the build to verify
Cosifne Jul 21, 2023
55a3fc1
Use script
Cosifne Jul 21, 2023
bae68f9
Add back prerequest
Cosifne Jul 21, 2023
594c11a
Checkout build.yml back
Cosifne Jul 21, 2023
f4d16fd
Update loc.yml
Cosifne Jul 21, 2023
c1e22b8
Merge remote-tracking branch 'upstream/main' into dev/shech/LOC
Cosifne Jul 21, 2023
09cb9b3
Fix :
Cosifne Jul 21, 2023
2ade1ea
Checkout repo
Cosifne Jul 21, 2023
8e596e2
Fix path
Cosifne Jul 21, 2023
23b49bb
Referencing PAT
Cosifne Jul 24, 2023
b02e09e
Comment out the pacakge ID
Cosifne Jul 24, 2023
d118668
Add lclPacakgeId
Cosifne Jul 26, 2023
8ab3c3f
Add publish build artifacts task
Cosifne Jul 26, 2023
534073b
Comment out task
Cosifne Jul 26, 2023
945da9a
Modity the task
Cosifne Jul 26, 2023
6dadaa5
Use LCL-JUNO-PROD-VSCODECS
Cosifne Jul 26, 2023
78b36a0
Install vscode-l10n
Cosifne Jul 26, 2023
81c021f
Add script
Cosifne Jul 26, 2023
9bc629a
Fix typo
Cosifne Jul 26, 2023
7c8e1d2
Import xlf back to json
Cosifne Jul 26, 2023
5881af6
Also publish l10n file
Cosifne Jul 26, 2023
0e71d9e
Include xlf files in gitignore
Cosifne Jul 27, 2023
b5022d7
Part of the script
Cosifne Jul 27, 2023
e4c8e86
Install octokit
Cosifne Jul 27, 2023
fa58993
Uninstall simple-git
Cosifne Jul 27, 2023
5136b80
Script in progress
Cosifne Jul 27, 2023
5dce89c
Script in progress
Cosifne Jul 27, 2023
b03b9e5
Script in progress
Cosifne Jul 28, 2023
0aecf57
Link script to yml
Cosifne Jul 28, 2023
9a2a048
Install gulp
Cosifne Jul 28, 2023
e8ef141
Update gulp file
Cosifne Jul 28, 2023
4906917
Update filter
Cosifne Jul 28, 2023
760d1ce
Update task
Cosifne Jul 28, 2023
38f15c2
Update script
Cosifne Jul 28, 2023
43f662a
Remove
Cosifne Jul 28, 2023
72db8ec
Add target branch
Cosifne Jul 31, 2023
3ba4307
Change diff
Cosifne Jul 31, 2023
23b4c04
Modify task
Cosifne Jul 31, 2023
7dd6185
Fix git diff
Cosifne Jul 31, 2023
d088094
Add rest of git command
Cosifne Jul 31, 2023
480c2ef
Modify the script
Cosifne Jul 31, 2023
ec92c6e
Add GitHub PullRequest Creation
Cosifne Jul 31, 2023
e83836d
Add code owner
Cosifne Jul 31, 2023
5a0274c
Install gulp
Cosifne Jul 31, 2023
102922f
Check the existence of pull request
Cosifne Jul 31, 2023
7d17454
Check if PR is open
Cosifne Jul 31, 2023
0d9a2d6
Merge script
Cosifne Aug 1, 2023
5e23b8c
Debug
Cosifne Aug 1, 2023
0bdeb67
Debug
Cosifne Aug 1, 2023
7110559
Modify script
Cosifne Aug 1, 2023
7a115f9
Use path.basename
Cosifne Aug 1, 2023
9f18563
Use a different pool
Cosifne Aug 1, 2023
6ef40c6
Fix style problem
Cosifne Aug 1, 2023
866df37
Use git reset
Cosifne Aug 2, 2023
16a0992
Remote add
Cosifne Aug 2, 2023
ad27647
Alias
Cosifne Aug 2, 2023
eaa89f4
Polish output
Cosifne Aug 2, 2023
df1caad
Remote add with token
Cosifne Aug 2, 2023
d214834
Fix syntax
Cosifne Aug 2, 2023
e6d6d5c
Try use node 18
Cosifne Aug 2, 2023
ee26da7
Put token in client
Cosifne Aug 2, 2023
190aada
Fix style
Cosifne Aug 2, 2023
abee860
Remove auth()
Cosifne Aug 2, 2023
7383d10
Change code owner
Cosifne Aug 2, 2023
0afded5
Fix Uri
Cosifne Aug 2, 2023
818d7fa
Fix owner and repo
Cosifne Aug 2, 2023
4812095
Debug
Cosifne Aug 2, 2023
815851c
Fix issue when checking PR
Cosifne Aug 2, 2023
ca88888
Clean up
Cosifne Aug 2, 2023
153b4bc
Clean up yml
Cosifne Aug 2, 2023
1d512b5
Add condition to only loc from a branch
Cosifne Aug 2, 2023
4f49bfa
Change package.json
Cosifne Aug 2, 2023
ec4aa8d
Change this back to main
Cosifne Aug 2, 2023
ce55dae
Clean up
Cosifne Aug 2, 2023
7ccb3ca
Remove unused packages
Cosifne Aug 2, 2023
353c921
Remove unused packages
Cosifne Aug 2, 2023
e644a14
Clean up
Cosifne Aug 2, 2023
62833f1
Add bundle.json generation to compile task
Cosifne Aug 2, 2023
a42a6d6
Hardcode dotnet and make userName and email optional
Cosifne Aug 2, 2023
c7aae3d
Revert back the \u200b changes
Cosifne Aug 2, 2023
e6d6a3c
Generated bundle.l10n.json
Cosifne Aug 2, 2023
388d183
Optimize script
Cosifne Aug 2, 2023
1f825a4
Merge remote-tracking branch 'upstream/main' into dev/shech/LOC
Cosifne Aug 2, 2023
1594ec8
Fix the namespace problem after merge
Cosifne Aug 2, 2023
e7f63ef
Add the content change for razor
Cosifne Aug 2, 2023
5f73e7e
Use path.sep
Cosifne Aug 2, 2023
063174d
Compare head
Cosifne Aug 3, 2023
265913d
Merge remote-tracking branch 'upstream/main' into dev/shech/LOC
Cosifne Aug 3, 2023
11a6c97
Check if file exist
Cosifne Aug 3, 2023
20ae700
Use log error in vso
Cosifne Aug 3, 2023
c0a5c6a
Revert "Check if file exist"
Cosifne Aug 3, 2023
5c9c95e
Update package.json.lock
Cosifne Aug 3, 2023
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
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'
Copy link
Member Author

Choose a reason for hiding this comment

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

GitHub client needs this

- 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}'",
Copy link
Contributor

@WardenGnaw WardenGnaw Aug 7, 2023

Choose a reason for hiding this comment

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

@Cosifne The keys of this file can be used to help organize who owns the strings / help what the usage should be. I would reccomend changing it to be something similar so its easier to use rather than having to change they key and value in multiple places.

See https://github.com/microsoft/vscode-cpptools/blob/ae904ec3306d563db44445dac90728ec706424d3/Extension/package.nls.json

Copy link
Member Author

Choose a reason for hiding this comment

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

This key is auto-generated by the l10n tool, let me see if this can be optimized or not

Copy link
Contributor

Choose a reason for hiding this comment

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

@Cosifne Sorry I'm incorrect here. I think this is correct for the l10n.json file. I got this confused with the nls.json file.

"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",
Copy link
Member Author

Choose a reason for hiding this comment

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

vscode-csharp.xlf is a generated file from l10nDevGenerateXlf task in package.json.
It is passed to the localization build.

./loc folder is used to stage all the generated files.

"CopyOption": "LangIDOnName",
"OutputPath": "./loc/"
}
]
}
]
}
Loading