diff --git a/src/Microsoft.Extensions.Localization/ResourceManagerStringLocalizerFactory.cs b/src/Microsoft.Extensions.Localization/ResourceManagerStringLocalizerFactory.cs index a77d3a7431..a5ba5da370 100644 --- a/src/Microsoft.Extensions.Localization/ResourceManagerStringLocalizerFactory.cs +++ b/src/Microsoft.Extensions.Localization/ResourceManagerStringLocalizerFactory.cs @@ -64,7 +64,8 @@ namespace Microsoft.Extensions.Localization var typeInfo = resourceSource.GetTypeInfo(); var assembly = typeInfo.Assembly; - var baseName = _applicationEnvironment.ApplicationName + "." + _resourcesRelativePath + resourceSource.Name; + + var baseName = _applicationEnvironment.ApplicationName + "." + _resourcesRelativePath + typeInfo.FullName; return new ResourceManagerStringLocalizer( new ResourceManager(baseName, assembly), diff --git a/test/LocalizationWebsite/LocalizationWebsite.Models.Customer.fr-FR.resx b/test/LocalizationWebsite/LocalizationWebsite.Models.Customer.fr-FR.resx new file mode 100644 index 0000000000..a3a0136dd4 --- /dev/null +++ b/test/LocalizationWebsite/LocalizationWebsite.Models.Customer.fr-FR.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 + + + Bonjour from Customer in root folder + + \ No newline at end of file diff --git a/test/LocalizationWebsite/StartupResourcesAtRootFolder.fr-FR.resx b/test/LocalizationWebsite/LocalizationWebsite.StartupResourcesAtRootFolder.fr-FR.resx similarity index 100% rename from test/LocalizationWebsite/StartupResourcesAtRootFolder.fr-FR.resx rename to test/LocalizationWebsite/LocalizationWebsite.StartupResourcesAtRootFolder.fr-FR.resx diff --git a/test/LocalizationWebsite/Models/Customer.cs b/test/LocalizationWebsite/Models/Customer.cs new file mode 100644 index 0000000000..7d3447df72 --- /dev/null +++ b/test/LocalizationWebsite/Models/Customer.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace LocalizationWebsite.Models +{ + public class Customer + { + } +} diff --git a/test/LocalizationWebsite/Resources/LocalizationWebsite.Models.Customer.fr-FR.resx b/test/LocalizationWebsite/Resources/LocalizationWebsite.Models.Customer.fr-FR.resx new file mode 100644 index 0000000000..9fac05738c --- /dev/null +++ b/test/LocalizationWebsite/Resources/LocalizationWebsite.Models.Customer.fr-FR.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 + + + Bonjour from Customer in resources folder + + \ No newline at end of file diff --git a/test/LocalizationWebsite/Resources/StartupResourcesInFolder.fr-FR.resx b/test/LocalizationWebsite/Resources/LocalizationWebsite.StartupResourcesInFolder.fr-FR.resx similarity index 100% rename from test/LocalizationWebsite/Resources/StartupResourcesInFolder.fr-FR.resx rename to test/LocalizationWebsite/Resources/LocalizationWebsite.StartupResourcesInFolder.fr-FR.resx diff --git a/test/LocalizationWebsite/StartupResourcesAtRootFolder.cs b/test/LocalizationWebsite/StartupResourcesAtRootFolder.cs index 79f58625ef..20e91e44d6 100644 --- a/test/LocalizationWebsite/StartupResourcesAtRootFolder.cs +++ b/test/LocalizationWebsite/StartupResourcesAtRootFolder.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using LocalizationWebsite.Models; using Microsoft.AspNet.Builder; using Microsoft.AspNet.Http; using Microsoft.Extensions.DependencyInjection; @@ -20,7 +21,8 @@ namespace LocalizationWebsite IApplicationBuilder app, ILoggerFactory loggerFactory, IStringLocalizerFactory stringLocalizerFactory, - IStringLocalizer startupStringLocalizer) + IStringLocalizer startupStringLocalizer, + IStringLocalizer customerStringLocalizer) { loggerFactory.AddConsole(minLevel: LogLevel.Warning); @@ -33,6 +35,8 @@ namespace LocalizationWebsite await context.Response.WriteAsync(startupStringLocalizer["Hello"]); await context.Response.WriteAsync(" "); await context.Response.WriteAsync(stringLocalizer["Hello"]); + await context.Response.WriteAsync(" "); + await context.Response.WriteAsync(customerStringLocalizer["Hello"]); }); } } diff --git a/test/LocalizationWebsite/StartupResourcesInFolder.cs b/test/LocalizationWebsite/StartupResourcesInFolder.cs index 75158873a1..2df33ef997 100644 --- a/test/LocalizationWebsite/StartupResourcesInFolder.cs +++ b/test/LocalizationWebsite/StartupResourcesInFolder.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using LocalizationWebsite.Models; using Microsoft.AspNet.Builder; using Microsoft.AspNet.Http; using Microsoft.Extensions.DependencyInjection; @@ -20,7 +21,8 @@ namespace LocalizationWebsite IApplicationBuilder app, ILoggerFactory loggerFactory, IStringLocalizerFactory stringLocalizerFactory, - IStringLocalizer startupStringLocalizer) + IStringLocalizer startupStringLocalizer, + IStringLocalizer custromerStringLocalizer) { loggerFactory.AddConsole(minLevel: LogLevel.Warning); @@ -33,6 +35,8 @@ namespace LocalizationWebsite await context.Response.WriteAsync(startupStringLocalizer["Hello"]); await context.Response.WriteAsync(" "); await context.Response.WriteAsync(stringLocalizer["Hello"]); + await context.Response.WriteAsync(" "); + await context.Response.WriteAsync(custromerStringLocalizer["Hello"]); }); } } diff --git a/test/Microsoft.AspNet.Localization.FunctionalTests/LocalizationTest.cs b/test/Microsoft.AspNet.Localization.FunctionalTests/LocalizationTest.cs index a33c69b21e..d1ef581544 100644 --- a/test/Microsoft.AspNet.Localization.FunctionalTests/LocalizationTest.cs +++ b/test/Microsoft.AspNet.Localization.FunctionalTests/LocalizationTest.cs @@ -27,7 +27,7 @@ namespace Microsoft.AspNet.Localization.FunctionalTests applicationBaseUrl, "ResourcesInFolder", "fr-FR", - "Bonjour from StartupResourcesInFolder Bonjour from Test in resources folder"); + "Bonjour from StartupResourcesInFolder Bonjour from Test in resources folder Bonjour from Customer in resources folder"); } [ConditionalTheory] @@ -46,7 +46,7 @@ namespace Microsoft.AspNet.Localization.FunctionalTests applicationBaseUrl, "ResourcesInFolder", "fr-FR", - "Bonjour from StartupResourcesInFolder Bonjour from Test in resources folder"); + "Bonjour from StartupResourcesInFolder Bonjour from Test in resources folder Bonjour from Customer in resources folder"); } [ConditionalTheory] @@ -66,7 +66,7 @@ namespace Microsoft.AspNet.Localization.FunctionalTests applicationBaseUrl, "ResourcesAtRootFolder", "fr-FR", - "Bonjour from StartupResourcesAtRootFolder Bonjour from Test in root folder"); + "Bonjour from StartupResourcesAtRootFolder Bonjour from Test in root folder Bonjour from Customer in root folder"); } [ConditionalTheory] @@ -85,7 +85,7 @@ namespace Microsoft.AspNet.Localization.FunctionalTests applicationBaseUrl, "ResourcesAtRootFolder", "fr-FR", - "Bonjour from StartupResourcesAtRootFolder Bonjour from Test in root folder"); + "Bonjour from StartupResourcesAtRootFolder Bonjour from Test in root folder Bonjour from Customer in root folder"); } } }