Skip to content

Commit 15938a1

Browse files
[Localization] Migrate resources to resx for Shortcut Guide (#6104)
* 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 * Migrated shortcut guide resources to resx * Added LocProject.json
1 parent f2cfd90 commit 15938a1

11 files changed

+230
-42
lines changed
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"Projects": [
3+
{
4+
"LanguageSet": "Azure_Languages",
5+
"LocItems": [
6+
{
7+
"SourceFile": "src\\modules\\shortcut_guide\\Resources.resx",
8+
"CopyOption": "LangIDOnName",
9+
"OutputPath": "src\\modules\\shortcut_guide"
10+
}
11+
]
12+
}
13+
]
14+
}
+174
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<root>
3+
<!--
4+
Microsoft ResX Schema
5+
6+
Version 2.0
7+
8+
The primary goals of this format is to allow a simple XML format
9+
that is mostly human readable. The generation and parsing of the
10+
various data types are done through the TypeConverter classes
11+
associated with the data types.
12+
13+
Example:
14+
15+
... ado.net/XML headers & schema ...
16+
<resheader name="resmimetype">text/microsoft-resx</resheader>
17+
<resheader name="version">2.0</resheader>
18+
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19+
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20+
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21+
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22+
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23+
<value>[base64 mime encoded serialized .NET Framework object]</value>
24+
</data>
25+
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26+
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27+
<comment>This is a comment</comment>
28+
</data>
29+
30+
There are any number of "resheader" rows that contain simple
31+
name/value pairs.
32+
33+
Each data row contains a name, and value. The row also contains a
34+
type or mimetype. Type corresponds to a .NET class that support
35+
text/value conversion through the TypeConverter architecture.
36+
Classes that don't support this are serialized and stored with the
37+
mimetype set.
38+
39+
The mimetype is used for serialized objects, and tells the
40+
ResXResourceReader how to depersist the object. This is currently not
41+
extensible. For a given mimetype the value must be set accordingly:
42+
43+
Note - application/x-microsoft.net.object.binary.base64 is the format
44+
that the ResXResourceWriter will generate, however the reader can
45+
read any of the formats listed below.
46+
47+
mimetype: application/x-microsoft.net.object.binary.base64
48+
value : The object must be serialized with
49+
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50+
: and then encoded with base64 encoding.
51+
52+
mimetype: application/x-microsoft.net.object.soap.base64
53+
value : The object must be serialized with
54+
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55+
: and then encoded with base64 encoding.
56+
57+
mimetype: application/x-microsoft.net.object.bytearray.base64
58+
value : The object must be serialized into a byte array
59+
: using a System.ComponentModel.TypeConverter
60+
: and then encoded with base64 encoding.
61+
-->
62+
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63+
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64+
<xsd:element name="root" msdata:IsDataSet="true">
65+
<xsd:complexType>
66+
<xsd:choice maxOccurs="unbounded">
67+
<xsd:element name="metadata">
68+
<xsd:complexType>
69+
<xsd:sequence>
70+
<xsd:element name="value" type="xsd:string" minOccurs="0" />
71+
</xsd:sequence>
72+
<xsd:attribute name="name" use="required" type="xsd:string" />
73+
<xsd:attribute name="type" type="xsd:string" />
74+
<xsd:attribute name="mimetype" type="xsd:string" />
75+
<xsd:attribute ref="xml:space" />
76+
</xsd:complexType>
77+
</xsd:element>
78+
<xsd:element name="assembly">
79+
<xsd:complexType>
80+
<xsd:attribute name="alias" type="xsd:string" />
81+
<xsd:attribute name="name" type="xsd:string" />
82+
</xsd:complexType>
83+
</xsd:element>
84+
<xsd:element name="data">
85+
<xsd:complexType>
86+
<xsd:sequence>
87+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88+
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89+
</xsd:sequence>
90+
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91+
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92+
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93+
<xsd:attribute ref="xml:space" />
94+
</xsd:complexType>
95+
</xsd:element>
96+
<xsd:element name="resheader">
97+
<xsd:complexType>
98+
<xsd:sequence>
99+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100+
</xsd:sequence>
101+
<xsd:attribute name="name" type="xsd:string" use="required" />
102+
</xsd:complexType>
103+
</xsd:element>
104+
</xsd:choice>
105+
</xsd:complexType>
106+
</xsd:element>
107+
</xsd:schema>
108+
<resheader name="resmimetype">
109+
<value>text/microsoft-resx</value>
110+
</resheader>
111+
<resheader name="version">
112+
<value>2.0</value>
113+
</resheader>
114+
<resheader name="reader">
115+
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116+
</resheader>
117+
<resheader name="writer">
118+
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119+
</resheader>
120+
<data name="Setting_Description_Press_Time" xml:space="preserve">
121+
<value>How long to press the Windows key before showing the Shortcut Guide (ms)</value>
122+
</data>
123+
<data name="Setting_Description_Overlay_Opacity" xml:space="preserve">
124+
<value>Opacity of the Shortcut Guide's overlay background (%)</value>
125+
</data>
126+
<data name="Setting_Description_Theme" xml:space="preserve">
127+
<value>Choose Shortcut Guide overlay color</value>
128+
</data>
129+
<data name="Setting_Description_Theme_Light" xml:space="preserve">
130+
<value>Light</value>
131+
</data>
132+
<data name="Setting_Description_Theme_Dark" xml:space="preserve">
133+
<value>Dark</value>
134+
</data>
135+
<data name="Setting_Description_Theme_System" xml:space="preserve">
136+
<value>System default app mode</value>
137+
</data>
138+
<data name="Settings_Description" xml:space="preserve">
139+
<value>Shows a help overlay with Windows shortcuts when the Windows key is pressed.</value>
140+
</data>
141+
<data name="Shortcut_Guide" xml:space="preserve">
142+
<value>Shortcut Guide</value>
143+
</data>
144+
<data name="No_Action" xml:space="preserve">
145+
<value>No action</value>
146+
</data>
147+
<data name="Restore" xml:space="preserve">
148+
<value>Restore</value>
149+
</data>
150+
<data name="Snap_Right" xml:space="preserve">
151+
<value>Snap right</value>
152+
</data>
153+
<data name="Snap_Left" xml:space="preserve">
154+
<value>Snap left</value>
155+
</data>
156+
<data name="Snap_Upper_Right" xml:space="preserve">
157+
<value>Snap upper right</value>
158+
</data>
159+
<data name="Snap_Upper_Left" xml:space="preserve">
160+
<value>Snap upper left</value>
161+
</data>
162+
<data name="Snap_Lower_Right" xml:space="preserve">
163+
<value>Snap lower right</value>
164+
</data>
165+
<data name="Snap_Lower_Left" xml:space="preserve">
166+
<value>Snap lower left</value>
167+
</data>
168+
<data name="Minimize" xml:space="preserve">
169+
<value>Minimize</value>
170+
</data>
171+
<data name="Maximize" xml:space="preserve">
172+
<value>Maximize</value>
173+
</data>
174+
</root>

