-
Notifications
You must be signed in to change notification settings - Fork 5
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
Feature request: LocalizeAlways #5
Comments
Hmm ... I will need to look at what AutoMapper does and figure out what needs to be done for localization to work. You are using Querialbe extensions of AutoMapper right? http://docs.automapper.org/en/stable/Queryable-Extensions.html |
Do you have any plans to make this thing work? I'm actually trying to find the related implementation on the source code, if I could, I will try to implement it. |
@Chatatata what thing? It works fine when using http://docs.automapper.org/en/stable/Queryable-Extensions.html |
@Chatatata Oh, I see. If I understood correctly, is whether the feature to localize without projections will be added. |
@popcatalin81 Could you show me the related code segment for that issue? I see https://github.com/iQuarc/DataLocalization/blob/master/src/iQuarc.DataLocalization/Data/LocalizationExpressionVisitor.cs#L32 is not getting called when there is no projection on the query. |
@Chatatata When there's no projection, it's really hard to determine what Visit method will be called. There are multiple choices, this is 1st problem, var p1 = db.Products.AsEnumerable();
var p2 = db.Categories.Where(c => c.Name == "Food").SelctMany(c => c.Products).Distinct();
var p3 = db.Products.OrderBy(x => x.Name).Skip(10).Take(1);
var p4 = db.Products.GroupBy(p => p.Category.Name).ToList(); And there are more ... all these methods will create a different query tree, and withouth having a specific place to intercept, localization becomes very very hard. The 2nd problem is that translation can't be made to work for Edit: You could conceivably insert a Projection forcefully in the Query something like: var p4 = db.Products.GroupBy(p => p.Category.Name).ToList();
// becomes
var p4 = db.Products.Select( p => new Product
{
Id = p.Id,
Name = p.ProductLoalizations.Where(pl => pl.ProductId = p.Id && pl.Language.Code ="{IsoCode}").Select(pl =>pl.Name).FirstOrDefault() ?? p.Name,
CategoryId = p.CategoryId
})
.GroupBy(p => p.Category.Name).ToList(); For this you use |
Hi, I must say great localization feature and very easy to use!
Would it be possible to Always force localization, and not just when selecting specific members?
For example when returning a mapped dto using Automapper the translations aren't included since the mapping isn't forcing selections.
The text was updated successfully, but these errors were encountered: