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

[Localization] Move PowerToys Run string resources from xaml files to resx #6165

Merged
merged 19 commits into from
Sep 2, 2020
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
3b647c8
Removed xaml files, added resx file and removed references for PowerL…
arjunbalgovind Aug 24, 2020
f472076
Added resx file for wox.plugin
arjunbalgovind Aug 24, 2020
4ac94a4
Moved Calculator resources to resx
arjunbalgovind Aug 24, 2020
f1334a2
Migrated resources for Folder and Indexer plugins
arjunbalgovind Aug 25, 2020
398e8eb
Merge remote-tracking branch 'upstream/master' into user/arbalgov/loc…
arjunbalgovind Aug 25, 2020
75f455b
Migrated resources for Program and Shell plugin
arjunbalgovind Aug 25, 2020
a0e4d0a
Migrated resources for URI and Window Walker
arjunbalgovind Aug 25, 2020
f6f304b
Merge remote-tracking branch 'upstream/master' into user/arbalgov/loc…
arjunbalgovind Aug 25, 2020
f9b895d
Removed GetTranslation, tests need to be refactored
arjunbalgovind Aug 25, 2020
9facdea
Removed internationalization classes
arjunbalgovind Aug 25, 2020
3ca2b1b
Removed Wox.Core.Resource references
arjunbalgovind Aug 25, 2020
ee6d4f8
Fixed Programs plugin tests
arjunbalgovind Aug 25, 2020
5674373
Fixed tests
arjunbalgovind Aug 25, 2020
f4397ad
Removed language xaml files from installer
arjunbalgovind Aug 25, 2020
a1d8197
Added locProject.json files
arjunbalgovind Aug 25, 2020
4247ae5
Fixed resource not found error
arjunbalgovind Aug 25, 2020
7c5b510
Reverted addition of resx file for Wox.Plugin
arjunbalgovind Aug 25, 2020
f2fbf7f
Merge remote-tracking branch 'upstream/master' into user/arbalgov/loc…
arjunbalgovind Sep 2, 2020
347f871
Resolved merge conflicts
arjunbalgovind Sep 2, 2020
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
87 changes: 0 additions & 87 deletions installer/PowerToysSetup/Product.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -873,20 +873,6 @@
<Component Id="calculatorImagesComponent" Directory="CalculatorImagesFolder" Guid="07EC9232-CF9A-4CDB-8D8E-E79DC75096C0">
<File Id="calculatorPluginImg_calculator_light" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Calculator\Images\calculator.light.png" />
<File Id="calculatorPluginImg_calculator_dark" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Calculator\Images\calculator.dark.png" />
</Component>
<Component Id="calculatorLanguagesComponent" Directory="CalculatorLanguagesFolder" Guid="2D8019E7-664F-4529-9FAA-83C8DACF0732">
<?foreach LanguageFile in de.xaml;en.xaml;pl.xaml;tr.xaml;zh-cn.xaml;zh-tw.xaml?>
<!--NB: Ids can't contain hyphens-->
<?if $(var.LanguageFile) = zh-cn.xaml?>
<?define IdSafeLanguage = zh_cn.xaml?>
<?elseif $(var.LanguageFile) = zh-tw.xaml?>
<?define IdSafeLanguage = zh_tw.xaml?>
<?else?>
<?define IdSafeLanguage = $(var.LanguageFile)?>
<?endif?>
<File Id="File_calc_Plugin_$(var.IdSafeLanguage)" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Calculator\Languages\$(var.LanguageFile)" />
<?undef IdSafeLanguage?>
<?endforeach?>
</Component>
<Component Id="calculatorpinyindbComponent" Directory="CalculatorpinyindbFolder" Guid="D5527670-BE9A-4AA9-9D36-1249F2184B5B">
<?foreach File in pinyin_gwoyeu_mapping.xml;pinyin_mapping.xml;unicode_to_hanyu_pinyin.txt?>
Expand All @@ -905,20 +891,6 @@
<File Id="FolderPlugin_$(var.File)" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Folder\Images\$(var.File)" />
<?endforeach?>
</Component>
<Component Id="FolderPluginLanguagesComponent" Directory="FolderPluginLanguagesFolder" Guid="6316D847-5FD2-488B-A60E-5517BF95A25C">
<?foreach LanguageFile in de.xaml;en.xaml;pl.xaml;tr.xaml;zh-cn.xaml;zh-tw.xaml?>
<!--NB: Ids can't contain hyphens-->
<?if $(var.LanguageFile) = zh-cn.xaml?>
<?define IdSafeLanguage = zh_cn.xaml?>
<?elseif $(var.LanguageFile) = zh-tw.xaml?>
<?define IdSafeLanguage = zh_tw.xaml?>
<?else?>
<?define IdSafeLanguage = $(var.LanguageFile)?>
<?endif?>
<File Id="File_Folder_Plugin_$(var.IdSafeLanguage)" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Folder\Languages\$(var.LanguageFile)" />
<?undef IdSafeLanguage?>
<?endforeach?>
</Component>
<Component Id="FolderPluginpinyindbComponent" Directory="FolderPluginpinyindbFolder" Guid="233BE087-B9DC-408A-8809-593C42DE8B1B">
<?foreach File in pinyin_gwoyeu_mapping.xml;pinyin_mapping.xml;unicode_to_hanyu_pinyin.txt?>
<File Id="FolderPlugin_$(var.File)" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Folder\pinyindb\$(var.File)" />
Expand All @@ -935,20 +907,6 @@
<?foreach File in app.dark.png;app.light.png;disable.light.png;disable.dark.png;folder.light.png;folder.dark.png;shell.light.png;shell.dark.png;user.light.png;user.dark.png?>
<File Id="Program_$(var.File)" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Program\Images\$(var.File)" />
<?endforeach?>
</Component>
<Component Id="ProgramLanguagesComponent" Directory="ProgramLanguagesFolder" Guid="EBFF53B6-3602-4F55-8784-FC7DB29D3D62">
<?foreach LanguageFile in de.xaml;en.xaml;pl.xaml;tr.xaml;zh-cn.xaml;zh-tw.xaml?>
<!--NB: Ids can't contain hyphens-->
<?if $(var.LanguageFile) = zh-cn.xaml?>
<?define IdSafeLanguage = zh_cn.xaml?>
<?elseif $(var.LanguageFile) = zh-tw.xaml?>
<?define IdSafeLanguage = zh_tw.xaml?>
<?else?>
<?define IdSafeLanguage = $(var.LanguageFile)?>
<?endif?>
<File Id="File_Program_Plugin_$(var.IdSafeLanguage)" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Program\Languages\$(var.LanguageFile)" />
<?undef IdSafeLanguage?>
<?endforeach?>
</Component>
<Component Id="ProgrampinyindbComponent" Directory="ProgrampinyindbFolder" Guid="65A488C3-C67D-45F7-9654-6DF529AEEB3F">
<?foreach File in pinyin_gwoyeu_mapping.xml;pinyin_mapping.xml;unicode_to_hanyu_pinyin.txt?>
Expand All @@ -966,20 +924,6 @@
<?foreach File in shell.light.png;shell.dark.png;user.light.png;user.dark.png?>
<File Id="Shell_$(var.File)" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Shell\Images\$(var.File)" />
<?endforeach?>
</Component>
<Component Id="ShellLanguagesComponent" Directory="ShellLanguagesFolder" Guid="4190F789-8A66-46AA-B920-C76CB29277D7">
<?foreach LanguageFile in de.xaml;en.xaml;pl.xaml;tr.xaml;zh-cn.xaml;zh-tw.xaml?>
<!--NB: Ids can't contain hyphens-->
<?if $(var.LanguageFile) = zh-cn.xaml?>
<?define IdSafeLanguage = zh_cn.xaml?>
<?elseif $(var.LanguageFile) = zh-tw.xaml?>
<?define IdSafeLanguage = zh_tw.xaml?>
<?else?>
<?define IdSafeLanguage = $(var.LanguageFile)?>
<?endif?>
<File Id="File_Shell_Plugin_$(var.IdSafeLanguage)" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Shell\Languages\$(var.LanguageFile)" />
<?undef IdSafeLanguage?>
<?endforeach?>
</Component>
<Component Id="ShellpinyindbComponent" Directory="ShellpinyindbFolder" Guid="A60742F3-2187-47F2-A5B5-300E44837DD7">
<?foreach File in pinyin_gwoyeu_mapping.xml;pinyin_mapping.xml;unicode_to_hanyu_pinyin.txt?>
Expand All @@ -998,20 +942,6 @@
<File Id="Indexer_$(var.File)" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Indexer\Images\$(var.File)" />
<?endforeach?>
</Component>
<Component Id="IndexerLanguagesComponent" Directory="IndexerLanguagesFolder" Guid="4B5ED306-7DD5-4EA6-9DBB-CF054929182C">
<?foreach LanguageFile in de.xaml;en.xaml;ja.xaml;pl.xaml;tr.xaml;zh-cn.xaml;zh-tw.xaml?>
<!--NB: Ids can't contain hyphens-->
<?if $(var.LanguageFile) = zh-cn.xaml?>
<?define IdSafeLanguage = zh_cn.xaml?>
<?elseif $(var.LanguageFile) = zh-tw.xaml?>
<?define IdSafeLanguage = zh_tw.xaml?>
<?else?>
<?define IdSafeLanguage = $(var.LanguageFile)?>
<?endif?>
<File Id="Indexer_Plugin_$(var.IdSafeLanguage)" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Indexer\Languages\$(var.LanguageFile)" />
<?undef IdSafeLanguage?>
<?endforeach?>
</Component>
<Component Id="IndexerpinyindbComponent" Directory="IndexerpinyindbFolder" Guid="48DE333A-80F8-400A-87F4-244DF0A2DB05">
<?foreach File in pinyin_gwoyeu_mapping.xml;pinyin_mapping.xml;unicode_to_hanyu_pinyin.txt?>
<File Id="IndexerPlugin_$(var.File)" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Indexer\pinyindb\$(var.File)" />
Expand All @@ -1028,20 +958,6 @@
<File Id="UriDarkIcon" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Uri\Images\Uri.dark.png" />
<File Id="UriLightIcon" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Uri\Images\Uri.light.png" />
</Component>
<Component Id="UriLanguagesComponent" Directory="UriLanguagesFolder" Guid="4CA9CECE-BB93-4686-A58F-35835F5C3F7D">
<?foreach LanguageFile in de.xaml;en.xaml;pl.xaml;tr.xaml;zh-cn.xaml;zh-tw.xaml?>
<!--NB: Ids can't contain hyphens-->
<?if $(var.LanguageFile) = zh-cn.xaml?>
<?define IdSafeLanguage = zh_cn.xaml?>
<?elseif $(var.LanguageFile) = zh-tw.xaml?>
<?define IdSafeLanguage = zh_tw.xaml?>
<?else?>
<?define IdSafeLanguage = $(var.LanguageFile)?>
<?endif?>
<File Id="File_Uri_Plugin_$(var.IdSafeLanguage)" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Uri\Languages\$(var.LanguageFile)" />
<?undef IdSafeLanguage?>
<?endforeach?>
</Component>
<Component Id="UripinyindbComponent" Directory="UripinyindbFolder" Guid="A52A7281-CD7C-4E7D-A5A6-EA8CFCF462A2">
<?foreach File in pinyin_gwoyeu_mapping.xml;pinyin_mapping.xml;unicode_to_hanyu_pinyin.txt?>
<File Id="UriPlugin_$(var.File)" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Uri\pinyindb\$(var.File)" />
Expand All @@ -1058,9 +974,6 @@
<File Id="WindowWalkerDarkIcon" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.WindowWalker\Images\windowwalker.dark.png" />
<File Id="WindowWalkerLightIcon" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.WindowWalker\Images\windowwalker.light.png" />
</Component>
<Component Id="WindowWalkerLanguagesComponent" Directory="WindowWalkerLanguagesFolder" Guid="7D9471D9-5C0A-4BD1-9A01-BAB65DD58834">
<File Id="WindowWalkerLanguage" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.WindowWalker\Languages\en.xaml" />
</Component>
<Component Id="WindowWalkerpinyindbComponent" Directory="WindowWalkerpinyindbFolder" Guid="02C7A758-CDD4-4E27-9EC7-2ED68DC444B0">
<?foreach File in pinyin_gwoyeu_mapping.xml;pinyin_mapping.xml;unicode_to_hanyu_pinyin.txt?>
<File Id="WindowWalkerPlugin_$(var.File)" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.WindowWalker\pinyindb\$(var.File)" />
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"Projects": [
{
"LanguageSet": "Azure_Languages",
"LocItems": [
{
"SourceFile": "src\\modules\\launcher\\Plugins\\Microsoft.Plugin.Calculator\\Properties\\Resources.resx",
"CopyOption": "LangIDOnName",
"OutputPath": "src\\modules\\launcher\\Plugins\\Microsoft.Plugin.Calculator\\Properties"
}
]
}
]
}
12 changes: 6 additions & 6 deletions src/modules/launcher/Plugins/Microsoft.Plugin.Calculator/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ public List<Result> Query(Query query)

