mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 03:37:59 +01:00
[Localization] Add localized resource dlls to the MSI installer (#6986)
* Added PowerLauncher resource files * Fixed typo in language * Updated localized .NET framework projects to include all resx files * Fixed typo in FZEditor.csproj * Added FZ Editor (.NET framework) resource dlls * Updated pipeline * Tweaked artifact statement to get all resource dlls in pipeline * Fix SvgPreviewHandler resx inclusion in csproj * Added condition to allow local MSI builds to run without resources * Generalized directory code * Added all resources that are to be added from C# projects, Settings UWP pending * Added markdown prev handler as keypath * Added loc script for Settings to move resw files to UWP file format * Separate markdown and svg resource components to allow guid auto-generation * Removed old image resizer resources * Fixed formatting * Changed tabs to space
This commit is contained in:
63
tools/localization/move_uwp_resources.ps1
Normal file
63
tools/localization/move_uwp_resources.ps1
Normal file
@@ -0,0 +1,63 @@
|
||||
# List of resource folders
|
||||
$input_resource_folder_list = @("src\core\Microsoft.PowerToys.Settings.UI\Strings\en-us\")
|
||||
$output_resource_folder_list = @("src\core\Microsoft.PowerToys.Settings.UI\Strings\")
|
||||
|
||||
# Hash table to get the folder language code from the code used in the file name
|
||||
$languageHashTable = @{ "en" = "en-us";
|
||||
"cs" = "cs-cz";
|
||||
"de" = "de-de";
|
||||
"es" = "es-es";
|
||||
"fr" = "fr-fr";
|
||||
"hu" = "hu-hu";
|
||||
"it" = "it-it";
|
||||
"ja" = "ja-jp";
|
||||
"ko" = "ko-kr";
|
||||
"nl" = "nl-nl";
|
||||
"pl" = "pl-pl";
|
||||
"pt-BR" = "pt-br";
|
||||
"pt-PT" = "pt-pt";
|
||||
"ru" = "ru-ru";
|
||||
"sv" = "sv-se";
|
||||
"tr" = "tr-tr";
|
||||
"zh-Hans" = "zh-cn";
|
||||
"zh-Hant" = "zh-tw"
|
||||
}
|
||||
|
||||
# Iterate over all folders
|
||||
for ($i=0; $i -lt $input_resource_folder_list.length; $i++) {
|
||||
Get-ChildItem $input_resource_folder_list[$i] -Filter Resources.*.resw |
|
||||
Foreach-Object {
|
||||
# Get language code from file name
|
||||
$lang = "en"
|
||||
$tokens = $_.Name -split "\."
|
||||
if ($tokens.Count -eq 3) {
|
||||
$lang = $tokens[1]
|
||||
}
|
||||
$langPath = $languageHashTable[$lang]
|
||||
|
||||
# Skip for en-us as it already exists in correct folder
|
||||
if ($lang -eq "en") {
|
||||
continue
|
||||
}
|
||||
|
||||
# Create language folder if it doesn't exist
|
||||
$output_path = $output_resource_folder_list[$i] + $langPath
|
||||
if (!(Test-Path -Path $output_path))
|
||||
{
|
||||
$paramNewItem = @{
|
||||
Path = $output_path
|
||||
ItemType = 'Directory'
|
||||
Force = $true
|
||||
}
|
||||
|
||||
New-Item @paramNewItem
|
||||
}
|
||||
|
||||
# UWP projects expect the file to be in the path Strings\langCode\Resources.resw where langCode is the hyphenated language code
|
||||
$input_file = $input_resource_folder_list[$i] + $_.Name
|
||||
$output_file = $output_path + "\" + "Resources.resw"
|
||||
|
||||
Move-Item -Path $input_file -Destination $output_file
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user