reutenauer / polyglossia

An alternative to Babel for XeLaTeX and LuaLaTeX
http://www.ctan.org/pkg/polyglossia
MIT License
190 stars 51 forks source link

Adding new languages: Kurdish #277

Closed sinaahmadi closed 4 years ago

sinaahmadi commented 5 years ago

Hi,

I am wondering if there are instructions regarding adding a new language. I am interested in adding Kurdish to Polyglossia.

Thanks.

jspitz commented 5 years ago

The best procedure is probably to take an existing gloss file for a "similar" language as a model and transfer the existing captions and formats to Kurdish.

Since a package for babel exists at least for Kurmanji Kurdish (babel-kurmanji), you should check this for existing translations and methods. Should you want to address Kur­dish writ­ten in Ara­bic script rather than (or in addition to) Kurmanji Kurdish, arabxetex might serve as a model (it supports Kurdish).

Of course you can always ask here in case of questions.

This might be related to #58

sinaahmadi commented 5 years ago

Thank you for your comment.

I am trying to do so. So, I created a new gloss file called gloss-kurdish.ldf and tried to set the default language to "kurdish". I also added kurdish, true to the languages.csv file in the doc directory. I am still not able to compile my code successfully.

Would you kindly provide me with, even a brief, description of how to make it work?

Thanks.

jspitz commented 5 years ago

I created a new gloss file called gloss-kurdish.ldf and tried to set the default language to "kurdish".

This should suffice

I also added kurdish, true to the languages.csv file in the doc directory.

This is not necessary

I am still not able to compile my code successfully.

Could you be more specific? Do you get errors?

sinaahmadi commented 5 years ago

This is a minimal working example:

\documentclass{book} \usepackage{polyglossia} \setdefaultlanguage{kurdish} \newfontfamily\arabicfont[Script=Arabic,Scale=1.1]{Lateef}

\begin{document}

\chapter{ده‌سپێك} ئه‌مه‌ یه‌كه‌م به‌ندی پڕۆژه‌ نوێیه‌كه‌مه‌.

\end{document}

which produces the following error:

Package polyglossia Warning: File gloss-kurdish.ldf does not exist!

even if I have gloss-kurdish.ldf in the tex directory with \ProvidesFile{gloss-kurdish.ldf}[polyglossia: module for kurdish] and \PolyglossiaSetup{kurdish}{.....} set to Kurdish.

The same example above works fine when I set Arabic as the default languages, i.e. \setdefaultlanguage{arabic}.

jspitz commented 5 years ago

You probably need to put gloss-kurdish.ldf to a directory which TeX can find (i.e., HOMETEXMF). The location depends on your LaTeX distribution. On linux, it's /home//texmf/tex/latex

sinaahmadi commented 5 years ago

Thanks. gloss-kurdish.ldf is in this directory /usr/local/texlive/2018/texmf-dist/tex/latex/polyglossia/gloss-kurdish.ldf as I am a Mac user but I still get the same error that

Package polyglossia Warning: File gloss-kurdish.ldf does not exist!.

I can see the error comes from here but have no idea why the file is not recognized while it exists where other glosses exist.

jspitz commented 5 years ago

This is strange. Did you run maketexhash to update the tex filename database?

sinaahmadi commented 5 years ago

Thank you very much @jspitz. I had obviously forgotten to update my Tex database!

For future users, here are the steps that I went through to add my new language:

  1. Creating a new gloss file called gloss-[your language name].ldf in the latex directory, depending on the operating system. On macOS Mojave, this directory may look like /usr/local/texlive/2018/texmf-dist/tex/latex/polyglossia/
  2. Find the configuration of the most similar language to your desired one. In the case of Sorani Kurdish which is written in Persian-Arabic script, I found gloss-arabic.ldf and gloss-farsi.ldf the most related ones.
  3. Once you created and modified your configuration, run texhash to refresh your Tex database.

Of course, the configuration is not that easy and will require more information.

Would you please tell me what is the procedure to add this new configuration to the current polyglossia package? I've created the Kurdish one and can share it with you.

Please find my gloss-kurdish.ldf at https://github.com/sinaahmadi/KurdishLatex.

jspitz commented 5 years ago

Thank you. I'll have a look in the forthcoming days.

reutenauer commented 5 years ago

@jspitz I installed Sina’s file in the usual place.

@sinaahmadi Your gloss file looks good, I only had a few comments:

sinaahmadi commented 5 years ago

Thank you @reutenauer for integrating this new gloss file.

I go through your comments as ordered:

I'll appreciate it if you kindly give me some feedback.

jspitz commented 5 years ago

