Skip to content

Commit

Permalink
[localization] set up the pipeline! (#364)
Browse files Browse the repository at this point in the history
* [localization] set up pipeline

* Localized file check-in by OneLocBuild Task: Build definition ID 15684: Build ID 5756871 (#355)

* add english bits

* support BOM in json files

I cannot get localization.xloc to do this correctly

* Localized file check-in by OneLocBuild Task: Build definition ID 15684: Build ID 5771674 (#366)

* Localized file check-in by OneLocBuild Task: Build definition ID 15684: Build ID 5771562

* Localized file check-in by OneLocBuild Task: Build definition ID 15684: Build ID 5771639

* Localized file check-in by OneLocBuild Task: Build definition ID 15684: Build ID 5771674

* switch to main trigger

* format

* oops

* Billy CRs

* what if we don't create a PR

* escapppe

* does this work?

* try pushing directly?

* do the thing (will this push?)

* ups

* blargph

* [localization][automated][ci skip] update locale files

* do a format

* blah

* [localization][automated][ci skip] update locale files

* add more info

* how's this work?

* switch trigger to main

Co-authored-by: nicole mazzuca <[email protected]>
Co-authored-by: Embedded Bot <[email protected]>
  • Loading branch information
3 people authored Feb 22, 2022
1 parent aee79d7 commit 5c20fad
Show file tree
Hide file tree
Showing 21 changed files with 1,115 additions and 5 deletions.
2 changes: 1 addition & 1 deletion LocProject.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"SourceFile": "locales/messages.json",
"CopyOption": "LangIDOnName",
"LclFile": "src/localization-team/{Lang}/messages.json.lcl",
"LclFile": "src/localization/{Lang}/messages.json.lcl",
"OutputPath": "locales"
}
]
Expand Down
20 changes: 20 additions & 0 deletions azure-pipelines/Format-LocalizationFiles.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#! /usr/bin/env pwsh

[CmdletBinding()]
$Root = Resolve-Path -LiteralPath "$PSScriptRoot/.."

Get-ChildItem "$Root/locales/messages.*.json" | ? {
(Split-Path -Leaf $_) -ne 'messages.en.json'
} | % {
$fileName = $_
Write-Host "Formatting $fileName"
$fileContents = Get-Content $fileName
$fileContents = $fileContents -join "`n" # use LF, not CRLF
if (-not $fileContents.EndsWith("`n"))
{
$fileContents += "`n" # add a trailing newline
}
# this (convert to UTF-8 followed by WriteAllBytes) avoids adding a BOM in Windows PowerShell
$fileContents = [System.Text.Encoding]::UTF8.GetBytes($fileContents)
[io.file]::WriteAllBytes($fileName, $fileContents)
}
56 changes: 56 additions & 0 deletions azure-pipelines/localization.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
trigger:
- main
pr: none

variables:
# this is silly, but we need the argument to patVariable to be exactly
# "$(PackageSourcePat)"
# however, if we actually put that there after PackageSourcePat is defined,
# it replaces $(PackageSourcePat) with the value of PackageSourcePat
- name: PackageSourcePatIndirect
value: '$(PackageSourcePat)'
- group: vcpkg-localization
- name: PackageSourcePat
value: "$(vcpkg-ceapx-package-source-pat)"
- name: GitEmbeddedBotArgs
value: '-C $(Build.SourcesDirectory) -c [email protected] -c user.name="Embedded Bot"'

pool:
name: 'VSEngSS-MicroBuild2022-1ES'

steps:
- task: OneLocBuild@2
inputs:
locProj: 'LocProject.json'
outDir: '$(Build.ArtifactStagingDirectory)'
isUseLfLineEndingsSelected: true
packageSourceAuth: patAuth
patVariable: '$(PackageSourcePatIndirect)'
- task: Powershell@2
displayName: Format messages.*.json files
continueOnError: true
inputs:
pwsh: true
filePath: azure-pipelines/Format-LocalizationFiles.ps1
- script: |
git $(GitEmbeddedBotArgs) add locales
git $(GitEmbeddedBotArgs) commit -m "[localization][automated][ci skip] update locale files"
displayName: Commit Changed Files
continueOnError: true
- task: DownloadSecureFile@1
displayName: Download Deploy Key
name: githubDeployKey
inputs:
secureFile: id_vcpkg_tool
# GitHub has a large, regularly changing set of IP address, so ignore the
# hostname and allow anything with the right key.
# https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/about-githubs-ip-addresses
# This public key should have the well-known fingerprint documented below.
# SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8
# https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/githubs-ssh-key-fingerprints
- script: mkdir %USERPROFILE%\.ssh && echo * ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==>>%USERPROFILE%\.ssh\known_hosts
displayName: Store GitHub Public Key
- script: git $(GitEmbeddedBotArgs) push [email protected]:microsoft/vcpkg-tool HEAD:$(Build.SourceBranch)
env:
GIT_SSH_COMMAND: ssh -i "$(githubDeployKey.secureFilePath)"
displayName: Push Localization Files
1 change: 1 addition & 0 deletions azure-pipelines/pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ jobs:
inputs:
script: |
build.x86.debug\vcpkg.exe x-generate-default-message-map --no-allow-incorrect-comments locales/messages.json
build.x86.debug\vcpkg.exe x-generate-default-message-map --no-output-comments locales/messages.en.json
- task: Powershell@2
displayName: 'Create Diff'
inputs:
Expand Down
72 changes: 72 additions & 0 deletions locales/messages.cs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"AddPortSucceded": "Succeeded in adding ports to vcpkg.json file.",
"AddTripletExpressionNotAllowed": "Error: triplet expressions are not allowed here. You may want to change `{package_name}:{triplet}` to `{package_name}` instead.",
"AllFormatArgsRawArgument": "format string \"{value}\" contains a raw format argument",
"AllFormatArgsUnbalancedBraces": "unbalanced brace in format string \"{value}\"",
"AwsAttemptingToFetchPackages": "Attempting to fetch {count} packages from AWS",
"AwsFailedToDownload": "aws failed to download with exit code: {exit_code}",
"AwsRestoredPackages": "Restored {count} packages from AWS servers in {elapsed}",
"AwsUploadedPackages": "Uploaded binaries to {count} AWS servers",
"BothYesAndNoOptionSpecifiedError": "error: cannot specify both --no-{option} and --{option}.",
"EmptyLicenseExpression": "SPDX license expression was empty.",
"ErrorIndividualPackagesUnsupported": "Error: In manifest mode, `vcpkg install` does not support individual package arguments.\nTo install additional packages, edit vcpkg.json and then run `vcpkg install` without any package arguments.",
"ErrorInvalidClassicModeOption": "Error: The option --{option} is not supported in classic mode and no manifest was found.",
"ErrorInvalidManifestModeOption": "Error: The option --{option} is not supported in manifest mode.",
"ErrorMessage": "error: ",
"ErrorMissingVcpkgRoot": "Error: Could not detect vcpkg-root. If you are trying to use a copy of vcpkg that you've built, you must define the VCPKG_ROOT environment variable to point to a cloned copy of {url}.",
"ErrorNoVSInstance": "Error: in triplet {triplet}: Unable to find a valid Visual Studio instance",
"ErrorNoVSInstanceAt": " at \"{path}\"",
"ErrorNoVSInstanceFullVersion": " with toolset version prefix {version}",
"ErrorNoVSInstanceVersion": " with toolset version {version}",
"ErrorRequireBaseline": "Error: this vcpkg instance requires a manifest with a specified baseline in order to interact with ports. Please add 'builtin-baseline' to the manifest or add a 'vcpkg-configuration.json' that redefines the default registry.\n",
"ErrorRequirePackagesList": "Error: `vcpkg install` requires a list of packages to install in classic mode.",
"ErrorRequirePackagesToInstall": "Error: No packages were listed for installation and no manifest was found.",
"ErrorVcvarsUnsupported": "Error: in triplet {triplet}: Use of Visual Studio's Developer Prompt is unsupported on non-Windows hosts.\nDefine 'VCPKG_CMAKE_SYSTEM_NAME' or 'VCPKG_CHAINLOAD_TOOLCHAIN_FILE' in the triplet file.",
"ForceSystemBinariesOnWeirdPlatforms": "Environment variable VCPKG_FORCE_SYSTEM_BINARIES must be set on arm, s390x, and ppc64le platforms.",
"FormattedParseMessageExpression": " on expression: {value}",
"FormattedParseMessageLocation": "{path}:{row}:{column}: ",
"GenerateMsgErrorParsingFormatArgs": "error: parsing format string for {value}:",
"GenerateMsgIncorrectComment": "message {value} has an incorrect comment:",
"GenerateMsgNoArgumentValue": " {{{value}}} was specified in a comment, but was not used in the message.",
"GenerateMsgNoCommentValue": " {{{value}}} was used in the message, but not commented.",
"GraphCycleDetected": "Cycle detected within graph at {package_name}:",
"GraphCycleDetectedElement": " {package_name}",
"IllegalFeatures": "error: List of features is not allowed in this contect",
"IllegalPlatformSpec": "error: Platform qualifier is not allowed in this context",
"LicenseExpressionContainsExtraPlus": "SPDX license expression contains an extra '+'. These are only allowed directly after a license identifier.",
"LicenseExpressionContainsInvalidCharacter": "SPDX license expression contains an invalid character (0x{value:02X} '{value}').",
"LicenseExpressionContainsUnicode": "SPDX license expression contains a unicode character (U+{value:04X} '{pretty_value}'), but these expressions are ASCII-only.",
"LicenseExpressionDocumentRefUnsupported": "The current implementation does not support DocumentRef- SPDX references.",
"LicenseExpressionExpectCompoundFoundParen": "Expected a compound or the end of the string, found a parenthesis.",
"LicenseExpressionExpectCompoundFoundWith": "Expected either AND or OR, found WITH (WITH is only allowed after license names, not parenthesized expressions).",
"LicenseExpressionExpectCompoundFoundWord": "Expected either AND or OR, found a license or exception name: '{value}'.",
"LicenseExpressionExpectCompoundOrWithFoundWord": "Expected either AND, OR, or WITH, found a license or exception name: '{value}'.",
"LicenseExpressionExpectExceptionFoundCompound": "Expected an exception name, found the compound {value}.",
"LicenseExpressionExpectExceptionFoundEof": "Expected an exception name, found the end of the string.",
"LicenseExpressionExpectExceptionFoundParen": "Expected an exception name, found a parenthesis.",
"LicenseExpressionExpectLicenseFoundCompound": "Expected a license name, found the compound {value}.",
"LicenseExpressionExpectLicenseFoundEof": "Expected a license name, found the end of the string.",
"LicenseExpressionExpectLicenseFoundParen": "Expected a license name, found a parenthesis.",
"LicenseExpressionImbalancedParens": "There was a close parenthesis without an opening parenthesis.",
"LicenseExpressionUnknownException": "Unknown license exception identifier '{value}'. Known values are listed at https://spdx.org/licenses/exceptions-index.html",
"LicenseExpressionUnknownLicense": "Unknown license identifier '{value}'. Known values are listed at https://spdx.org/licenses/",
"NoLocalizationForMessages": "No localization for the following messages:",
"ProcessorArchitectureMalformed": "Failed to parse %PROCESSOR_ARCHITECTURE% ({arch}) as a valid CPU architecture.",
"ProcessorArchitectureMissing": "The required environment variable %PROCESSOR_ARCHITECTURE% is missing.",
"ProcessorArchitectureW6432Malformed": "Failed to parse %PROCESSOR_ARCHITEW6432% ({arch}) as a valid CPU architecture. Falling back to %PROCESSOR_ARCHITECTURE%.",
"SeeURL": "See {url} for more information.",
"UnsupportedSystemName": "Error: Could not map VCPKG_CMAKE_SYSTEM_NAME '{system_name}' to a vcvarsall platform. Supported system names are '', 'Windows' and 'WindowsStore'.",
"UnsupportedToolchain": "Error: in triplet {triplet}: Unable to find a valid toolchain combination.\n The requested target architecture was {arch}\n The selected Visual Studio instance is at {path}\n The available toolchain combinations are {list}\n",
"UsingManifestAt": "Using manifest file at {path}.",
"VSExaminedInstances": "The following Visual Studio instances were considered:",
"VSExaminedPaths": "The following paths were examined for Visual Studio instances:",
"VSNoInstances": "Could not locate a complete Visual Studio instance",
"VcpkgDisallowedClassicMode": "Error: Could not locate a manifest (vcpkg.json) above the current working directory.\nThis vcpkg distribution does not have a classic mode instance.",
"VcpkgHasCrashed": "vcpkg.exe has crashed.\nPlease send an email to:\n {email}\ncontaining a brief summary of what you were trying to do and the following data blob:",
"VcpkgHasCrashedArgument": "{value}|",
"VcpkgHasCrashedDataBlob": "\nVersion={version}\nEXCEPTION='{error}'\nCMD=",
"VcpkgInvalidCommand": "invalid command: {command_name}",
"VcpkgSendMetricsButDisabled": "Warning: passed --sendmetrics, but metrics are disabled.",
"VersionSpecMismatch": "error: Failed to load port because version specs did not match\n Path: {path}\n Expected: {expected_version}\n Actual: {actual_version}",
"WarningMessage": "warning: "
}
72 changes: 72 additions & 0 deletions locales/messages.de.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"AddPortSucceded": "Succeeded in adding ports to vcpkg.json file.",
"AddTripletExpressionNotAllowed": "Error: triplet expressions are not allowed here. You may want to change `{package_name}:{triplet}` to `{package_name}` instead.",
"AllFormatArgsRawArgument": "format string \"{value}\" contains a raw format argument",
"AllFormatArgsUnbalancedBraces": "unbalanced brace in format string \"{value}\"",
"AwsAttemptingToFetchPackages": "Attempting to fetch {count} packages from AWS",
"AwsFailedToDownload": "aws failed to download with exit code: {exit_code}",
"AwsRestoredPackages": "Restored {count} packages from AWS servers in {elapsed}",
"AwsUploadedPackages": "Uploaded binaries to {count} AWS servers",
"BothYesAndNoOptionSpecifiedError": "error: cannot specify both --no-{option} and --{option}.",
"EmptyLicenseExpression": "SPDX license expression was empty.",
"ErrorIndividualPackagesUnsupported": "Error: In manifest mode, `vcpkg install` does not support individual package arguments.\nTo install additional packages, edit vcpkg.json and then run `vcpkg install` without any package arguments.",
"ErrorInvalidClassicModeOption": "Error: The option --{option} is not supported in classic mode and no manifest was found.",
"ErrorInvalidManifestModeOption": "Error: The option --{option} is not supported in manifest mode.",
"ErrorMessage": "error: ",
"ErrorMissingVcpkgRoot": "Error: Could not detect vcpkg-root. If you are trying to use a copy of vcpkg that you've built, you must define the VCPKG_ROOT environment variable to point to a cloned copy of {url}.",
"ErrorNoVSInstance": "Error: in triplet {triplet}: Unable to find a valid Visual Studio instance",
"ErrorNoVSInstanceAt": " at \"{path}\"",
"ErrorNoVSInstanceFullVersion": " with toolset version prefix {version}",
"ErrorNoVSInstanceVersion": " with toolset version {version}",
"ErrorRequireBaseline": "Error: this vcpkg instance requires a manifest with a specified baseline in order to interact with ports. Please add 'builtin-baseline' to the manifest or add a 'vcpkg-configuration.json' that redefines the default registry.\n",
"ErrorRequirePackagesList": "Error: `vcpkg install` requires a list of packages to install in classic mode.",
"ErrorRequirePackagesToInstall": "Error: No packages were listed for installation and no manifest was found.",
"ErrorVcvarsUnsupported": "Error: in triplet {triplet}: Use of Visual Studio's Developer Prompt is unsupported on non-Windows hosts.\nDefine 'VCPKG_CMAKE_SYSTEM_NAME' or 'VCPKG_CHAINLOAD_TOOLCHAIN_FILE' in the triplet file.",
"ForceSystemBinariesOnWeirdPlatforms": "Environment variable VCPKG_FORCE_SYSTEM_BINARIES must be set on arm, s390x, and ppc64le platforms.",
"FormattedParseMessageExpression": " on expression: {value}",
"FormattedParseMessageLocation": "{path}:{row}:{column}: ",
"GenerateMsgErrorParsingFormatArgs": "error: parsing format string for {value}:",
"GenerateMsgIncorrectComment": "message {value} has an incorrect comment:",
"GenerateMsgNoArgumentValue": " {{{value}}} was specified in a comment, but was not used in the message.",
"GenerateMsgNoCommentValue": " {{{value}}} was used in the message, but not commented.",
"GraphCycleDetected": "Cycle detected within graph at {package_name}:",
"GraphCycleDetectedElement": " {package_name}",
"IllegalFeatures": "error: List of features is not allowed in this contect",
"IllegalPlatformSpec": "error: Platform qualifier is not allowed in this context",
"LicenseExpressionContainsExtraPlus": "SPDX license expression contains an extra '+'. These are only allowed directly after a license identifier.",
"LicenseExpressionContainsInvalidCharacter": "SPDX license expression contains an invalid character (0x{value:02X} '{value}').",
"LicenseExpressionContainsUnicode": "SPDX license expression contains a unicode character (U+{value:04X} '{pretty_value}'), but these expressions are ASCII-only.",
"LicenseExpressionDocumentRefUnsupported": "The current implementation does not support DocumentRef- SPDX references.",
"LicenseExpressionExpectCompoundFoundParen": "Expected a compound or the end of the string, found a parenthesis.",
"LicenseExpressionExpectCompoundFoundWith": "Expected either AND or OR, found WITH (WITH is only allowed after license names, not parenthesized expressions).",
"LicenseExpressionExpectCompoundFoundWord": "Expected either AND or OR, found a license or exception name: '{value}'.",
"LicenseExpressionExpectCompoundOrWithFoundWord": "Expected either AND, OR, or WITH, found a license or exception name: '{value}'.",
"LicenseExpressionExpectExceptionFoundCompound": "Expected an exception name, found the compound {value}.",
"LicenseExpressionExpectExceptionFoundEof": "Expected an exception name, found the end of the string.",
"LicenseExpressionExpectExceptionFoundParen": "Expected an exception name, found a parenthesis.",
"LicenseExpressionExpectLicenseFoundCompound": "Expected a license name, found the compound {value}.",
"LicenseExpressionExpectLicenseFoundEof": "Expected a license name, found the end of the string.",
"LicenseExpressionExpectLicenseFoundParen": "Expected a license name, found a parenthesis.",
"LicenseExpressionImbalancedParens": "There was a close parenthesis without an opening parenthesis.",
"LicenseExpressionUnknownException": "Unknown license exception identifier '{value}'. Known values are listed at https://spdx.org/licenses/exceptions-index.html",
"LicenseExpressionUnknownLicense": "Unknown license identifier '{value}'. Known values are listed at https://spdx.org/licenses/",
"NoLocalizationForMessages": "No localization for the following messages:",
"ProcessorArchitectureMalformed": "Failed to parse %PROCESSOR_ARCHITECTURE% ({arch}) as a valid CPU architecture.",
"ProcessorArchitectureMissing": "The required environment variable %PROCESSOR_ARCHITECTURE% is missing.",
"ProcessorArchitectureW6432Malformed": "Failed to parse %PROCESSOR_ARCHITEW6432% ({arch}) as a valid CPU architecture. Falling back to %PROCESSOR_ARCHITECTURE%.",
"SeeURL": "See {url} for more information.",
"UnsupportedSystemName": "Error: Could not map VCPKG_CMAKE_SYSTEM_NAME '{system_name}' to a vcvarsall platform. Supported system names are '', 'Windows' and 'WindowsStore'.",
"UnsupportedToolchain": "Error: in triplet {triplet}: Unable to find a valid toolchain combination.\n The requested target architecture was {arch}\n The selected Visual Studio instance is at {path}\n The available toolchain combinations are {list}\n",
"UsingManifestAt": "Using manifest file at {path}.",
"VSExaminedInstances": "The following Visual Studio instances were considered:",
"VSExaminedPaths": "The following paths were examined for Visual Studio instances:",
"VSNoInstances": "Could not locate a complete Visual Studio instance",
"VcpkgDisallowedClassicMode": "Error: Could not locate a manifest (vcpkg.json) above the current working directory.\nThis vcpkg distribution does not have a classic mode instance.",
"VcpkgHasCrashed": "vcpkg.exe has crashed.\nPlease send an email to:\n {email}\ncontaining a brief summary of what you were trying to do and the following data blob:",
"VcpkgHasCrashedArgument": "{value}|",
"VcpkgHasCrashedDataBlob": "\nVersion={version}\nEXCEPTION='{error}'\nCMD=",
"VcpkgInvalidCommand": "invalid command: {command_name}",
"VcpkgSendMetricsButDisabled": "Warning: passed --sendmetrics, but metrics are disabled.",
"VersionSpecMismatch": "error: Failed to load port because version specs did not match\n Path: {path}\n Expected: {expected_version}\n Actual: {actual_version}",
"WarningMessage": "warning: "
}
Loading

0 comments on commit 5c20fad

Please sign in to comment.