This module doesn't transliterate Arabic correctly out of the box - is it possible to extend it somehow to do so?

Comments

Jaypan created an issue. See original summary.

ouiliam’s picture

I don't know if this is relevant, but there's a free translit extension here:
https://chrome.google.com/webstore/detail/arabeasy-view-arabic-web/endio...

drunken monkey’s picture

Category: Support request » Bug report
Status: Active » Needs review
StatusFileSize
new2.02 KB

A client of mine ran into the same problem. I don’t speak Arabic at all, but I noticed that the transliteration for Drupal 7 and Drupal 8 differ for certain Arabic inputs:

Drupal 7:

# The search string:
echo transliteration_get('احمد', '?', 'en');
> Hmd
# The name of the first person [1]
echo transliteration_get('عبد المجيد حمادة', '?', 'en');
> `bd lmjyd Hmd@

Drupal 8:

$transliteration = \Drupal::service('transliteration');
echo $transliteration->transliterate('احمد', 'en');
> ahmd
echo $transliteration->transliterate('عبد المجيد حمادة', 'en');
> `bd almjyd hmadt

The simplest fix for this problem would seem to just copy over Drupal 8’s mapping for the affected code block (x06). As said, I don’t speak any Arabic, but based on the feedback from my client it seems Drupal 8 got it right in this case, while this module doesn’t quite work for Arabic in all cases.
Patch attached, simply copy-pasting Drupal 8 Core’s core/lib/Drupal/Component/Transliteration/data/x06.php mapping to this module. Would be great if this could be committed! (You can easily check it’s just D8’s mapping, so even if you don’t speak Arabic yourself you can be confident that the mapping makes sense.)

Of course, testing by actual Arabic speakers would also be great!

izus’s picture

Status: Needs review » Reviewed & tested by the community

Hi,
tested #3 and it looks better indeed
Thanks

amir simantov’s picture

Thanks guys for the patch and testing. Can this patch go into the module?

renatog’s picture

Version: 7.x-3.2 » 7.x-3.x-dev

renatog’s picture

Status: Reviewed & tested by the community » Fixed

Committed to the dev branch.

Thank you all by contribution

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.