-
-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support MVC view localization #71
Comments
Hi @superware, thanks for raising this issue. Yes, this may make sense for the web apps. I haven't worked on localization before. So I'll need to play around with this a bit to see how this can be incorporated into this library. |
Hi @soundaranbu, that will be great. IMHO it should be quite easy, the bottom line is looping through possible view-expanded locations until the first one is found - and use that one for rendering. So if view-localization is enabled (either through the framework or through configuring Shouldn't be a breaking change since if no localized/expanded view is found then the original view will be used. Thank you for your great work. |
Hello,
After configuring:
MVC will locate and use the view
Views/Home/Index.fr.cshtml
since the locating mechanism is searching for the correct view file using theController
andView
names, but_razorTemplateEngine.RenderAsync("/Views/Home/Index.cshtml")
obviously doesn't support localization.So one way is to explicitly render
/Views/EmailTemplates/ConfirmEmail.fr.cshtml
which is totally lame, but a better way will be to do all that automatically. So a French user registering the web app will receive the French confirmation email.It will be awesome if localization support can be added, my guess by internally detecting
AddViewLocalization
andLanguageViewLocationExpanderFormat.Suffix
, and when rendering maybe use LanguageViewLocationExpander to yield all possible localized views andFindView
until found. I guess/Views/Home/Index.cshtml
can be internally transformed to/Views/Home/{0}.cshtml
for this case (ExpandViewLocations
).Any thoughts?
The text was updated successfully, but these errors were encountered: