I'm trying to learn DDD with Onion Architecture but I faced a problem
My application should support localization over labels, enums, validation messages and some data in some entities (e.g. Item.ItemName)
So, it's obvious that the localization process relates to the domain and the ui
And this localization service should also support caching
Now I'm confused where should I put this class
I didn't do localization with DDD approach yet, but I'll try my best to help you.
Localization is a matter of presentation data, I don't think that your domain model should be concerned about it, if its only purpose is presentation. So how to handle it?
This is how I would do it.
Let's say that client is creating new product. Of course he has to define a name for it. You want every product name to be translated to different languages. It's your choice how you will do it:
etc. it doesn't really matter.
So in Your createNewProduct
view you should call product service that will create new product and also call some service that will create translations for that product, but don't save translations in domain entity. In other words you should separate services for handling business logic and for creating translations. Then just link them by productId when presenting.