Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add (Persian/Farsi) locale #89

Open
deasurv opened this issue Aug 25, 2020 · 2 comments
Open

Add (Persian/Farsi) locale #89

deasurv opened this issue Aug 25, 2020 · 2 comments
Labels

Comments

@deasurv
Copy link

deasurv commented Aug 25, 2020

Hi. Thanks for your work!

Please add Persian (or Farsi) support to locales.

@simov
Copy link
Owner

simov commented Aug 30, 2020

Hi @deasurv, locales are being added only when the existing transliteration in the main charmap file conflicts with a letter from that specific locale. So if you are a native speaker and you spot some incorrectly transliterated characters, then open up a PR and add the offending characters in a [locale].json file.

@simov simov added the question label Aug 30, 2020
@Trott
Copy link
Collaborator

Trott commented Oct 1, 2020

I don't think slugify supports Farsi characters (yet?) so I think the addition needs to happen in charmap.json?

$ cat index.js 
const slugify = require('slugify');
console.log(slugify('سلام دنیا'));
$ node index.js

$

The slug module has support for Farsi so that's an option.

$ cat index.js 
const slug = require('slugify');
console.log(slug('سلام دنیا'));
$ node index.js
slam-dnia
$

Not perfect, but possibly usable? (I don't know Farsi or Arabic, but a quick web search indicates that the greeting is typically transliterated as "salam" with some diacritics. Looks like it gives "slam" instead here.)

To get Farsi characters into slugify, I think all that's needed is to copy the character map from https://github.com/Trott/slug/blob/6fe210016d7da58856594891f47b8258ce11c4a1/slug.js#L486-L523 into https://github.com/simov/slugify/blob/master/config/charmap.json. I don't know if there are criteria about what gets included and omitted from charmap.json in slugify but it seems to be "whatever people need within reason". Anyway, adding Farsi and Arabic to slugify would be great (in my opinion).

(Full disclosure: I'm the current maintainer of slug. But I ❤️ slugify and you should totally use it.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants