* Default ResourcePath behavior is to look next to .cs file

This commit is contained in:
ryanbrandenburg 2015-12-10 17:08:21 -08:00
Родитель 0b013ae769
Коммит 5074bf0c57
4 изменённых файлов: 7 добавлений и 5 удалений

Просмотреть файл

@ -67,7 +67,9 @@ namespace Microsoft.Extensions.Localization
var typeInfo = resourceSource.GetTypeInfo();
var assembly = typeInfo.Assembly;
var baseName = _applicationEnvironment.ApplicationName + "." + _resourcesRelativePath + typeInfo.FullName;
var baseName = string.IsNullOrEmpty(_resourcesRelativePath)
? typeInfo.FullName
: _applicationEnvironment.ApplicationName + "." + _resourcesRelativePath + typeInfo.FullName;
return _localizerCache.GetOrAdd(baseName, _ =>
new ResourceManagerStringLocalizer(

Просмотреть файл

@ -118,6 +118,6 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Hello" xml:space="preserve">
<value>Bonjour from Customer in root folder</value>
<value>Bonjour from Customer in Models folder</value>
</data>
</root>

Просмотреть файл

@ -77,7 +77,7 @@ namespace Microsoft.AspNet.Localization.FunctionalTests
applicationBaseUrl,
"ResourcesAtRootFolder",
"fr-FR",
"Bonjour from StartupResourcesAtRootFolder Bonjour from Test in root folder Bonjour from Customer in root folder");
"Bonjour from StartupResourcesAtRootFolder Bonjour from Test in root folder Bonjour from Customer in Models folder");
}
[ConditionalFact]
@ -92,7 +92,7 @@ namespace Microsoft.AspNet.Localization.FunctionalTests
"http://localhost:5076",
"ResourcesAtRootFolder",
"fr-FR",
"Bonjour from StartupResourcesAtRootFolder Bonjour from Test in root folder Bonjour from Customer in root folder");
"Bonjour from StartupResourcesAtRootFolder Bonjour from Test in root folder Bonjour from Customer in Models folder");
}
[ConditionalFact]
@ -107,7 +107,7 @@ namespace Microsoft.AspNet.Localization.FunctionalTests
"http://localhost:5077/",
"ResourcesAtRootFolder",
"fr-FR",
"Bonjour from StartupResourcesAtRootFolder Bonjour from Test in root folder Bonjour from Customer in root folder");
"Bonjour from StartupResourcesAtRootFolder Bonjour from Test in root folder Bonjour from Customer in Models folder");
}
}
}