if (result.ToString() == "NaN")
{
result = Context.API.GetTranslation("wox_plugin_calculator_not_a_number");
result = Properties.Resources.wox_plugin_calculator_not_a_number;
}

if (result is Function)
{
result = Context.API.GetTranslation("wox_plugin_calculator_expression_not_complete");
result = Properties.Resources.wox_plugin_calculator_expression_not_complete;
}

if (!string.IsNullOrEmpty(result?.ToString()))
Expand All @@ -81,7 +81,7 @@ public List<Result> Query(Query query)
Title = roundedResult.ToString(CultureInfo.CurrentCulture),
IcoPath = IconPath,
Score = 300,
SubTitle = Context.API.GetTranslation("wox_plugin_calculator_copy_number_to_clipboard"),
SubTitle = Properties.Resources.wox_plugin_calculator_copy_number_to_clipboard,
Action = c =>
{
var ret = false;
Expand All @@ -94,7 +94,7 @@ public List<Result> Query(Query query)
}
catch (ExternalException)
{
MessageBox.Show("Copy failed, please try later");
MessageBox.Show(Properties.Resources.wox_plugin_calculator_copy_failed);
}
});
thread.SetApartmentState(ApartmentState.STA);
Expand Down Expand Up @@ -167,12 +167,12 @@ private void OnThemeChanged(Theme currentTheme, Theme newTheme)

