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

Support custom CDS handlers #74

Open
howamith opened this issue May 9, 2022 · 1 comment
Open

Support custom CDS handlers #74

howamith opened this issue May 9, 2022 · 1 comment

Comments

@howamith
Copy link

howamith commented May 9, 2022

Some parts of the TxNative class already allow the user to provide their own implementations of various components via dependency injection. The AbstractCache class being a good example of this. It would be good if users could also provide their own implementation of the CDSHandler class.

Users can already point the TxNative class at a different instance of the Transifex CDS via cds_host, and since the code for the CDS is available at https://github.com/transifex/transifex-delivery there's nothing stopping them creating their own CDS (using transifex-delivery as documentation on what endpoints need to be available and how they should behave) and pointing TxNative at this to provide their own implementation at the service level, rather than the application level. However, if your application handles content delivery, then you're forced to either split this out in a separate service (which might be a good thing, but equally might not be), or your application is forced to make requests to itself over localhost (which I really don't want to do - and I can't imagine anyone else would either).

Allowing users to provide their own CDSHandler would provide a lot more flexibility, allowing users to bolt on extra functionality - maybe the source strings are coming from different sources that don't have visibility of one another and you want to check for duplicates to remove wasted effort translating duplicate strings, or maybe you want to run some sort of analysis on the source strings before pushing them to the CDS. Maybe you want to use a local database for content delivery, meaning you don't need to push and pull the translations over HTTP at all. These are just some examples off the top of my head to try to justify the development effort required here.

If this is something that Transifex don't have resource to do, but are happy to adopt it should another contributor carry out the work, then I'm happy to fork and submit a PR for this if I can find some spare time to do so.

@n1k0sv
Copy link

n1k0sv commented May 10, 2022

@howamith That is a great idea. A PR would be more than welcome if you have the capacity. Bare in mind that in order to accept your contribution, you will need to sign a CLA as described here: https://github.com/transifex/transifex-python/blob/devel/CONTRIBUTING.md#creating-patches

@howamith howamith changed the title Support custom CDC handlers Support custom CDS handlers May 10, 2022
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