Comments (17)
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.
I think it will not make difference either Web API, MVC or Razor Pages
from my.extensions.localization.json.
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.
Ok, no worry I will have a look or provide a sample in the repo soon
from my.extensions.localization.json.
@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.
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.
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.
Honestly, I tried but failed and built a repository. Can anyone help me?
JsonResource (Web API not MVC)
from my.extensions.localization.json.
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.
Is your sample using the JsonStringLocalizer
or your own localizer?
from my.extensions.localization.json.
IStringLocalizer<>
here
from my.extensions.localization.json.
I mean you didn't use JSON?
from my.extensions.localization.json.
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.
from my.extensions.localization.json.
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.
My tip is necessary before you go further, I will have a look once I have a time
from my.extensions.localization.json.
@hishamco I did not know their order is important!
Thank you so much
from my.extensions.localization.json.
Related Issues (20)
- Add Benchmark HOT 16
- Missing Localization Behavior
- Remove internal contructor in JsonStringLocalizer HOT 1
- Ability to override methods in JsonStringLocalizer and JsonStringLocalizerFactory HOT 9
- Registering the service one should provide absolute path, otherwise exception is thrown HOT 31
- Localization FallBack Considerations
- Support ResourceLocationAttribute HOT 1
- Support RootNamespaceAttribute
- assign culture in runtime HOT 3
- Have one resource file for project HOT 13
- Any plan to switch the project to a .NET standard class library ? HOT 10
- Regression Bug HOT 1
- LocalizationSample project is not working HOT 3
- About NET5.0 Blazor WebAssembly Uses My.Extensions.Localization.Json HOT 14
- System.ArgumentOutOfRangeException: startIndex cannot be larger than length of string. HOT 11
- Class based localisation only works when the class is in the root namespace HOT 5
- Can you provide an core api example with DataAnnotations? HOT 2
- when using xunit test(SUT),there is an exception throwed! HOT 7
- JsonResourceManager does not dispose of (unix) File System Watches HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from my.extensions.localization.json.