Skip to content

A jQuery plugin to find text from a certain language on your webpage, wrap it in a span[lang=''] so you can style text from different languages or assist screen readers in reading mixed content on your page.

Notifications You must be signed in to change notification settings

teeohhem/jQuery-Language-Match-And-Wrap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Instructions

  1. Clone the repository
  2. Edit the example.html file or use it as a guide

Adding Additional Languages

Pass in a JS Object to languageMatchAndWrap with the new language name and a regex that can detect that language

$("p").languageMatchAndWrap(
{
    language : 'langCode',                       // enter language code (en, he, etc...) see: http://www.w3schools.com/tags/ref_language_codes.asp
    regExMap : {languageName : /[A-Z]/}               //create a regEx to grab word containing language
});

Notes

  1. Elements can contain only text or it can contain both HTML and text. The plugin will traverse the child nodes and their children (and so on) if they exist.
  2. There may be a performance hit depending on how deep the child node list is. This has not been fully performance tested.
  3. This was tested with jQuery 1.7.2 and jQuery 1.9.1

More information: http://www.teeohhem.com

About

A jQuery plugin to find text from a certain language on your webpage, wrap it in a span[lang=''] so you can style text from different languages or assist screen readers in reading mixed content on your page.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published