src/modules/shortcut_guide/overlay_window.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include "keyboard_state.h"
77
#include "shortcut_guide.h"
88
#include "trace.h"
9-
#include "resource.h"
9+
#include "Generated Files/resource.h"
1010
#include <common/common.h>
1111

1212
extern "C" IMAGE_DOS_HEADER __ImageBase;
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//{{NO_DEPENDENCIES}}
2+
// Microsoft Visual C++ generated include file.
3+
// Used by ShortcutGuide.rc
4+
5+
//////////////////////////////
6+
// Non-localizable
7+
8+
#define FILE_DESCRIPTION "PowerToys ShortcutGuide"
9+
#define INTERNAL_NAME "ShortcutGuide"
10+
#define ORIGINAL_FILENAME "ShortcutGuide.dll"
11+
12+
// Non-localizable
13+
//////////////////////////////

src/modules/shortcut_guide/resource.h

-32
This file was deleted.
Binary file not shown.

src/modules/shortcut_guide/shortcut_guide.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#include "shortcut_guide.h"
33
#include "target_state.h"
44
#include "trace.h"
5-
#include "resource.h"
65

76
#include <common/common.h>
87
#include <common/settings_objects.h>

src/modules/shortcut_guide/shortcut_guide.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include <interface/powertoy_module_interface.h>
33
#include "overlay_window.h"
44