There is another problem, however, that I'm not sure how to address. Both dialects, Sorani and Kurmanji, can be written in the two scripts, Arabic and Latin. That's why changing the script option can only be ideal for a dialect, as different words are used in the two dialects. One solution may be to add a variation option (like the Greek one) or simply create two glosss files for the two dialects accordingly, saying gloss-sorani.ldf and gloss-kurmanji.ldf.

The solution indeed is to add

Script={Arabic|Latin} (default: Arabic) variant={Sorani|Kurmanji} (default: Sorani)

You could then also make the gloss set Script=Latin by default if variant=Kurmanji and no script set, if this is approriate.

Jürgen

jspitz commented 5 years ago

I wondered about \farsinumeral and some other occurrences of "farsi". Should these be changed to something unique (in order to prevent conflicts with gloss-farsi)?

sinaahmadi commented 5 years ago

I see your points regarding the scripts and the variants. I'll provide a new more complete version shortly.

Thanks again for all of you who provided me with feedback.

jspitz commented 5 years ago

@sinaahmadi I have pushed some fixes to gloss-kurdish.ldf at ad0c71b.

Please start from this version for further work.

(I would advise to do further work in a fork of polyglossia rather than in a separate repository)

jspitz commented 5 years ago

@sinaahmadi I have extended the Kurdish gloss file to include variant=sorani|kurmanji and script=Arabic|Latin. I have added the Kurmanji Latin captions and dates from babel-kurmanji.

The only thing that needs to be done is to fill in \captionskurdish@sorani@latin and \captionskurdish@kurmanji@arabic (they currently point to their co-variant's definitions), and maybe also adapt the Kurmanji Arabic and Sorani Latin date formats, if they differ from their respective co-variant.

Another thing that is open, but nor urgent, are the "alternative" Kurmanji (Latin) month names, as provided by babel-kurmanji. Do we want to support these, and if, is there something more sensible than monthname=alternative? Judging from the Wikipedia, Kurmanji calendar is a complex issue.

You can grab the revised gloss from http://www.spitzmueller.org/docs/tmp/gloss-kurdish.ldf

sinaahmadi commented 5 years ago

Hi Jürgen, Amazing how supportive you are! 🙂

Since our last exchange, I spent some time working on adding Kurmanji and the two scripts (Arabic and Latin). Up to a certain point things went on smoothly, but then I was thinking about separating those two dialects due to complexity.

The Sorani dialect is mostly written in the Persian-Arabic script while the Kurmanji one in Latin. This is not always the case. That's why having the two scripts for the two dialects is essential.

Please find my initial incomplete draft of the gloss file at https://raw.githubusercontent.com/sinaahmadi/sinaahmadi.github.io/master/temp/gloss-kurdish.ldf

Regarding the months, you're right. The problem is that Kurds in the four regions follow the calendar in their region country which is not essentially the same. I personally think that, as an initial step, we should go for the Gregorian one which is almost known to everyone.

jspitz commented 5 years ago

I have merged in your new captions and date formats into my gloss and pushed everything to master.

Could you test whether this is OK?

jspitz commented 5 years ago

... here: https://raw.githubusercontent.com/reutenauer/polyglossia/master/tex/gloss-kurdish.ldf

jspitz commented 5 years ago

I might need to add that you also need the recent polyglossia.sty in order to test the above gloss: https://raw.githubusercontent.com/reutenauer/polyglossia/master/tex/polyglossia.sty

sinaahmadi commented 5 years ago

Thanks, @jspitz. I'll test it and get back to you. I'm also preparing a documentation file in Kurdish that I hope that you can include it in the future versions.

jspitz commented 4 years ago

Polyglossia 1.45 with Kurdish support is released (it will take some days until the version has made it to all CTAN mirrors).

If there are issues, please file separate tickets for those. And thank you, once more, for this contribution.

sinaahmadi commented 4 years ago

Hi Jürgen (@jspitz), I hope you are doing well.

It took a while to get back to the Kurdish XeLaTeX project. Thanks again for all that you have done with Polyglossia. It could not be possible without all your efforts to deal with a language with so much diversity, both in script and in dialect!

I have created the Kurdish XeLaTeX Users Group which aims at promoting the usage of XeLaTeX for writing Kurdish. The website will also be available in Kurdish to create more content on the XeLaTeX typesetting system.

I would like to ask you to kindly replace the gloss-kurdish.ldf file with the last updated one. In this new version, the following modifications are applied:

The future updates will be based on the feedback that I will be getting from the community and I am not planning to update the file any soon. You can find example files at https://github.com/KurdishXeLaTeX, if you would like to include them in your future reports.

One last question. Is it possible to push my changes in the future in a branch instead of using issues? I'll be happy to be a collaborator.

jspitz commented 4 years ago

@sinaahmadi thanks for these efforts. It would be most helpful if you could fork polyglossia and propose your changes via a pull request.