Deetect Arabic - Arabic character detection plugin for Expression Engine
I just created a little plugin that might be of use to someone else out there.
This plugin will check if the input contains any from a list of Arabic characters.
If it does, it will enclose the input in the open_arabic and close_arabic parameters.
If it doesn’t, it will enclose the output in the open_other and close_other parameters.
Example:
{ exp:deetect_arabic
arabic_open="<div class='iraqi' style='float: none'>"
arabic_close = "</div>"
other_open="<div class='english' style='float: none'>"
other_close = "</div>" }
Here is some text with Arabic. معرض الصور
{ /exp:deetect_arabic }
will output
<div style="float: none;" class="iraqi"> Here is some text with Arabic. معرض الصور </div>
and:
{ exp:deetect_arabic
arabic_open="<div class='iraqi' style='float: none'>"
arabic_close = "</div>"
other_open="<div class='english' style='float: none'>"
other_close = "</div>" }
Here is some text without Arabic.
{ /exp:deetect_arabic }
will output:
<div style="float: none;" class="english"> Here is some text without Arabic. </div>
- Note that in the examples above, you’ll want to remove the spaces before and after the curly braces { } .
Download it here: pi.deetect_arabic.zip