Skip to content
This repository was archived by the owner on Nov 29, 2018. It is now read-only.
This repository was archived by the owner on Nov 29, 2018. It is now read-only.

Resource name is incorrect when not setting Options.ResourcesPath #138

@DamianEdwards

Description

@DamianEdwards

See the line at https://github.com/aspnet/Localization/blob/dev/src/Microsoft.Extensions.Localization/ResourceManagerStringLocalizerFactory.cs#L68

If RequestLocalizationOptions.ResourcesPath is not set (the default) then this will effectively cause the application name to be appended to the beginning of the full type name, thus making it impossible to actually resolve that resource.

This means you can't just create a resx file next to a class' cs file with the same name and have it work, e.g. HomeController.cs and HomeController.en-AU.resx

The line should probably be something like:

var baseName = string.IsNullOrEmpty(_resourcesRelativePath)
                ? typeInfo.FullName
                : _applicationEnvironment.ApplicationName + "." + _resourcesRelativePath + typeInfo.FullName;

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions