Comments (11)
Thanks for reporting this @mwillems1994, could you please try LocalizationSample.Mvc
it uses AddDataAnnotationsLocalization
from my.extensions.localization.json.
In your example you pass RegisterViewModel instead of type
options.DataAnnotationLocalizerProvider = (type, factory) => factory.Create(typeof(RegisterViewModel));
Therefore it never passes types such as string or guid
from my.extensions.localization.json.
Therefore it never passes types such as string or guid
Could please elaborate? or share a minimal repo, so I can see the bug
from my.extensions.localization.json.
Thanks for your quick reply.
To reproduce this to the following:
Add this to your startuo
services.AddControllers() .AddDataAnnotationsLocalization(options => { options.DataAnnotationLocalizerProvider = (type, factory) => factory.Create(type); });
Note that i pass type to factory.Create instead of typeof(RegisterViewModel).
Now add this controller
`[AllowAnonymous]
public class TestController: ControllerBase
{
[HttpGet("working")]
public async Task TestWorkingAsync()
{
return "Working";
}
[HttpGet("{test}/NotWorking")]
public async Task<string> TestNotWorkingAsync(Guid test)
{
return "Not working";
}
}`
When you request Test/guid here/NotWorking, you get the error.
from my.extensions.localization.json.
Thanks for the info, hope to check this ASAP
from my.extensions.localization.json.
Thanks
from my.extensions.localization.json.
One more thing, how the action is related to the DataAnnotation?
from my.extensions.localization.json.
That is a good question, i think it is because the parameter is passed to the function and therefore it counts as a DataAnnotation.
from my.extensions.localization.json.
Hmmm, first time I saw this behavior, I will try to debug this one
from my.extensions.localization.json.
I took a quick look yesterday and it seems that you use the substring only to make a key in the dictionary. Maybe find an alternative way to build the key.
I'll see if i can make some time in the weekend and have a better look.
from my.extensions.localization.json.
Feel free to submit a PR if you have a better way
Thanks
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
- How to use with DataAnnotation? HOT 17
- Regression Bug HOT 1
- LocalizationSample project is not working HOT 3
- About NET5.0 Blazor WebAssembly Uses My.Extensions.Localization.Json HOT 14
- 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.