GithubHelp home page GithubHelp logo

Comments (17)

hishamco avatar hishamco commented on July 20, 2024 4

Localization should come first, so anything after should be aware of the localization APIs, hope the sample is working with you

from my.extensions.localization.json.

hishamco avatar hishamco commented on July 20, 2024 2

I think it will not make difference either Web API, MVC or Razor Pages

from my.extensions.localization.json.

hishamco avatar hishamco commented on July 20, 2024 2

It works with me with two changes ;)

services.AddJsonLocalization(opt => opt.ResourcesPath = "Resources");

services.AddControllers()
    .AddDataAnnotationsLocalization(options =>
    {
        options.DataAnnotationLocalizerProvider = (type, factory) =>
            factory.Create(typeof(Validation));
    });

from my.extensions.localization.json.

hishamco avatar hishamco commented on July 20, 2024 1

Ok, no worry I will have a look or provide a sample in the repo soon

from my.extensions.localization.json.

hishamco avatar hishamco commented on July 20, 2024 1

@HamedFathi you could try my PR #59, I added a data annotation support to the MVC sample it should work with other applications type too

from my.extensions.localization.json.

hishamco avatar hishamco commented on July 20, 2024 1

At the first glance no need to provide a full path for the resources folder, just make it "Resources" if it not working I will check your repo on my laptop and see what's going on

from my.extensions.localization.json.

hishamco avatar hishamco commented on July 20, 2024

Of course it's possible, I remembered this had been triggered by @Muhammad-Altabba long time ago in #9, you could have a look to #2 for more information

Please let me know if you face any issue, it should work as it works in ResourceManager

from my.extensions.localization.json.

HamedFathi avatar HamedFathi commented on July 20, 2024

Honestly, I tried but failed and built a repository. Can anyone help me?

JsonResource (Web API not MVC)

from my.extensions.localization.json.

HamedFathi avatar HamedFathi commented on July 20, 2024

@hishamco

Thank you so much, Although I tried to simulate your approach in my JsonResource sample it failed!

I still do not understand what I have set wrong.
Anyway, thank you.

from my.extensions.localization.json.

hishamco avatar hishamco commented on July 20, 2024

Is your sample using the JsonStringLocalizer or your own localizer?

from my.extensions.localization.json.

HamedFathi avatar HamedFathi commented on July 20, 2024

@hishamco

IStringLocalizer<> here

from my.extensions.localization.json.

hishamco avatar hishamco commented on July 20, 2024

I mean you didn't use JSON?

from my.extensions.localization.json.

hishamco avatar hishamco commented on July 20, 2024

The line you point to will localize the strings that will be used by the controller not the data annotations

from my.extensions.localization.json.

HamedFathi avatar HamedFathi commented on July 20, 2024

image

from my.extensions.localization.json.

HamedFathi avatar HamedFathi commented on July 20, 2024

I had checked your tip before. Does not work.

No pressure, It would be great if you have time to check my repository. Definitely I make a mistake.

Thanks in advance.

from my.extensions.localization.json.

hishamco avatar hishamco commented on July 20, 2024

My tip is necessary before you go further, I will have a look once I have a time

from my.extensions.localization.json.

HamedFathi avatar HamedFathi commented on July 20, 2024

@hishamco I did not know their order is important!

Thank you so much

from my.extensions.localization.json.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.