Skip to content

Commit

Permalink
[Localization] Migrate resources to resx for PowerRename (#6112)
Browse files Browse the repository at this point in the history
* Added localization code to pipeline and created one LocProject json for Settings

* Fixed typo

* Reordered nuget source

* Moved nuget install to restore step

* Added FZ.rc file to LocProj

* Added FZ resx file and modified rc file

* Fixed file names

* Changed to check folder for LocProject files

* Updated folder

* Changed directory

* Changed to src directory

* Changed language set and name format, removed rc file localization

* Added all projects with resx/resw files

* Added newline to end of file

* Removed nuget source as it is not used

* Updated comments

* Updated keyboard manager to use resx file

* Tweaked resources.resx and added it to project files

* Added comments and added in string table to resx script

* Remove change from bad merge

* Fix syntax error in convert stringtable

* Changed file type to None

* Migrated color picker's resources

* Migrated resources for Microsoft.Launcher

* Migrated resources for fancy zones

* Revert fancyzones changes

* Migrated resources for ImageResizer and modified script to add language specific code

* Added try catch and checks for modification to avoid unnecessary file creation

* Changed tab insertion to 4 spaces to avoid mixed file types in rc file

* Migrated resources for power preview project

* Added LocProject.json file for 5 projects

* added resgen exception check

* Moved non-localizable strings out of resx for powerpreview

* Move out hardcoded strings from dialog box and set them at runtime from string table

* Migrated resources for powerrename

* Added locproj

* Added missing ImageBase extern declaration

* Added build script in UWP UI project since PowerRenameExt is not referenced

* Resolved merge conflicts
  • Loading branch information
arjunbalgovind committed Aug 25, 2020
1 parent aebd765 commit 3ede1a0
Show file tree
Hide file tree
Showing 23 changed files with 562 additions and 122 deletions.
4 changes: 2 additions & 2 deletions src/modules/powerrename/UWPui/PowerRenameUWPUI.rc
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
#include "../../../common/version.h"

// We need both DLL and UI resource files for UWP UI.
#include "../dll/PowerRenameExt.rc"
#include "../dll/Generated Files/PowerRenameExt.rc"
#undef IDC_STATIC
#include "../ui/PowerRenameUI.rc"
#include "../ui/Generated Files/PowerRenameUI.rc"

2 VERSIONINFO
FILEVERSION FILE_VERSION
Expand Down
3 changes: 3 additions & 0 deletions src/modules/powerrename/UWPui/PowerRenameUWPUI.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<Target Name="GenerateResourceFiles" BeforeTargets="PrepareForBuild">
<Exec Command="powershell -NonInteractive -executionpolicy Unrestricted $(SolutionDir)tools\build\convert-resx-to-rc.ps1 ..\dll resource.base.h resource.h PowerRenameExt.base.rc PowerRenameExt.rc" />
</Target>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<ProjectGuid>{0485F45C-EA7A-4BB5-804B-3E8D14699387}</ProjectGuid>
Expand Down
14 changes: 14 additions & 0 deletions src/modules/powerrename/dll/LocProject.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"Projects": [
{
"LanguageSet": "Azure_Languages",
"LocItems": [
{
"SourceFile": "src\\modules\\powerrename\\dll\\Resources.resx",
"CopyOption": "LangIDOnName",
"OutputPath": "src\\modules\\powerrename\\dll"
}
]
}
]
}
Binary file not shown.
2 changes: 1 addition & 1 deletion src/modules/powerrename/dll/PowerRenameExt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <Helpers.h>
#include <icon_helpers.h>
#include <Settings.h>
#include "resource.h"
#include "Generated Files/resource.h"

extern HINSTANCE g_hInst;

