Search code examples
unit-testingarabicarabic-support

Unit Test for Arabic Highlighting of keywords with # hashtags and @ mentions?


I'm working on an app that needs to support Arabic input by users, and highlighting search keywords in Arabic content.

I have the following problems:

  • I can't read Arabic, so it's hard for me to really understand if what I'm seeing is right.
  • Some special characters (# and @) seem to cause the direction of Arabic text to be changed, and converts some Arabic characters to completely different arabic characters!
  • I don't have any test data for Arabic with # and @ mentions

Are there any simple examples of rendering highlighted Arabic content available anywhere?


Solution

  • I didn't find any examples online, and after working through this with some colleagues, came up with the following sample code:

    https://github.com/bradparks/arabic_highlighting_of_keywords_hashtags_and_mentions

    Note that I'd include the repo here as a snippet, but it also includes over 30 screenshots that I wasn't sure how to include.