diff --git a/.pipelines/build-localization.cmd b/.pipelines/build-localization.cmd new file mode 100644 index 0000000000..318735382e --- /dev/null +++ b/.pipelines/build-localization.cmd @@ -0,0 +1,28 @@ +@echo off +rem This script will fail to run unless you have the appropriate permissions + +cd /D "%~dp0" + +echo Preparing localization build... + +setlocal + +rem In this sample, the repo root is identical to the script directory path. Adjust the value of the RepoRoot variable accordingly based on your environment. +rem Again, ensure the RepoRoot variable is set to the real repo root location, otherwise the localization toolset wouldn't work as intended. +rem Note that the resolved %~dp0 ends with \. +set RepoRoot=%~dp0..\ +set OutDir=%RepoRoot%out +set NUGET_PACKAGES=%RepoRoot%packages +set LocalizationXLocPkgVer=2.0.0 + +echo Running localization build... + +set XLocPath=%NUGET_PACKAGES%\Localization.XLoc.%LocalizationXLocPkgVer% +set LocProjectDirectory=%RepoRoot%src + +rem Run the localization tool on all LocProject.json files in the src directory and it's subdirectories +dotnet "%XLocPath%\tools\netcore\Microsoft.Localization.XLoc.dll" /f "%LocProjectDirectory%" + +echo Localization build finished with exit code '%errorlevel%'. + +exit /b %errorlevel% diff --git a/.pipelines/pipeline.user.windows.yml b/.pipelines/pipeline.user.windows.yml index 0ee9147d52..c851d2f1aa 100644 --- a/.pipelines/pipeline.user.windows.yml +++ b/.pipelines/pipeline.user.windows.yml @@ -20,6 +20,7 @@ package_sources: nuget: feeds: 'Nuget': 'https://api.nuget.org/v3/index.json' + 'Toolset': 'https://msazure.pkgs.visualstudio.com/_packaging/Toolset/nuget/v3/index.json' 'PipelineBuildSupplement': 'https://msazure.pkgs.visualstudio.com/_packaging/PipelineBuildSupplement/nuget/v3/index.json' restore: @@ -33,6 +34,9 @@ restore: - !!defaultcommand name: 'Restore Installer' command: '.pipelines\restore-installer.cmd' + - !!defaultcommand + name: 'Restore Localization packages' + command: '.pipelines\restore-localization.cmd' build: @@ -145,6 +149,15 @@ build: - 'PowerToysSetup-*.exe' signing_options: sign_inline: true # This does signing a soon as this command completes + # Localize the files after the build procedure to avoid existing localized files from getting overwritten. To be moved before the Build PowerToys step once the lcl files have been checked in. Tracked at https://github.com/microsoft/PowerToys/issues/6046 + - !!buildcommand + name: 'Localize Power Toys' + command: '.pipelines\build-localization.cmd' + artifacts: + - from: 'out\loc' + to: 'loc' + include: + - '**/*' #package: diff --git a/.pipelines/restore-localization.cmd b/.pipelines/restore-localization.cmd new file mode 100644 index 0000000000..fdc8fa5e24 --- /dev/null +++ b/.pipelines/restore-localization.cmd @@ -0,0 +1,32 @@ +@echo off + +cd /D "%~dp0" + +echo Installing nuget packages + +setlocal + +rem In this sample, the repo root is identical to the script directory path. Adjust the value of the RepoRoot variable accordingly based on your environment. +rem Again, ensure the RepoRoot variable is set to the real repo root location, otherwise the localization toolset wouldn't work as intended. +rem Note that the resolved %~dp0 ends with \. +set RepoRoot=%~dp0..\ +set OutDir=%RepoRoot%out +set NUGET_PACKAGES=%RepoRoot%packages +set LocalizationXLocPkgVer=2.0.0 + +nuget install Localization.XLoc -Version %LocalizationXLocPkgVer% -OutputDirectory "%NUGET_PACKAGES%" -NonInteractive -Verbosity detailed +if "%errorlevel%" neq "0" ( + exit /b %errorlevel% +) + +nuget install LSBuild.XLoc -OutputDirectory "%NUGET_PACKAGES%" -NonInteractive -Verbosity detailed +if "%errorlevel%" neq "0" ( + exit /b %errorlevel% +) + +nuget install Localization.Languages -OutputDirectory "%NUGET_PACKAGES%" -NonInteractive -Verbosity detailed +if "%errorlevel%" neq "0" ( + exit /b %errorlevel% +) + +exit /b %errorlevel% diff --git a/src/core/Microsoft.PowerToys.Settings.UI/LocProject.json b/src/core/Microsoft.PowerToys.Settings.UI/LocProject.json new file mode 100644 index 0000000000..2c4de4da57 --- /dev/null +++ b/src/core/Microsoft.PowerToys.Settings.UI/LocProject.json @@ -0,0 +1,14 @@ +{ + "Projects": [ + { + "LanguageSet": "Azure_Languages", + "LocItems": [ + { + "SourceFile": "src\\core\\Microsoft.PowerToys.Settings.UI\\Strings\\en-us\\Resources.resw", + "CopyOption": "LangIDOnName", + "OutputPath": "src\\core\\Microsoft.PowerToys.Settings.UI\\Strings" + } + ] + } + ] +} diff --git a/src/modules/colorPicker/ColorPickerUI/LocProject.json b/src/modules/colorPicker/ColorPickerUI/LocProject.json new file mode 100644 index 0000000000..c60c98a308 --- /dev/null +++ b/src/modules/colorPicker/ColorPickerUI/LocProject.json @@ -0,0 +1,14 @@ +{ + "Projects": [ + { + "LanguageSet": "Azure_Languages", + "LocItems": [ + { + "SourceFile": "src\\modules\\colorPicker\\ColorPickerUI\\Properties\\Resources.resx", + "CopyOption": "LangIDOnName", + "OutputPath": "src\\modules\\colorPicker\\ColorPickerUI\\Properties" + } + ] + } + ] +} diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/LocProject.json b/src/modules/fancyzones/editor/FancyZonesEditor/LocProject.json new file mode 100644 index 0000000000..ae72642516 --- /dev/null +++ b/src/modules/fancyzones/editor/FancyZonesEditor/LocProject.json @@ -0,0 +1,14 @@ +{ + "Projects": [ + { + "LanguageSet": "Azure_Languages", + "LocItems": [ + { + "SourceFile": "src\\modules\\fancyzones\\editor\\FancyZonesEditor\\Properties\\Resources.resx", + "CopyOption": "LangIDOnName", + "OutputPath": "src\\modules\\fancyzones\\editor\\FancyZonesEditor\\Properties" + } + ] + } + ] +} diff --git a/src/modules/imageresizer/ui/LocProject.json b/src/modules/imageresizer/ui/LocProject.json new file mode 100644 index 0000000000..22fd8a320f --- /dev/null +++ b/src/modules/imageresizer/ui/LocProject.json @@ -0,0 +1,14 @@ +{ + "Projects": [ + { + "LanguageSet": "Azure_Languages", + "LocItems": [ + { + "SourceFile": "src\\modules\\imageresizer\\ui\\Properties\\Resources.resx", + "CopyOption": "LangIDOnName", + "OutputPath": "src\\modules\\imageresizer\\ui\\Properties" + } + ] + } + ] +} diff --git a/src/modules/launcher/PowerLauncher/LocProject.json b/src/modules/launcher/PowerLauncher/LocProject.json new file mode 100644 index 0000000000..b195cbc41c --- /dev/null +++ b/src/modules/launcher/PowerLauncher/LocProject.json @@ -0,0 +1,14 @@ +{ + "Projects": [ + { + "LanguageSet": "Azure_Languages", + "LocItems": [ + { + "SourceFile": "src\\modules\\launcher\\PowerLauncher\\Properties\\Resources.resx", + "CopyOption": "LangIDOnName", + "OutputPath": "src\\modules\\launcher\\PowerLauncher\\Properties" + } + ] + } + ] +} diff --git a/src/modules/previewpane/MarkdownPreviewHandler/LocProject.json b/src/modules/previewpane/MarkdownPreviewHandler/LocProject.json new file mode 100644 index 0000000000..1a74680f2a --- /dev/null +++ b/src/modules/previewpane/MarkdownPreviewHandler/LocProject.json @@ -0,0 +1,14 @@ +{ + "Projects": [ + { + "LanguageSet": "Azure_Languages", + "LocItems": [ + { + "SourceFile": "src\\modules\\previewpane\\MarkDownPreviewHandler\\Properties\\Resources.resx", + "CopyOption": "LangIDOnName", + "OutputPath": "src\\modules\\previewpane\\MarkDownPreviewHandler\\Properties" + } + ] + } + ] +} diff --git a/src/modules/previewpane/SvgPreviewHandler/LocProject.json b/src/modules/previewpane/SvgPreviewHandler/LocProject.json new file mode 100644 index 0000000000..539653476e --- /dev/null +++ b/src/modules/previewpane/SvgPreviewHandler/LocProject.json @@ -0,0 +1,14 @@ +{ + "Projects": [ + { + "LanguageSet": "Azure_Languages", + "LocItems": [ + { + "SourceFile": "src\\modules\\previewpane\\SvgPreviewHandler\\Resource.resx", + "CopyOption": "LangIDOnName", + "OutputPath": "src\\modules\\previewpane\\SvgPreviewHandler" + } + ] + } + ] +}