damienbod / AspNetCoreLocalization

Localization.SqlLocalizer & ASP.NET Core MVC Localization Examples
http://damienbod.com/2015/10/21/asp-net-5-mvc-6-localization/
MIT License
251 stars 101 forks source link

When all resx files have culture it does not work #3

Closed JoeOM closed 8 years ago

JoeOM commented 8 years ago

Dear Damien

I read through your post on github asp.net localization and totally agree with you on the stupid empty class etc. I did open my own ticket as it seems it still does not work... With your example I have made a few changes to demonstrate. Please see image for what I did. :)

If you agree with me please add your voice on that post as well. We should stop this localization rookie absurdity.

test

damienbod commented 8 years ago

Hi Joe

Looks ok.

Three possible causes:

Greetings Damien

chemitaxis commented 8 years ago

I have exactly same error here...

chemitaxis commented 8 years ago

Ok, I solved it... I will do a full complete example tomorrow.

I have created a _ViewImports, and add it:

@addTagHelper "*, Microsoft.AspNet.Mvc.TagHelpers"
@using System.Threading.Tasks
@using AspNet5Localization
@using AspNet5Localization.Resources
@using Microsoft.AspNet.Mvc.Localization
@using Microsoft.Extensions.Localization
@inject IStringLocalizer<AmazingResource> SR

After, I have created a HomeController and Views/Home/Index.cshlm file.

Like I have injected in my Views the IStringLocalizer SR I can use it in my Razor Views using just:

@SR["Name"]

Thanks for this amazing example... Great works!!

ianido commented 8 years ago

I know is April now and maybe this implementation is not updated, but I loaded the example, running it but it never get the data from the localized resource, actually I couldn't found any example on the web in which localization works. Could you give me a path?

You talked about Designer file (autogenerated per resource) actually my Vs is not generating those files, unless I create a new resx file by myself.

damienbod commented 8 years ago

Hi @israelito3000

This example does work, but only when started from the console. The Visual Studio tooling bugs are still not fixed. Once RC2 is released, I will update this repo. Localization will not work correctly, until RC2 is released.

Hope this helps

Greetings Damien

damienbod commented 8 years ago

Fixed now in RC2 tooling