Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Localize ImageResizer #1261

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions installer/MSIX/PackagingLayout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,27 @@
<File DestinationPath="svgs\*" SourcePath="..\..\x64\Release\svgs\*"/>
<File DestinationPath="settings-html\**" SourcePath="..\..\x64\Release\settings-html\**"/>
<File DestinationPath="Images\*.png" SourcePath="Images\*.png"/>

<!-- Resource files for ar,bg,ca,cs,de,es,eu-ES,fr,he,hu,it,nb-NO,nl,pl,pt-BR,ru,sk,tr,zh-Hans -->
<File DestinationPath="modules\ar\**" SourcePath="..\..\x64\Release\modules\ar\**"/>
<File DestinationPath="modules\bg\**" SourcePath="..\..\x64\Release\modules\bg\**"/>
<File DestinationPath="modules\ca\**" SourcePath="..\..\x64\Release\modules\ca\**"/>
<File DestinationPath="modules\cs\**" SourcePath="..\..\x64\Release\modules\cs\**"/>
<File DestinationPath="modules\de\**" SourcePath="..\..\x64\Release\modules\de\**"/>
<File DestinationPath="modules\es\**" SourcePath="..\..\x64\Release\modules\es\**"/>
<File DestinationPath="modules\eu-ES\**" SourcePath="..\..\x64\Release\modules\eu-ES\**"/>
<File DestinationPath="modules\fr\**" SourcePath="..\..\x64\Release\modules\fr\**"/>
<File DestinationPath="modules\he\**" SourcePath="..\..\x64\Release\modules\he\**"/>
<File DestinationPath="modules\hu\**" SourcePath="..\..\x64\Release\modules\hu\**"/>
<File DestinationPath="modules\it\**" SourcePath="..\..\x64\Release\modules\it\**"/>
<File DestinationPath="modules\nb-NO\**" SourcePath="..\..\x64\Release\modules\nb-NO\**"/>
<File DestinationPath="modules\nl\**" SourcePath="..\..\x64\Release\modules\nl\**"/>
<File DestinationPath="modules\pl\**" SourcePath="..\..\x64\Release\modules\pl\**"/>
<File DestinationPath="modules\pt-BR\**" SourcePath="..\..\x64\Release\modules\pt-BR\**"/>
<File DestinationPath="modules\ru\**" SourcePath="..\..\x64\Release\modules\ru\**"/>
<File DestinationPath="modules\sk\**" SourcePath="..\..\x64\Release\modules\sk\**"/>
<File DestinationPath="modules\tr\**" SourcePath="..\..\x64\Release\modules\tr\**"/>
<File DestinationPath="modules\zh-Hans\**" SourcePath="..\..\x64\Release\modules\zh-Hans\**"/>
</Files>
</Package>
</PackageFamily>
Expand Down
Binary file modified src/modules/imageresizer/dll/ImageResizerExt.rc
Binary file not shown.
12 changes: 5 additions & 7 deletions src/modules/imageresizer/dll/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <interface/powertoy_module_interface.h>
#include <common/settings_objects.h>
#include "Settings.h"
#include <common/common.h>

CImageResizerExtModule _AtlModule;
HINSTANCE g_hInst_imageResizer = 0;
Expand All @@ -19,16 +20,12 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpRes
return _AtlModule.DllMain(dwReason, lpReserved);
}

// The PowerToy name that will be shown in the settings.
const static wchar_t* MODULE_NAME = L"ImageResizer";
// Add a description that will we shown in the module settings page.
const static wchar_t* MODULE_DESC = L"<no description>";

class ImageResizerModule : public PowertoyModuleIface
{
private:
// The PowerToy state.
bool m_enabled = false;
std::wstring app_name;

// Load initial settings from the persisted values.
void init_settings();
Expand All @@ -38,6 +35,7 @@ class ImageResizerModule : public PowertoyModuleIface
ImageResizerModule()
{
init_settings();
app_name = GET_RESOURCE_STRING(IDS_IMAGERESIZER);
};

// Destroy the powertoy and free memory
Expand All @@ -49,7 +47,7 @@ class ImageResizerModule : public PowertoyModuleIface
// Return the display name of the powertoy, this will be cached by the runner
virtual const wchar_t* get_name() override
{
return MODULE_NAME;
return app_name.c_str();
}

// Return array of the names of all events that this powertoy listens for, with
Expand All @@ -76,7 +74,7 @@ class ImageResizerModule : public PowertoyModuleIface

// Create a Settings object.
PowerToysSettings::Settings settings(hinstance, get_name());
settings.set_description(MODULE_DESC);
settings.set_description(GET_RESOURCE_STRING(IDS_SETTINGS_DESCRIPTION));
return settings.serialize_to_buffer(buffer, buffer_size);
}

Expand Down
8 changes: 5 additions & 3 deletions src/modules/imageresizer/dll/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
//
#define IDS_RESIZE_PICTURES 100
#define IDS_RESIZE_PICTURES_HERE 101
#define IDR_IMAGERESIZEREXT 101
#define IDR_CONTEXTMENUHANDLER 102
#define IDI_RESIZE_PICTURES 103
#define IDR_IMAGERESIZEREXT 102
#define IDR_CONTEXTMENUHANDLER 104
#define IDI_RESIZE_PICTURES 105
#define IDS_IMAGERESIZER 106
#define IDS_SETTINGS_DESCRIPTION 107

// Next default values for new objects
//
Expand Down