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

Add ability to inline edit translations #32

Merged
merged 2 commits into from
Aug 5, 2023
Merged

Conversation

frapell
Copy link
Contributor

@frapell frapell commented Aug 4, 2023

If the backend API allows it, you can provide an updateTranslation endpoint to the translateWidget init parameters. If that is the case, there's an advanced feature that gets enabled, that will show an edit pencil over translated chunks. When clicking on it, an edit <textarea> will show up where the translation can be edited and saved. This is how it works:

When the translation feature kicks in, you get the content translated (As normal):
Original
While holding Ctrl and hovering over it, you will get the edit pencil with a border showing what is going to be edited:
Hovering
After clicking the edit pencil, you get a <textarea> with the translation to edit:
Updating Translation
Finally, clicking Save will send the updated translation to the backend endpoint, and update the element:
Translation Updated

@frapell
Copy link
Contributor Author

frapell commented Aug 4, 2023

@au5ton Hey! here's another one for you to review :)

We implemented in our backend the ability to cache translations to avoid going back to the translation service on every request. In addition to that we implemented this feature that allows editing in place (We are using this on top of a CMS so we have permissions in place, and this would only be available to editors with proper permissions, by providing the endpoint or not).

Anyway, I implemented it as a branch in our fork on top of #31 so you should merge that first, and then this one (If you actually want this feature in)

@au5ton
Copy link
Owner

au5ton commented Aug 5, 2023

This is fantastic! I've also used this project in a cached scenario and this feature would be phenomenal!

@au5ton au5ton merged commit 8da5d71 into au5ton:main Aug 5, 2023
@au5ton
Copy link
Owner

au5ton commented Aug 6, 2023

Would you be willing to update openapi.yaml and README.md with how to use this new feature? @frapell

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.

2 participants