mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-18 13:38:03 +08:00
5cfbd72fa8
* PowerRename new UI * Add scrollviewer * Don't deploy PowerRenameUI_new * Visual updates * Visual updates * Updates * Update Resources.resw * Added docs button * Update MainWindow.xaml * Wire Docs button * RegEx -> regular expressions * Update Show only renamed list on search/replace text changed * Update Show only renamed list on search/replace text changed - proper fix Set searchTerm to NULL when cleared - fix Show only renamed files on clear searchTerm * Files/folders input error handling * Fix renaming with keeping UI window opened After renaming folder, all of it's children need path update. Without path update, further renaming of children items would fail. * Update only children, not all items with greater depth * Fix dictionary false positives * Remove .NET dep * Rename PowerRenameUI_new to PowerRenameUILib Rename executable PowerRenameUIHost to PowerRename Co-authored-by: Laute <Niels.Laute@philips.com>
68 lines
2.5 KiB
PowerShell
68 lines
2.5 KiB
PowerShell
# List of resource folders
|
|
$input_resource_folder_list = @( "src\settings-ui\Microsoft.PowerToys.Settings.UI\Strings\",
|
|
"src\modules\powerrename\PowerRenameUILib\Strings\"
|
|
)
|
|
$output_resource_folder_list = @( "src\settings-ui\Microsoft.PowerToys.Settings.UI\Strings\",
|
|
"src\modules\powerrename\PowerRenameUILib\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
|
|
}
|
|
}
|
|
|