Skip to content
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

Possibility to extend SyncHandlerRoot protected methods #679

Closed
bielu opened this issue Oct 30, 2024 · 4 comments
Closed

Possibility to extend SyncHandlerRoot protected methods #679

bielu opened this issue Oct 30, 2024 · 4 comments

Comments

@bielu
Copy link
Contributor

bielu commented Oct 30, 2024

Is your feature request related to a problem? Please describe.
Hi Kevin,
I wanted modify dictionary handler, to populate all languages with no value with my default language value, but noticed this DeserializeItem method is not virtual which make it not possible for me to override logic around this item, without messing with whole
ImportElement method or ISyncSerializer for dictionaries.
Describe the solution you'd like
I would like add virtual flag to method DeserializeItem

Describe alternatives you've considered
Replacing DictionaryItemSerializer but even have more troubles as DeserializeTranslations is private and not virtual.

Additional context
My requirement is to be able to parse item and add translation in existing languages without need of them existing in usync file.

@bielu
Copy link
Contributor Author

bielu commented Oct 30, 2024

Also I am happy to submit pr if you are okay with it Kevin :)

@KevinJump
Copy link
Owner

I think you might be on safer gound overriding the DictionaryItemSerializer and then replace its 'DeserializeCore` method

DeserlizeItem, essentially calls the serializer.Deserializer method (in SyncSerializerRoot) - and that is a wrapper that does the checks for changes in files and rules before calling the defined serializer's DeserializeCore method.

By overriding this method, you keep all of the goodness of the rules, the checks (and the performance stuff baked in). and then you can do what you need in a custom serializer?

if you need to make the private methods inside the DictionaryItem serializer public then thats a bit less of a change for us to keep track of (just worried we make that public and i am more likey to break the logic of it down the line).

@bielu
Copy link
Contributor Author

bielu commented Oct 30, 2024

@KevinJump I think I can do with DeserializeTranslations protected virtual :) but will check it when doing pr ;)

@KevinJump
Copy link
Owner

Fixed in v13.2.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants