Subject: bug#66470: 29.1; Provide Urdu input method

From: Eli Zaretskii <[email-masked]>
Date: Sat, 14 Oct 2023 13:53:53 +0300

> From: Rahguzar <[email-masked]>
> Cc: [email-masked]
> Date: Sat, 14 Oct 2023 11:50:42 +0200
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> > I responded to your question on help-gnu-emacs.
> 
> Thanks a lot! But changing ` to ' doesn't seem to make a difference.

It works in other input methods, such as chinese-array30, so maybe you
should study what they do there.  Or maybe there really is a bug in
quail.el, because this behavior seems to be rarely if ever used.

> 
> >> 1) Better coverage of Urdu zabta takhti
> >> http://www.unicode.org/L2/L2002/02004-uzt.pdf It is a code page
> >> developed for Urdu and supposedly was the basis of current Urdu support
> >> of Unicode. However I can't figure out exactly what is the mapping from
> >> UZT to Unicode. If anyone has pointers please share.
> >
> > What are the specific issues you cannot figure out?
> 
> The paper I referenced describes the UZT code page but it is uses hand
> drawn characters and I can't figure out what what Unicode code points
> those characters correspond to.

The shapes should tell you.

But I asked about specific issues.  Are you saying that you are unable
to track the mapping of _all_ the characters between UZT and Unicode?

> > Anyway, a better place to ask about Unicode mapping is on the Unicode
> > mailing list, [email-masked].
> 
> Thanks, I will ask there.

That's probably the best.

> >> 2) Another input method for the common Urdu keyboard support. Despite
> >> Urdu being my mother tongue I never learned to type in it which is why I
> >> prefer a phonetic keyboard. However I will like to make an input method
> >> with the layout of a physical Urdu keyboard. If a keyboard layout was
> >> standardized in Pakistan or India, I can't find the specification. If
> >> such a document exists and anyone can point me to it, I will be happy to
> >> use it as a basis for addition to the `urdu.el` in attached patch.
> >> Otherwise I will use the layout of Urdu keyboard from some free software
> >> project. But this will probably be closer to Emacs 30 than now.
> >
> > Does https://www.branah.com/urdu help?
> 
> I found that keyboard, but I also wanted to see if there was some
> institutional standardization in Pakistan or India so as to find a
> canonical resource. Web searches didn't reveal anything so if nothing
> comes up, I will go with the one found on that page.

OK.

> However I don't find the phonetic keyboard there that useful since it
> has to put every character on one key. Using a combination of two
> keys which Emacs can do is more systematic and easy to remember (at
> least for me).

We could have both an input method reflected in the keyboard on that
page and what you think is a better way.  There are no limitations.

> >> 3) The key for 'w' is unused in the input method for now. I am tempted
> >> to bind a version of `insert-char` but restricted to Arabic range of
> >> Unicode to cover the rare cases not covered by the input method now. Any
> >> opinions about that?
> >
> > That key is assigned characters in the above keyboard page.
> 
> This was for the input method in the attached file which is my attempt at
> building a phonetic input method for Urdu taking some inspiration from
> farsi-transliterate-banan in Emacs.
> 
> However if you and other maintainers prefer to replicate more widely used
> keyboards (e.g. those on mobile devices) I will provide them instead.

I think it is best to support the layouts shown on the Internet, but
we could also have alternative input methods with other layouts, to
let users pick what they like best.

> >>  lisp/leim/quail/urdu.el | 193 ++++++++++++++++++++++++++++++++++++++++
> >>  1 file changed, 193 insertions(+)
> >>  create mode 100644 lisp/leim/quail/urdu.el
> >
> > Thanks, but I'd prefer not to create a new file.  How about adding
> > this to persian.el instead?
> 
> That is an option and another better one might be indian.el which is
> where input methods for languages from Indo-Pakistan subcontinent are
> now.

Adding to indian.el is fine by me.

> Another consideration for where it should go is that other major
> languages in Pakistan are also not represented among input methods.
> These include Punjabi (which I can speak a little but not write) which
> has two scripts: Emacs has a input methods for gurmukhi but not
> shahmukhi https://en.wikipedia.org/wiki/Shahmukhi , although Wikipedia
> indicates that an Urdu input method should be sufficient. There are also
> 
> Saraiki: https://en.wikipedia.org/wiki/Saraiki_language
> Sindhi: https://en.wikipedia.org/wiki/Sindhi_language
> Pashto: https://en.wikipedia.org/wiki/Pashto_alphabet
> Balochi: https://en.wikipedia.org/wiki/Balochi_Standard_Alphabet
> 
> Which all use a script similar to Urdu/Farsi/Arabic one but with
> variation that might benefit from a different input method.

If you intend to work on these other scripts soon, we could start a
new file for languages in Pakistan.  What I would like to avoid is
having a separate file with just one or two methods, if for some
reason the rest will never materialize in Emacs.

> >> +(quail-define-package
> >> + "urdu-phonetic" "Urdu" "اردو صوتی"
> >> + `((?a . "a → ا , A → آ , ax → أ , u → ع")
> >> +   (?y . "y → ی , e → ے , i → ئ")
> >> +   (?r . "r → ر , R → ڑ")
> >
> > Besides the ` vs ' issue, I doubt that this kind of GUIDANCE is a good
> > idea.  Emacs input methods have a standardized way of showing
> > candidates and the keys to select them, so I would prefer to stick to
> > the standardized guidance format instead.  In particular, showing the
> > translations of both upper- and lower-case keys is not a good idea, I
> > think.
> 
> I am a native Urdu speaker but I have never typed Urdu seriously until
> recently which is why I tried to make an input method for it. I think
> for a phonetic input method such disambiguation from guidance string
> will be very helpful for me at least while I need these training wheels.
> So if possible I would like to have it at least for my personal use. But
> as I said earlier I can't make it work with either ` or '.

I suggest to try similar input methods, for example tamil-phonetic.  I
find this guidance very simple to use and understand, so I think we
should try to stick to it where possible.