-
Notifications
You must be signed in to change notification settings - Fork 39
Add the ability to translate submissions #4134
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
Conversation
|
Lots of work needed before this is ready, like:
So far happy with the initial pass though! OTF is on board already as this is something they really hate having to keep using an external AI type service for. |
|
if anyone wants to play around with this, to install language packages you can use the following script (will install the Arabic -> English package but |
|
I think the UI looks really nice. Neat to make the to/from lang a query string so it can be shared. How would downloading the language package work on production? |
|
I was thinking via a management command that way the instance could add languages as needed. Still thinking through what that syntax would look like but maybe something like: python3 manage.py install_language from_to ...ie. to install the arabic -> english & french -> english package it'd look like: python3 manage.py install_language ar_en fr_en |
|
The previously mentioned management commands were added - had a long layover today so went a little overboard w/ verbosities and messages (ie. Installing English -> Arabic & English -> Spanish: python3 manage.py install_languages ar_en fr_enUninstalling said languages: |
c585d71 to
43d72a3
Compare
835bed6 to
fc7608a
Compare
fc7608a to
dba2b8b
Compare
|
I think this is ready for review! Added tons of unit tests - might've gone a little overboard with mocking but really wanted logic testing to be isolated. Let me know what y'all think! |
dba2b8b to
25739aa
Compare
|
Works well in my testing and I like the UI. Two observations:
|
This builds on the #4134 PR that initially introduced machine translations into Hypha. This isolates the translation behavior; putting pip dependencies in a separate `requirements-translate.txt` and will not attempt any translate imports unless the setting for it is true. Other small changes are also a full docs page explaining how to install language packages & changing the setting once again from `SUBMISSION_TRANSLATIONS_ENABLED` to `APPLICATION_TRANSLATIONS_ENABLED` to reflect the system wide shift away from submission terminology.
Pertaining to discussions had in #4037. This integrates the argostranslate library to allow for translation of applications. The current functionality allows staff users to translate the written answers of an application.
This feature utilizes htmx to translate the application without requiring a reload of the page, while also updating the URL so a user can have a sharable link (using the query parameters
fl[from language] &tl[to language]) when collaborating with others on the application.This feature is disabled by default & can be enabled via the
SUBMISSION_TRANSLATIONS_ENABLEDsettingDemos
Translating an application
Screen.Recording.2024-09-13.at.14.33.16.mp4
Clearing a translation via the form
Screen.Recording.2024-09-13.at.14.52.45.mp4
Test Steps