Expand Down
Binary file removed src/modules/powerrename/dll/PowerRenameExt.rc
Binary file not shown.
12 changes: 10 additions & 2 deletions src/modules/powerrename/dll/PowerRenameExt.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<Target Name="GenerateResourceFiles" BeforeTargets="PrepareForBuild">
<Exec Command="powershell -NonInteractive -executionpolicy Unrestricted $(SolutionDir)tools\build\convert-resx-to-rc.ps1 . resource.base.h resource.h PowerRenameExt.base.rc PowerRenameExt.rc" />
</Target>
<PropertyGroup Label="Globals">
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{B25AC7A5-FB9F-4789-B392-D5C85E948670}</ProjectGuid>
Expand Down Expand Up @@ -174,13 +177,15 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="CLSID.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="Generated Files/resource.h" />
<ClInclude Include="PowerRenameExt.h" />
<ClInclude Include="pch.h" />
<None Include="resource.base.h" />
<ClInclude Include="targetver.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="PowerRenameExt.rc" />
<ResourceCompile Include="Generated Files/PowerRenameExt.rc" />
<None Include="PowerRenameExt.base.rc" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp" />
Expand All @@ -204,6 +209,9 @@
<Project>{0e072714-d127-460b-afad-b4c40b412798}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="Resources.resx" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets')" />
Expand Down
30 changes: 22 additions & 8 deletions src/modules/powerrename/dll/PowerRenameExt.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Generated Files">
<UniqueIdentifier>{1691b4f2-4b67-4188-9cfd-1ac61e78279f}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="targetver.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="PowerRenameExt.h">
<Filter>Header Files</Filter>
</ClInclude>
Expand All @@ -30,11 +30,12 @@
<ClInclude Include="pch.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="PowerRenameExt.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
<ClInclude Include="Generated Files/resource.h">
<Filter>Generated Files</Filter>
</ClInclude>
<ClInclude Include="resource.base.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="PowerRenameExt.cpp">
Expand All @@ -53,4 +54,17 @@
</None>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Generated Files/PowerRenameExt.rc">
<Filter>Generated Files</Filter>
</ResourceCompile>
<ResourceCompile Include="PowerRenameExt.base.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources.resx">
<Filter>Resource Files</Filter>
</EmbeddedResource>
</ItemGroup>
</Project>
144 changes: 144 additions & 0 deletions src/modules/powerrename/dll/Resources.resx
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="PowerRename" xml:space="preserve">
<value>Po&amp;werRename</value>
</data>
<data name="PowerRename_App_Name" xml:space="preserve">
<value>PowerRename</value>
</data>
<data name="Settings_Description" xml:space="preserve">
<value>A Windows Shell extension for more advanced bulk renaming using search and replace or regular expressions.</value>
</data>
<data name="Restore_Search" xml:space="preserve">
<value>Restore search, replace and flags values on launch from previous run.</value>
</data>
<data name="Enable_Auto" xml:space="preserve">
<value>Enable autocomplete and autosuggest of recently used inputs for search and replace values.</value>
</data>
<data name="Max_Items" xml:space="preserve">
<value>Maximum number of items to show in recently used list for autocomplete dropdown.</value>
</data>
<data name="Icon_Context_Menu" xml:space="preserve">
<value>Show icon on context menu.</value>
</data>
<data name="Extended_Menu_Info" xml:space="preserve">
<value>Only show the PowerRename menu item on the extended context menu (Shift + Right-click).</value>
</data>
</root>
2 changes: 1 addition & 1 deletion src/modules/powerrename/dll/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <trace.h>
#include <common/settings_objects.h>
#include <common/common.h>
#include "resource.h"
#include "Generated Files/resource.h"
#include <atomic>

std::atomic<DWORD> g_dwModuleRefCount = 0;
Expand Down
15 changes: 15 additions & 0 deletions src/modules/powerrename/dll/resource.base.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by PowerRenameExt.rc

//////////////////////////////
// Non-localizable

#define FILE_DESCRIPTION "PowerToys PowerRenameExt"
#define INTERNAL_NAME "PowerRenameExt"
#define ORIGINAL_FILENAME "PowerRenameExt.dll"
#define IDI_RENAME 2001
#define IDS_OVERVIEW_LINK 2002

// Non-localizable
//////////////////////////////
36 changes: 0 additions & 36 deletions src/modules/powerrename/dll/resource.h

This file was deleted.

14 changes: 14 additions & 0 deletions src/modules/powerrename/ui/LocProject.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"Projects": [
{
"LanguageSet": "Azure_Languages",
"LocItems": [
{
"SourceFile": "src\\modules\\powerrename\\ui\\Resources.resx",
"CopyOption": "LangIDOnName",
"OutputPath": "src\\modules\\powerrename\\ui"
}
]
}
]
}
Binary file added src/modules/powerrename/ui/PowerRenameUI.base.rc
Binary file not shown.

0 comments on commit 3ede1a0

Please sign in to comment.