diff --git a/sampleapps/BlazorHostedSampleApp/Client/BlazorHostedSampleApp.Client.csproj b/sampleapps/BlazorHostedSampleApp/Client/BlazorHostedSampleApp.Client.csproj index e21eb4a..ec4d5d6 100644 --- a/sampleapps/BlazorHostedSampleApp/Client/BlazorHostedSampleApp.Client.csproj +++ b/sampleapps/BlazorHostedSampleApp/Client/BlazorHostedSampleApp.Client.csproj @@ -20,7 +20,8 @@ - + + diff --git a/sampleapps/BlazorHostedSampleApp/Client/Pages/Index.razor b/sampleapps/BlazorHostedSampleApp/Client/Pages/Index.razor index 4f52c79..721d772 100644 --- a/sampleapps/BlazorHostedSampleApp/Client/Pages/Index.razor +++ b/sampleapps/BlazorHostedSampleApp/Client/Pages/Index.razor @@ -1,4 +1,5 @@ @page "/" +@using SampleAppsShared.Localization Index @@ -7,3 +8,8 @@ This page is using the BlazorWasmAntivirusProtection package. More info here. + + +
+ Resources Test: @StringResources.TestString +
\ No newline at end of file diff --git a/sampleapps/BlazorHostedSampleApp/Client/wwwroot/index.html b/sampleapps/BlazorHostedSampleApp/Client/wwwroot/index.html index 49a2b8a..32f1522 100644 --- a/sampleapps/BlazorHostedSampleApp/Client/wwwroot/index.html +++ b/sampleapps/BlazorHostedSampleApp/Client/wwwroot/index.html @@ -30,7 +30,7 @@ var total = 0; var loaded = 0; var loading = {}; - var culture = "en-US"; + var culture = "el-GR"; Blazor.start({ applicationCulture: culture, loadBootResource: function (type, name, defaultUri, integrity) { diff --git a/sampleapps/SampleAppsShared.Localization/SampleAppsShared.Localization.csproj b/sampleapps/SampleAppsShared.Localization/SampleAppsShared.Localization.csproj new file mode 100644 index 0000000..7ab3be5 --- /dev/null +++ b/sampleapps/SampleAppsShared.Localization/SampleAppsShared.Localization.csproj @@ -0,0 +1,18 @@ + + + + + True + True + StringResources.resx + + + + + + PublicResXFileCodeGenerator + StringResources.Designer.cs + + + + diff --git a/sampleapps/SampleAppsShared.Localization/StringResources.Designer.cs b/sampleapps/SampleAppsShared.Localization/StringResources.Designer.cs new file mode 100644 index 0000000..e94791c --- /dev/null +++ b/sampleapps/SampleAppsShared.Localization/StringResources.Designer.cs @@ -0,0 +1,72 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace SampleAppsShared.Localization { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + public class StringResources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal StringResources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SampleAppsShared.Localization.StringResources", typeof(StringResources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to Test string. + /// + public static string TestString { + get { + return ResourceManager.GetString("TestString", resourceCulture); + } + } + } +} diff --git a/sampleapps/SampleAppsShared.Localization/StringResources.el-GR.resx b/sampleapps/SampleAppsShared.Localization/StringResources.el-GR.resx new file mode 100644 index 0000000..1fead09 --- /dev/null +++ b/sampleapps/SampleAppsShared.Localization/StringResources.el-GR.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Δοκιμαστικό string + + \ No newline at end of file diff --git a/sampleapps/SampleAppsShared.Localization/StringResources.resx b/sampleapps/SampleAppsShared.Localization/StringResources.resx new file mode 100644 index 0000000..48650c0 --- /dev/null +++ b/sampleapps/SampleAppsShared.Localization/StringResources.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Test string + + \ No newline at end of file diff --git a/src/BlazorWasmAntivirusProtection.BrotliCompress/BlazorWasmAntivirusProtection.BrotliCompress.csproj b/src/BlazorWasmAntivirusProtection.BrotliCompress/BlazorWasmAntivirusProtection.BrotliCompress.csproj index 0881506..8260501 100644 --- a/src/BlazorWasmAntivirusProtection.BrotliCompress/BlazorWasmAntivirusProtection.BrotliCompress.csproj +++ b/src/BlazorWasmAntivirusProtection.BrotliCompress/BlazorWasmAntivirusProtection.BrotliCompress.csproj @@ -2,7 +2,7 @@ Exe - net7.0 + net6.0 enable enable diff --git a/src/BlazorWasmAntivirusProtection.Tasks/RecompressSatelliteAssemblies.cs b/src/BlazorWasmAntivirusProtection.Tasks/RecompressSatelliteAssemblies.cs index 4070524..9bc4667 100644 --- a/src/BlazorWasmAntivirusProtection.Tasks/RecompressSatelliteAssemblies.cs +++ b/src/BlazorWasmAntivirusProtection.Tasks/RecompressSatelliteAssemblies.cs @@ -23,9 +23,9 @@ public class RecompressSatelliteAssemblies : Task public override bool Execute() { -#if DEBUG - System.Diagnostics.Debugger.Launch(); -#endif +//#if DEBUG +// System.Diagnostics.Debugger.Launch(); +//#endif Log.LogMessage(MessageImportance.High, $"BlazorWasmAntivirusProtection: Recompressing satellite assemblies"); var frameworkDirs = Directory.GetDirectories(PublishDir, "_framework", SearchOption.AllDirectories); foreach(var frameworkDir in frameworkDirs) @@ -35,16 +35,17 @@ public override bool Execute() if (file.EndsWith(".resources.bin")) { var gzFile = $"{file}.gz"; - var brFile = $"{file}.br"; if (File.Exists(gzFile)) { Log.LogMessage(MessageImportance.High, $"BlazorWasmAntivirusProtection: Recompressing \"{gzFile}\""); if (!Tools.GZipCompress(file, gzFile, Log)) return false; } + + var brFile = $"{file}.br"; if (File.Exists(brFile)) { Log.LogMessage(MessageImportance.High, $"BlazorWasmAntivirusProtection: Recompressing \"{brFile}\""); - if (!Tools.BrotliCompress(file, gzFile, BrotliCompressToolPath, CompressionLevel, Log)) return false; + if (!Tools.BrotliCompress(file, brFile, BrotliCompressToolPath, CompressionLevel, Log)) return false; } } } diff --git a/src/BlazorWasmAntivirusProtection.sln b/src/BlazorWasmAntivirusProtection.sln index ffdda29..532d155 100644 --- a/src/BlazorWasmAntivirusProtection.sln +++ b/src/BlazorWasmAntivirusProtection.sln @@ -51,6 +51,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorHostedSampleLazyLoadi EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorWasmAntivirusProtection.BrotliCompress", "BlazorWasmAntivirusProtection.BrotliCompress\BlazorWasmAntivirusProtection.BrotliCompress.csproj", "{DF24E023-EE53-4C3A-B0A2-927CCD39F2AF}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleAppsShared.Localization", "..\sampleapps\SampleAppsShared.Localization\SampleAppsShared.Localization.csproj", "{4722CCB1-8E90-4DBB-95EA-F7927E254BAB}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{775A9613-79F0-4FE9-B61D-718C352544B8}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -109,6 +113,10 @@ Global {DF24E023-EE53-4C3A-B0A2-927CCD39F2AF}.Debug|Any CPU.Build.0 = Debug|Any CPU {DF24E023-EE53-4C3A-B0A2-927CCD39F2AF}.Release|Any CPU.ActiveCfg = Release|Any CPU {DF24E023-EE53-4C3A-B0A2-927CCD39F2AF}.Release|Any CPU.Build.0 = Release|Any CPU + {4722CCB1-8E90-4DBB-95EA-F7927E254BAB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4722CCB1-8E90-4DBB-95EA-F7927E254BAB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4722CCB1-8E90-4DBB-95EA-F7927E254BAB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4722CCB1-8E90-4DBB-95EA-F7927E254BAB}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -127,6 +135,8 @@ Global {4C7F227E-2E90-4D0B-960D-0247DA937117} = {B8531AC8-E394-4875-AB1F-3167F4C7149C} {B8531AC8-E394-4875-AB1F-3167F4C7149C} = {B6087F3A-2586-4098-BD69-449619BEA560} {D1EC6118-9D76-42C1-9F4B-E9819AEC6472} = {B8531AC8-E394-4875-AB1F-3167F4C7149C} + {4722CCB1-8E90-4DBB-95EA-F7927E254BAB} = {775A9613-79F0-4FE9-B61D-718C352544B8} + {775A9613-79F0-4FE9-B61D-718C352544B8} = {B6087F3A-2586-4098-BD69-449619BEA560} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {8E715717-C14A-4A09-BE07-93EF8245C66C} diff --git a/src/BlazorWasmAntivirusProtection/BlazorWasmAntivirusProtection.csproj b/src/BlazorWasmAntivirusProtection/BlazorWasmAntivirusProtection.csproj index 60767fc..47bfc60 100644 --- a/src/BlazorWasmAntivirusProtection/BlazorWasmAntivirusProtection.csproj +++ b/src/BlazorWasmAntivirusProtection/BlazorWasmAntivirusProtection.csproj @@ -1,7 +1,7 @@  - net7.0 + net6.0 enable enable true @@ -17,7 +17,7 @@ - + @@ -25,9 +25,7 @@ - + @@ -36,12 +34,7 @@ - + diff --git a/src/BlazorWasmAntivirusProtection/build/net7.0/BlazorWasmAntivirusProtection.targets b/src/BlazorWasmAntivirusProtection/build/net6.0/BlazorWasmAntivirusProtection.targets similarity index 96% rename from src/BlazorWasmAntivirusProtection/build/net7.0/BlazorWasmAntivirusProtection.targets rename to src/BlazorWasmAntivirusProtection/build/net6.0/BlazorWasmAntivirusProtection.targets index b115fb3..a5b436a 100644 --- a/src/BlazorWasmAntivirusProtection/build/net7.0/BlazorWasmAntivirusProtection.targets +++ b/src/BlazorWasmAntivirusProtection/build/net6.0/BlazorWasmAntivirusProtection.targets @@ -40,10 +40,10 @@ BlazorEnableCompression="$(BlazorEnableCompression)" CompressionLevel="$(_BlazorBrotliCompressionLevel)" BrotliCompressToolPath="$(_BlazorWAPBrotliCompressDll)"> - + \ No newline at end of file