mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 10:46:33 +02:00
common project localization: move out all updating strings
- finish localizing boostrapper/runner/action_runner
This commit is contained in:
committed by
Andrey Nekrasov
parent
5629e8068b
commit
f33b3c771a
@@ -4,9 +4,9 @@
|
||||
"LanguageSet": "Azure_Languages",
|
||||
"LocItems": [
|
||||
{
|
||||
"SourceFile": "src\\action_runner\\Resources.resx",
|
||||
"SourceFile": "src\\runner\\Resources.resx",
|
||||
"CopyOption": "LangIDOnName",
|
||||
"OutputPath": "src\\action_runner"
|
||||
"OutputPath": "src\\runner"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -73,5 +73,85 @@
|
||||
<data name="AUTOUPDATE_SUCCESS" xml:space="preserve">
|
||||
<value>PowerToys was successfully updated!</value>
|
||||
</data>
|
||||
|
||||
<data name="MSI_VERSION_IS_ALREADY_RUNNING" xml:space="preserve">
|
||||
<value>An older version of PowerToys is already running.</value>
|
||||
</data>
|
||||
<data name="DOWNLOAD_UPDATE_ERROR" xml:space="preserve">
|
||||
<value>Couldn't download PowerToys update! Please report the issue on Github.</value>
|
||||
</data>
|
||||
<data name="OLDER_MSIX_UNINSTALLED" xml:space="preserve">
|
||||
<value>An older MSIX version of PowerToys was uninstalled.</value>
|
||||
</data>
|
||||
<data name="PT_UPDATE_MESSAGE_BOX_TEXT" xml:space="preserve">
|
||||
<value>PowerToys was updated successfully!</value>
|
||||
</data>
|
||||
<data name="STARTUP_DISABLED_BY_POLICY" xml:space="preserve">
|
||||
<value>This setting has been disabled by your administrator.</value>
|
||||
</data>
|
||||
<data name="STARTUP_DISABLED_BY_USER" xml:space="preserve">
|
||||
<value>This setting has been disabled manually via <a href="https://ms_settings_startupapps" target="_blank">Startup Settings</a>.</value>
|
||||
</data>
|
||||
<data name="GITHUB_NEW_VERSION_AVAILABLE" xml:space="preserve">
|
||||
<value>An update to PowerToys is available.</value>
|
||||
</data>
|
||||
<data name="GITHUB_NEW_VERSION_DOWNLOAD_STARTED" xml:space="preserve">
|
||||
<value>PowerToys download started.</value>
|
||||
</data>
|
||||
<data name="GITHUB_NEW_VERSION_READY_TO_INSTALL" xml:space="preserve">
|
||||
<value>An update to PowerToys is ready to install.</value>
|
||||
</data>
|
||||
<data name="GITHUB_NEW_VERSION_DOWNLOAD_INSTALL_ERROR" xml:space="preserve">
|
||||
<value>Error: couldn't download PowerToys installer. Visit our GitHub page to update.</value>
|
||||
</data>
|
||||
<data name="GITHUB_NEW_VERSION_UPDATE_NOW" xml:space="preserve">
|
||||
<value>Update now</value>
|
||||
</data>
|
||||
<data name="GITHUB_NEW_VERSION_UPDATE_AFTER_RESTART" xml:space="preserve">
|
||||
<value>At next launch</value>
|
||||
</data>
|
||||
<data name="UNINSTALLATION_UNKNOWN_ERROR" xml:space="preserve">
|
||||
<value>Error: please uninstall the previous version of PowerToys manually.</value>
|
||||
</data>
|
||||
<data name="GITHUB_NEW_VERSION_AVAILABLE_OFFER_VISIT" xml:space="preserve">
|
||||
<value>An update to PowerToys is available. Visit our GitHub page to update.</value>
|
||||
</data>
|
||||
<data name="GITHUB_NEW_VERSION_UNAVAILABLE" xml:space="preserve">
|
||||
<value>PowerToys is up to date.</value>
|
||||
</data>
|
||||
<data name="GITHUB_NEW_VERSION_VISIT" xml:space="preserve">
|
||||
<value>Visit</value>
|
||||
</data>
|
||||
<data name="GITHUB_NEW_VERSION_MORE_INFO" xml:space="preserve">
|
||||
<value>More info...</value>
|
||||
</data>
|
||||
<data name="GITHUB_NEW_VERSION_ABORT" xml:space="preserve">
|
||||
<value>Abort</value>
|
||||
</data>
|
||||
<data name="GITHUB_NEW_VERSION_SNOOZE_TITLE" xml:space="preserve">
|
||||
<value>Click Snooze to be reminded in:</value>
|
||||
</data>
|
||||
<data name="GITHUB_NEW_VERSION_UPDATE_SNOOZE_1D" xml:space="preserve">
|
||||
<value>1 day</value>
|
||||
</data>
|
||||
<data name="GITHUB_NEW_VERSION_UPDATE_SNOOZE_5D" xml:space="preserve">
|
||||
<value>5 days</value>
|
||||
</data>
|
||||
<data name="DOWNLOAD_IN_PROGRESS" xml:space="preserve">
|
||||
<value>Downloading...</value>
|
||||
</data>
|
||||
<data name="DOWNLOAD_COMPLETE" xml:space="preserve">
|
||||
<value>Download complete</value>
|
||||
</data>
|
||||
<data name="TOAST_TITLE" xml:space="preserve">
|
||||
<value>PowerToys Update</value>
|
||||
</data>
|
||||
<data name="OFFER_UNINSTALL_MSI" xml:space="preserve">
|
||||
<value>We've detected a previous installation of PowerToys. Would you like to remove it?</value>
|
||||
</data>
|
||||
<data name="OFFER_UNINSTALL_MSI_TITLE" xml:space="preserve">
|
||||
<value>PowerToys: uninstall previous version?</value>
|
||||
</data>
|
||||
<data name="SNOOZE_BUTTON" xml:space="preserve">
|
||||
<value>Snooze</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "pch.h"
|
||||
#include "general_settings.h"
|
||||
#include "auto_start_helper.h"
|
||||
#include "Generated files/resource.h"
|
||||
|
||||
#include <common/common.h>
|
||||
#include <common/settings_helpers.h>
|
||||
@@ -15,12 +16,7 @@ static std::wstring settings_theme = L"system";
|
||||
static bool run_as_elevated = false;
|
||||
static bool download_updates_automatically = true;
|
||||
|
||||
// TODO: add resource.rc for settings project and localize
|
||||
namespace localized_strings
|
||||
{
|
||||
const std::wstring_view STARTUP_DISABLED_BY_POLICY = L"This setting has been disabled by your administrator.";
|
||||
const std::wstring_view STARTUP_DISABLED_BY_USER = LR"(This setting has been disabled manually via <a href="https://ms_settings_startupapps" target="_blank">Startup Settings</a>.)";
|
||||
}
|
||||
extern "C" IMAGE_DOS_HEADER __ImageBase;
|
||||
|
||||
json::JsonObject GeneralSettings::to_json()
|
||||
{
|
||||
@@ -81,7 +77,6 @@ GeneralSettings get_general_settings()
|
||||
|
||||
if (winstore::running_as_packaged())
|
||||
{
|
||||
using namespace localized_strings;
|
||||
const auto task_state = winstore::get_startup_task_status_async().get();
|
||||
switch (task_state)
|
||||
{
|
||||
@@ -92,11 +87,11 @@ GeneralSettings get_general_settings()
|
||||
settings.isStartupEnabled = true;
|
||||
break;
|
||||
case winstore::StartupTaskState::DisabledByPolicy:
|
||||
settings.startupDisabledReason = STARTUP_DISABLED_BY_POLICY;
|
||||
settings.startupDisabledReason = GET_RESOURCE_STRING(IDS_STARTUP_DISABLED_BY_POLICY);
|
||||
settings.isStartupEnabled = false;
|
||||
break;
|
||||
case winstore::StartupTaskState::DisabledByUser:
|
||||
settings.startupDisabledReason = STARTUP_DISABLED_BY_USER;
|
||||
settings.startupDisabledReason = GET_RESOURCE_STRING(IDS_STARTUP_DISABLED_BY_USER);
|
||||
settings.isStartupEnabled = false;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -35,20 +35,12 @@
|
||||
#endif
|
||||
|
||||
extern "C" IMAGE_DOS_HEADER __ImageBase;
|
||||
|
||||
namespace localized_strings
|
||||
{
|
||||
const wchar_t MSI_VERSION_IS_ALREADY_RUNNING[] = L"An older version of PowerToys is already running.";
|
||||
const wchar_t DOWNLOAD_UPDATE_ERROR[] = L"Couldn't download PowerToys update! Please report the issue on Github.";
|
||||
const wchar_t OLDER_MSIX_UNINSTALLED[] = L"An older MSIX version of PowerToys was uninstalled.";
|
||||
const wchar_t PT_UPDATE_MESSAGE_BOX_TEXT[] = L"PowerToys was updated successfully!";
|
||||
const wchar_t POWER_TOYS[] = L"PowerToys";
|
||||
const wchar_t POWER_TOYS_MODULE_LOAD_FAIL[] = L"Failed to load "; // Module name will be appended on this message and it is not localized.
|
||||
}
|
||||
extern updating::notifications::strings Strings;
|
||||
|
||||
namespace
|
||||
{
|
||||
const wchar_t PT_URI_PROTOCOL_SCHEME[] = L"powertoys://";
|
||||
const wchar_t POWER_TOYS_MODULE_LOAD_FAIL[] = L"Failed to load "; // Module name will be appended on this message and it is not localized.
|
||||
}
|
||||
|
||||
void chdir_current_executable()
|
||||
@@ -59,7 +51,7 @@ void chdir_current_executable()
|
||||
PathRemoveFileSpec(executable_path);
|
||||
if (!SetCurrentDirectory(executable_path))
|
||||
{
|
||||
show_last_error_message(L"Change Directory to Executable Path", GetLastError());
|
||||
show_last_error_message(L"Change Directory to Executable Path", GetLastError(), L"PowerToys - runner");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,7 +102,7 @@ int runner(bool isProcessElevated)
|
||||
std::thread{ [] {
|
||||
if (updating::uninstall_previous_msix_version_async().get())
|
||||
{
|
||||
notifications::show_toast(localized_strings::OLDER_MSIX_UNINSTALLED, L"PowerToys");
|
||||
notifications::show_toast(GET_RESOURCE_STRING(IDS_OLDER_MSIX_UNINSTALLED).c_str(), L"PowerToys");
|
||||
}
|
||||
} }.detach();
|
||||
}
|
||||
@@ -140,11 +132,12 @@ int runner(bool isProcessElevated)
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
std::wstring errorMessage = std::wstring(localized_strings::POWER_TOYS_MODULE_LOAD_FAIL) + moduleSubdir.data();
|
||||
MessageBox(NULL,
|
||||
errorMessage.c_str(),
|
||||
localized_strings::POWER_TOYS,
|
||||
MB_OK | MB_ICONERROR);
|
||||
std::wstring errorMessage = POWER_TOYS_MODULE_LOAD_FAIL;
|
||||
errorMessage += moduleSubdir;
|
||||
MessageBoxW(NULL,
|
||||
errorMessage.c_str(),
|
||||
L"PowerToys",
|
||||
MB_OK | MB_ICONERROR);
|
||||
}
|
||||
}
|
||||
// Start initial powertoys
|
||||
@@ -243,7 +236,7 @@ toast_notification_handler_result toast_notification_handler(const std::wstring_
|
||||
{
|
||||
try
|
||||
{
|
||||
std::wstring installer_filename = updating::download_update().get();
|
||||
std::wstring installer_filename = updating::download_update(Strings).get();
|
||||
|
||||
std::wstring args{ UPDATE_NOW_LAUNCH_STAGE1_CMDARG };
|
||||
args += L' ';
|
||||
@@ -255,7 +248,7 @@ toast_notification_handler_result toast_notification_handler(const std::wstring_
|
||||
catch (...)
|
||||
{
|
||||
MessageBoxW(nullptr,
|
||||
localized_strings::DOWNLOAD_UPDATE_ERROR,
|
||||
GET_RESOURCE_STRING(IDS_DOWNLOAD_UPDATE_ERROR).c_str(),
|
||||
L"PowerToys",
|
||||
MB_ICONWARNING | MB_OK);
|
||||
|
||||
@@ -314,7 +307,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||
case SpecialMode::ReportSuccessfulUpdate:
|
||||
{
|
||||
notifications::remove_toasts(notifications::UPDATING_PROCESS_TOAST_TAG);
|
||||
notifications::show_toast(localized_strings::PT_UPDATE_MESSAGE_BOX_TEXT,
|
||||
notifications::show_toast(GET_RESOURCE_STRING(IDS_PT_UPDATE_MESSAGE_BOX_TEXT),
|
||||
L"PowerToys",
|
||||
notifications::toast_params{ notifications::UPDATING_PROCESS_TOAST_TAG });
|
||||
break;
|
||||
|
||||
@@ -390,7 +390,7 @@ void run_settings_window()
|
||||
WaitForSingleObject(process_info.hProcess, INFINITE);
|
||||
if (WaitForSingleObject(process_info.hProcess, INFINITE) != WAIT_OBJECT_0)
|
||||
{
|
||||
show_last_error_message(L"Couldn't wait on the Settings Window to close.", GetLastError());
|
||||
show_last_error_message(L"Couldn't wait on the Settings Window to close.", GetLastError(), L"PowerToys - runner");
|
||||
}
|
||||
|
||||
LExit:
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#include "pch.h"
|
||||
|
||||
#include <common/common.h>
|
||||
#include "Generated Files/resource.h"
|
||||
|
||||
#include "action_runner_utils.h"
|
||||
#include "update_state.h"
|
||||
#include "update_utils.h"
|
||||
@@ -8,6 +11,10 @@
|
||||
#include <common/updating/updating.h>
|
||||
#include <runner/general_settings.h>
|
||||
|
||||
extern "C" IMAGE_DOS_HEADER __ImageBase;
|
||||
|
||||
auto Strings = updating::notifications::strings::create();
|
||||
|
||||
bool start_msi_uninstallation_sequence()
|
||||
{
|
||||
const auto package_path = updating::get_msi_package_path();
|
||||
@@ -18,7 +25,7 @@ bool start_msi_uninstallation_sequence()
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!updating::offer_msi_uninstallation())
|
||||
if (!updating::offer_msi_uninstallation(Strings))
|
||||
{
|
||||
// User declined to uninstall or opted for "Don't show again"
|
||||
return false;
|
||||
@@ -54,7 +61,7 @@ void github_update_worker()
|
||||
const bool download_updates_automatically = get_general_settings().downloadUpdatesAutomatically;
|
||||
try
|
||||
{
|
||||
updating::try_autoupdate(download_updates_automatically).get();
|
||||
updating::try_autoupdate(download_updates_automatically, Strings).get();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
@@ -70,7 +77,7 @@ std::wstring check_for_updates()
|
||||
{
|
||||
try
|
||||
{
|
||||
return updating::check_new_version_available().get();
|
||||
return updating::check_new_version_available(Strings).get();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user