5-
#include "resource.h"
5+
#include "Generated Files/resource.h"
66

77
#include <common/LowlevelKeyboardEvent.h>
88

-4.03 KB
Binary file not shown.

src/modules/shortcut_guide/shortcut_guide.vcxproj

+10-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
<Platform>x64</Platform>
1212
</ProjectConfiguration>
1313
</ItemGroup>
14+
<Target Name="GenerateResourceFiles" BeforeTargets="PrepareForBuild">
15+
<Exec Command="powershell -NonInteractive -executionpolicy Unrestricted $(SolutionDir)tools\build\convert-resx-to-rc.ps1 . resource.base.h resource.h shortcut_guide.base.rc shortcut_guide.rc" />
16+
</Target>
1417
<PropertyGroup Label="Globals">
1518
<VCProjectVersion>15.0</VCProjectVersion>
1619
<ProjectGuid>{A46629C4-1A6C-40FA-A8B6-10E5102BB0BA}</ProjectGuid>
@@ -104,7 +107,8 @@
104107
<ItemGroup>
105108
<ClInclude Include="overlay_window.h" />
106109
<ClInclude Include="keyboard_state.h" />
107-
<ClInclude Include="resource.h" />
110+
<ClInclude Include="Generated Files/resource.h" />
111+
<None Include="resource.base.h" />
108112
<ClInclude Include="shortcut_guide.h" />
109113
<ClInclude Include="pch.h" />
110114
<ClInclude Include="target_state.h" />
@@ -127,11 +131,15 @@
127131
</ProjectReference>
128132
</ItemGroup>
129133
<ItemGroup>
130-
<ResourceCompile Include="shortcut_guide.rc" />
134+
<ResourceCompile Include="Generated Files/shortcut_guide.rc" />
135+
<None Include="shortcut_guide.base.rc" />
131136
</ItemGroup>
132137
<ItemGroup>
133138
<None Include="packages.config" />
134139
</ItemGroup>
140+
<ItemGroup>
141+
<None Include="Resources.resx" />
142+
</ItemGroup>
135143
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
136144
<ImportGroup Label="ExtensionTargets">
137145
<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')" />

src/modules/shortcut_guide/shortcut_guide.vcxproj.filters

+17-5
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
<ClInclude Include="trace.h">
3737
<Filter>Header Files</Filter>
3838
</ClInclude>
39-
<ClInclude Include="resource.h">
40-
<Filter>Header Files</Filter>
39+
<ClInclude Include="Generated Files/resource.h">
40+
<Filter>Generated Files</Filter>
4141
</ClInclude>
4242
</ItemGroup>
4343
<ItemGroup>
@@ -50,13 +50,25 @@
5050
<Filter Include="Resource Files">
5151
<UniqueIdentifier>{d7932c11-20ad-4625-adbc-0780ea5e308d}</UniqueIdentifier>
5252
</Filter>
53+
<Filter Include="Generated Files">
54+
<UniqueIdentifier>{41a2f27e-76b5-4799-94c3-90a33a71786b}</UniqueIdentifier>
55+
</Filter>
5356
</ItemGroup>
5457
<ItemGroup>
55-
<ResourceCompile Include="shortcut_guide.rc">
58+
<None Include="packages.config" />
59+
<None Include="Resources.resx">
5660
<Filter>Resource Files</Filter>
57-
</ResourceCompile>
61+
</None>
62+
<None Include="shortcut_guide.base.rc">
63+
<Filter>Resource Files</Filter>
64+
</None>
65+
<None Include="resource.base.h">
66+
<Filter>Header Files</Filter>
67+
</None>
5868
</ItemGroup>
5969
<ItemGroup>
60-
<None Include="packages.config" />
70+
<ResourceCompile Include="Generated Files/shortcut_guide.rc">
71+
<Filter>Generated Files</Filter>
72+
</ResourceCompile>
6173
</ItemGroup>
6274
</Project>

0 commit comments

Comments
 (0)