I don't know why but it is not functioning with arabic slugs proberly and also:
- it deals with the string as a whole so it will replace the stopword if it is a part of a non-stopword e.g "playing" will be "playg" as the stopword "in" is a partfrom it.
-  Slug words are separated by dashes, so by replacing stopwords the result will contain extra dashes that need to be replaced again.
so I think the function needs to be modified.