Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
April 10, 2022 09:23 am GMT

Fixing the ligatures curse with translate attribute

Use the translate attribute set to "no" to stop Google translate from trying to translate the ligature of your icon, and end up with readable text, instead of a nice icon.

<i class="icon" tranlsate="no">trash</i>

If you've ever used ligatures to define your icons in an icon font, or a ready made icon font with ligatures defined, like Google Material Icons font, then you must faced issues with multi-lingual interfaces.

If you control the languages, then you can always

  • Display the icon text with one language, and toss it under the rug (no considerations for accessibility, which can be dealt with using aria- and title attributes).
  • Or you can add all possible ligatures to the icon when you create your font (with tools like icomoon), this is accessible alright, but bloats the icon font file.

But if your audience try to translate page using Google translate, your options are slimmer. The icon will appear as text. And well translated. That, might not be what you aim for. So translate="no" is the the best visual solution. Of course, for data integrity, you can simply let it be.

RESOURCES


Original Link: https://dev.to/ayyash/fixing-the-ligatures-curse-with-translate-attribute-53hj

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To