Skip to content

Conversation

@rmpel
Copy link

@rmpel rmpel commented Feb 19, 2025

THIS IS A PROOF OF CONCEPT

Todo:

Verify the work ;)
The list provided by the FE (Front-End) with the current code (deepl.ts, other project) must at least be present in the strings generated by this PoC; otherwise, it’s not 100% backward compatible. The idea here is that this should be a drop-in replacement—the FE of, for example, existing implementations should continue to work as before, while this PoC ensures that no abuse can take place. In a new situation, the front-end should no longer need to send strings in the POST (fetch).

Some additional thoughts:

The plugin accepts POST requests with ObjectID = 0 when they are not required in settings. This is to handle cases like Archives. This is not covered by this PoC.
We could implement "if object_id is 0, we take the referrer URL and retrieve the strings from there."
It's safer than the current situation, but the URL must be validated to ensure "it’s really from one of our sites" (which is easy peasy). Caching can then be done based on URL, but that (as said) is not yet implemented.

For the plugin on WordPress.org, it might be useful to include a demo script. Although the plugin does what it is supposed to do, it’s not very useful for someone who finds it without already having something in place for translating the site.

… IS NOT 100% FINISHED. See comments in Github.
With more data from the front-end (like 'is-archive', 'is-category' etc) we could make this more specific, which will help with cache-invalidation.
@rmpel
Copy link
Author

rmpel commented Feb 20, 2025

Updated to PoC to work with "object = 0" situations.

@rmpel rmpel marked this pull request as draft February 20, 2025 09:19
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

Successfully merging this pull request may close these issues.

1 participant