mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 03:37:59 +01:00
Merge branch 'master' into dev/crutkas/buildFarmVersioningTake3
This commit is contained in:
@@ -110,8 +110,8 @@ Foreach-Object {
|
||||
$content = $line -split "=", 2
|
||||
|
||||
$culture = [System.Globalization.CultureInfo]::GetCultureInfo('en-US')
|
||||
# Each resource is named as IDS_ResxResourceName, in uppercase
|
||||
$lineInRCFormat = "IDS_" + $content[0].ToUpper($culture) + " L`"" + $content[1] + "`""
|
||||
# Each resource is named as IDS_ResxResourceName, in uppercase. Escape occurrences of double quotes in the string
|
||||
$lineInRCFormat = "IDS_" + $content[0].ToUpper($culture) + " L`"" + $content[1].Replace("`"", "`"`"") + "`""
|
||||
$newLinesForRCFile = $newLinesForRCFile + "`r`n " + $lineInRCFormat
|
||||
|
||||
# Resource header file needs to be updated only for one language
|
||||
|
||||
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\")
|
||||
$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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,12 +66,18 @@ public:
|
||||
delete this;
|
||||
}
|
||||
|
||||
// Return the display name of the powertoy, this will be cached by the runner
|
||||
// Return the localized display name of the powertoy
|
||||
virtual const wchar_t* get_name() override
|
||||
{
|
||||
return MODULE_NAME;
|
||||
}
|
||||
|
||||
// Return the non localized key of the powertoy, this will be cached by the runner
|
||||
virtual const wchar_t* get_key() override
|
||||
{
|
||||
return MODULE_NAME;
|
||||
}
|
||||
|
||||
// Return JSON with the configuration options.
|
||||
virtual bool get_config(wchar_t* buffer, int* buffer_size) override
|
||||
{
|
||||
@@ -158,7 +164,7 @@ public:
|
||||
{
|
||||
// Parse the input JSON string.
|
||||
PowerToysSettings::PowerToyValues values =
|
||||
PowerToysSettings::PowerToyValues::from_json_string(config);
|
||||
PowerToysSettings::PowerToyValues::from_json_string(config, get_key());
|
||||
|
||||
// Update a bool property.
|
||||
//if (auto v = values.get_bool_value(L"bool_toggle_1")) {
|
||||
@@ -218,7 +224,7 @@ void $safeprojectname$::init_settings()
|
||||
{
|
||||
// Load and parse the settings file for this PowerToy.
|
||||
PowerToysSettings::PowerToyValues settings =
|
||||
PowerToysSettings::PowerToyValues::load_from_settings_file($safeprojectname$::get_name());
|
||||
PowerToysSettings::PowerToyValues::load_from_settings_file($safeprojectname$::get_key());
|
||||
|
||||
// Load a bool property.
|
||||
//if (auto v = settings.get_bool_value(L"bool_toggle_1")) {
|
||||
|
||||
Reference in New Issue
Block a user