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

Locale / translate Trix js messages #3329

Open
rafaeliga opened this issue Oct 10, 2024 · 1 comment · May be fixed by #3330
Open

Locale / translate Trix js messages #3329

rafaeliga opened this issue Oct 10, 2024 · 1 comment · May be fixed by #3330

Comments

@rafaeliga
Copy link

Feature

When trying to upload an image in a not saved resource, I see a js alert message:

Image

It should be possible to change or add a translation to the message.

Current workarounds

  • Create a new trix_field_controller.js with the translated message?
  • Replace event trix-file-accept?

Screenshots or screen recordings

Sent one above

Additional context

I can implement if there is a direction on how or where to set the message to translate.

@Paul-Bob
Copy link
Contributor

Hey @rafaeliga thanks for reporting this!

I can implement if there is a direction on how or where to set the message to translate.

I'll try to summarize an approach:

  1. Add a key for this translation on lib/generators/avo/templates/locales/avo.en.yml
  2. Run i18n-tasks add-missing to automatically add the same key on all locale templates
  3. Translate those using chat GPT or other reliable translation tool
  4. Add uploadWarning: String, to trix_field_controller.js values (here)
  5. Use that value on translation by replacing "You can't upload files into the Trix editor until you save the resource." with this.uploadWarningValue
  6. Pass the translated key as value here like: upload_warning: I18n.t("avo.the_key"),

Thank you for taking the initiative ane let me know if you hit any obstacles.

@rafaeliga rafaeliga linked a pull request Oct 10, 2024 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

2 participants