6

I'm writing this feature-request this so it gains some traction before I ask it on Meta StackOverflow. That's right, everyone, I need to see that this is wanted by the community so we can ask it there for the actual implementation.

What I think would be useful for our site is something that would help us insert pinyin tone marks. If you have a better idea, propose yours! Vote up the requests you like that are easier to use and nice to look at (design counts!) and vote down those who are the less easy to use.

4

I wrote a bit of Javascript that converts Pinyin with numbers to pinyin with tone marks. A demo is available on my website: http://shinyandnew.ca/pinyin_fixer.html

To use it, just type in the textarea like this

Ni3 hao3! Ta1 shi4 wo3de nv3peng2you2!

And it outputs

Nĭ hăo! Tā shì wǒde nǚpéngyóu!

The Javascript code on that page should be easy enough to understand and modify. It is currently a bit buggy but the algorithm for modifying a single word that contains pinyin-approved characters is sound.

I propose that this code be added to the markdown editor, perhaps with a flag to turn it on and off, so that it can be used easily while typing. It solves the problem of knowing which letter gets the tone, which characters are used for the tone marks, and how to input ü. It also works with capital letters. With a bit of tweaking it can be enhanced to work properly on letters as the words are typed.

Bugs:

  • It rescans the whole text with every keyup/down.
  • It doesn't allow you to write anything with the letter v in it.
  • While editing text in the middle (as opposed to appending at the end) it causes your cursor to jump around.
  • Probably many more.

But these are integration issues that would have to be addressed for the markdown anyway. In fact, maybe it could skip changing what the user is typing and simply apply in a formatting pass, the way bold and italics are applied now. Either way, I present that JavaScript file with its algorithm for use here.

  • I like yours. It's indeed easier to use and that's why I asked you to propose it. This way it could be implemented. :) The idea of turning it on/off could come in handy if we need to type the numbers or words with v. – Alenanno Mar 22 '12 at 22:41
2

Until this feature gets added to the Stack Exchange engine, Windows users can use pinyinput to type pinyin with tone marks.

Anybody know of an equivalent for GNU/Linux or Mac?

  • In MacOS, I just grabbed a keyboard definition file and added Pīnyīn tone marks as dead keys, with a software called Ukelele. (can be done manually too) – Petruza Mar 28 '12 at 14:22
1

One proposal would be a drop-down menu next to the standard buttons that we can open and then we can click-to-insert the vowels with pinyin tone marks. An example would be like this:

enter image description here

  • This would work but has the following drawbacks: 1. It's slow to use, because you have to stop typing to click on the character map. 2. Users need to remember which character gets the tone mark. If we use the dropdown approach I'd recommend just dropping down the four tones and having an algorithm apply it to the correct letter of the word. – Mr. Shiny and New 安宇 Mar 22 '12 at 18:23
  • Not very efficient, if it's for typing, it should stick to just key presses. – Petruza Mar 28 '12 at 14:24
1

I'd like to propose a variant for Mr Shiny and New tool.

Use the code he wrote but use a Markdown system to activate it. For example if **this** makes this, we could use another symbol to activate the pinyin.

For example writing

Ni3 hao3! $Ta1 shi4 wo3de nv3peng2you2!$

would give

Ni3 hao3! Tā shì wǒde nǚpéngyóu!

Only the text enclosed there would be tranformed, so we can still continue to write normal text as if we wish. :)

  • Good idea. $ is already used for mathjax though, so maybe something like ^^ ? – jsj Feb 20 '13 at 6:43
0

You can dump the Chinese into Google translate and see the pinyin with tone marks. There might be a feature in their API to just retrieve that information. Then we could tag anything in characters and have the pinyin automatically added after it.

  • I'm not sure about an automatic approach. Or at least, an automatic approach that is not controlled by us. I'd prefer it to be something internal, but that's just my opinion. :P – Alenanno Mar 23 '12 at 10:43
  • @Alenanno how about overridable – jsj Mar 23 '12 at 11:35
  • You mean still automatic but that can be manually fixed? – Alenanno Mar 23 '12 at 12:25
  • @Alenanno yep­­ – jsj Mar 25 '12 at 12:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .