The PR as is now does not have the complete feature, but what's there works and can be reviewed.
I refactored the BundleService, Moving the interface declaration to its own file, and creating an abstract class with the default implementations, so there si no need to reimplement everything in other IBundleService implementations.
I changed a thing in the abstract implementation of BuildEditorViewModel, adding the Where clause. In the default BundleService that is always true, but I override it in the IBundleService from the feature to conditionally filter out some products from being shown in the UI.
I also added the culture notation "(culture)" to the display text of the ProductEntry objects, because it's there already, instead of through an alternate.
There is an additional BundlePart driver, that currently does nothing, but that I created there for later use (I was planning to use it already, and I still might as I finish implementing the whole feature.)
In a moment I'll push an update to the PR with the complete feature.
The following settings control the behaviour of the localization:
"Try to replace selected products with their correct localization.": When this is enabled, we try to localize products selected in a bundle upon saving/publishing. This also makes the next two settings available:
"Remove products that do not have the correct translation.": If during the localization we find that a selected product does not have the "right" culture, and neither does it have a "right" localization, it is unselected / removed from the bundle.
"Merge product quantities across localizations.": This is the slightly more complex case. Say we have a Bundle in the it-IT culture. We also have Product (in en-US) and Prodotto (its it-IT localization). In the bundle, we have selected to add 3 Products and 2 Prodotti. If this setting is not selected, after publishing the bundle will only have 2 Prodotti. If this is selected the bundle will have 5 Prodotti. Basically, selecting this causes the "translation" to sum all quantities across localizations of a selected product.
"Verify culture of selected products.": causes validation to fail when trying to save/publish a bundle where we have added products in a different culture.
"Don't show products.": Hides products in a culture different than the bundle from its editor view.
Taking care of #114
The PR as is now does not have the complete feature, but what's there works and can be reviewed.
I refactored the
BundleService
, Moving the interface declaration to its own file, and creating an abstract class with the default implementations, so there si no need to reimplement everything in other IBundleService implementations.I changed a thing in the abstract implementation of
BuildEditorViewModel
, adding the Where clause. In the defaultBundleService
that is always true, but I override it in theIBundleService
from the feature to conditionally filter out some products from being shown in the UI.I also added the culture notation "(culture)" to the display text of the
ProductEntry
objects, because it's there already, instead of through an alternate.There is an additional BundlePart driver, that currently does nothing, but that I created there for later use (I was planning to use it already, and I still might as I finish implementing the whole feature.)