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

fix: disable translation on key elements #380

Merged
merged 2 commits into from
Feb 11, 2025

Conversation

whiteSHADOW1234
Copy link
Contributor

Summary

This change adds a mechanism (e.g., a translate="no" attribute) on key text elements to prevent Microsoft Edge from automatically translating specific words. This fix ensures that the intended text remains unchanged when using Edge's webpage translation feature.

Type of change

  • Bug fix (added a non-breaking change which fixes an issue)

How Has This Been Tested?

  • Ran tests with composer test

Additionally, the fix was verified manually by running the demo page in Microsoft Edge with translation enabled to ensure that key text remains unchanged.

Closes #336

…text by disabling translation on key elements
Copy link
Owner

@DenverCoder1 DenverCoder1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great 👍

Another option might be to add value attributes to the option tags instead since that may allow the translations to appear but not break the code (I don't have a way of easily testing it). Let me know what you think.

Thanks!

@whiteSHADOW1234
Copy link
Contributor Author

I've updated the code per your suggestion. The <select> element now uses value attributes for the <option> tags instead of disabling translation. The updated code looks like this:

<select class="param" id="vCenter" name="vCenter" alt="Vertically Centered">
  <option value="false">false</option>
  <option value="true">true</option>
</select>

Please review the changes and let me know if this meets your requirements or if further adjustments are needed.

Thanks!

@DenverCoder1
Copy link
Owner

Looks great, have you verified it's still working in Edge with translations?

Thanks for contributing!

@whiteSHADOW1234
Copy link
Contributor Author

Thanks for checking! I’ve tested the updated project in Microsoft Edge with translations enabled, and everything still works as expected. I've attached two screenshots for reference—one showing the page in English and the other in Chinese.

  • English Version:
    image
    The generated website address: http://localhost:8000/demo/?center=true&vCenter=true&lines=The+five+boxing
  • Chinese Version:
    image
    The generated website address: http://localhost:8000/demo/?center=true&vCenter=true&lines=The+five+boxing

Thanks again!

@DenverCoder1 DenverCoder1 merged commit 30383df into DenverCoder1:main Feb 11, 2025
2 checks passed
@DenverCoder1
Copy link
Owner

Thanks so much!

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.

[Demo site]When I use Edge's webpage translation, the webpage will use the translated text.
2 participants