public string GetTranslatedPluginTitle()
{
return Context.API.GetTranslation("wox_plugin_calculator_plugin_name");
return Properties.Resources.wox_plugin_calculator_plugin_name;
}

public string GetTranslatedPluginDescription()
{
return Context.API.GetTranslation("wox_plugin_calculator_plugin_description");
return Properties.Resources.wox_plugin_calculator_plugin_description;
}

public void Dispose()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<Platforms>x64</Platforms>
<NeutralLanguage>en-US</NeutralLanguage>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
Expand Down Expand Up @@ -39,6 +40,13 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<WarningLevel>4</WarningLevel>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Languages\**" />
<EmbeddedResource Remove="Languages\**" />
<None Remove="Languages\**" />
<Page Remove="Languages\**" />
</ItemGroup>

<ItemGroup>
<None Include="plugin.json">
Expand All @@ -50,53 +58,6 @@
<ProjectReference Include="..\..\Wox.Infrastructure\Wox.Infrastructure.csproj" />
<ProjectReference Include="..\..\Wox.Plugin\Wox.Plugin.csproj" />
</ItemGroup>
<ItemGroup>
<Content Include="Languages\en.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

<ItemGroup>
<Content Include="Languages\zh-cn.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

<ItemGroup>
<Content Include="Languages\zh-tw.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

<ItemGroup>
<Content Include="Languages\de.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

<ItemGroup>
<Content Include="Languages\pl.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

<ItemGroup>
<Content Include="Languages\tr.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2020.1.0" />
Expand Down Expand Up @@ -133,4 +94,17 @@
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
</Project>
Loading