Bug 105168

Summary: A new keyboard layout: Hanyu Pinyin, PRC's romanization of Chinese
Product: xkeyboard-config Reporter: Mingye Wang (Arthur2e5) <arthur200126>
Component: GeneralAssignee: xkb
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: medium    
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Pinyin keyboard patch, initial submission.
Correct the misplaced addition
Update with "middleperiod" on Altgr-grave

Description Mingye Wang (Arthur2e5) 2018-02-20 00:11:46 UTC
Created attachment 137447 [details] [review]
Pinyin keyboard patch, initial submission.

Hi,

The attached patch contains a keyboard layout for Hanyu Pinyin (ISO 7098), a Chinese romanization method used officially in China and widely used in education.

Typing Hanyu Pinyin can often be difficult for learners as well as educators since there's not many good tools for doing so on, well, desktop computers in general. By contributing this addition I hope to improve the conditions for Linux/X11 users and to some extent other users using XKB's layout data via e.g., libxkbcommon.

To simplify learning, numeric keys n ∈ {1..4} corresponding to the nth tone are used for dead keys. Those dead keys are put on Level 3 (AltGr). Level 4 (AltGr+Shift) currently produces the raw diacritics, but that can change if we end up finding a better use in this report.

As mentioned in the comment block before the layout, this patch is partially blocked by bug 105167 (zh_CN.UTF-8 has a blank Compose file).
Comment 1 Mingye Wang (Arthur2e5) 2018-02-20 00:16:56 UTC
Comment on attachment 137447 [details] [review]
Pinyin keyboard patch, initial submission.

Review of attachment 137447 [details] [review]:
-----------------------------------------------------------------

::: xkeyboard-config-2.21/rules/base.xml.in
@@ +2338,5 @@
> +          <configItem>
> +            <name>altgr-pinyin</name>
> +            <_description>Hanyu Pinyin (altgr)</_description>
> +            <languageList>
> +              <iso639Id>chi</iso639Id>

I was not very sure about this one. Although it's designed to be partially extendable for "dialects" (i.e. other Chinese languages), Hanyu Pinyin is mostly restricted to Putonghua, i.e. Mandarin (cmn). There's also the problem of Pinyin not being a primary form of writing out the language, but I am not sure whether I can do a -Latn script tag here.

::: xkeyboard-config-2.21/symbols/cn
@@ +208,5 @@
> +//
> +// Number row keys 1 2 3 4 are defined as dead-keys for the tones.
> +// They correspond to the four tones in Hanyu Pinyin.
> +//
> +// To generate a raw ü, use AltGr + v.

Bugzilla isn't exactly good at UTF-8, is it...
Comment 2 Mingye Wang (Arthur2e5) 2018-02-22 01:14:10 UTC
Correction: zh_CN.UTF-8 has all the composes from en_US.UTF-8. The blocker is invalid.
Comment 3 Sergey V. Udaltsov 2018-04-22 15:52:06 UTC
pushed to git, thank you!
Comment 4 Mingye Wang (Arthur2e5) 2018-04-22 16:14:47 UTC
Ah, thanks! I hope the blunder I added about missing COMPOSE for zh is removed too?
Comment 5 Sergey V. Udaltsov 2018-04-22 16:17:08 UTC
Err... sorry, I just used your patch as is.
Comment 6 Mingye Wang (Arthur2e5) 2018-04-22 16:20:23 UTC
Ah, apologies for bringing that up again. Now I look at it the chunk is actually fine -- it does not say zh COMPOSE is bad or anything. Merging as-is should be fine. Sorry again.
Comment 7 Sergey V. Udaltsov 2018-04-26 22:23:36 UTC
We have a problem here... With your patch, the code is in symbols/cn. but in base.xml.in it is added to dz layout. Could you please attach the fixing patch? Thank you
Comment 8 Mingye Wang (Arthur2e5) 2018-04-26 22:43:00 UTC
Created attachment 139152 [details] [review]
Correct the misplaced addition

Oops, it must be those drifting line numbers and the useless XML contexts! Let me go for "diff -U 7" instead...
Comment 9 Sergey V. Udaltsov 2018-04-26 22:48:35 UTC
Thank you, that was quick. And I updated the group name in the symbols/cn file. Please check from git
Comment 10 Mingye Wang (Arthur2e5) 2018-04-28 03:46:34 UTC
Created attachment 139184 [details] [review]
Update with "middleperiod" on Altgr-grave

Sorry for reopening, but I was reminded that people use the "middle dot" to express neutral sounds in Hanyu Pinyin. This short follow-up patch adds a middle dot for AltGr+grave. Grave/tilde was chosen in part because most Chinese input methods map it to the "middle dot".
Comment 11 Mingye Wang (Arthur2e5) 2018-05-02 16:06:22 UTC
Oops, turns out there are a lot of things to add anyway. Let me just open a new bug for the update.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.