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

Damianedwards/app prefix #176

Merged
merged 1 commit into from
Dec 16, 2015
Merged

Damianedwards/app prefix #176

merged 1 commit into from
Dec 16, 2015

Conversation

DamianEdwards
Copy link
Member

ResourceManagerStringLocalizerFactory now trims the application name from the start of the type name/location when LocalizationOptions.ResourcesPath is set, so that IStringLocalizer<MyController> will look for resource name MyApplication.Resources.Controllers.MyController instead of MyApplication.Resources.MyApplication.Controllers.MyController
#167

@rynowak @ryanbrandenburg

@@ -69,7 +68,8 @@ public IStringLocalizer Create(Type resourceSource)

var baseName = string.IsNullOrEmpty(_resourcesRelativePath)
? typeInfo.FullName
: _applicationEnvironment.ApplicationName + "." + _resourcesRelativePath + typeInfo.FullName;
: _applicationEnvironment.ApplicationName + "." + _resourcesRelativePath
+ TrimPrefix(typeInfo.FullName, _applicationEnvironment.ApplicationName + ".");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is some ugly code

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't disagree.

@ryanbrandenburg
Copy link
Contributor

Seems fine. :shipit:

@DamianEdwards DamianEdwards force-pushed the damianedwards/app-prefix branch from f769ce6 to e72d3cb Compare December 16, 2015 23:38
…se name:

- Only applies when LocalizationOptions.ResourcesPath is set
- #167
@DamianEdwards DamianEdwards merged commit e72d3cb into dev Dec 16, 2015
@DamianEdwards DamianEdwards deleted the damianedwards/app-prefix branch December 16, 2015 23:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants