Jump to content
Chinese-Forums
  • Sign Up

Pinyinput - Type Pinyin with Tone Marks


imron

Recommended Posts

Hey Imron, there was some talk upthread about the need to use an English locale to get the correct fonts in Word.

Did you consider making the input locale "English (Singapore)"? It's an available locale in Windows, and it might make more sense than English (Australia) or English (Canada), since Chinese is an official language of Singapore (though I don't think they have an official romanisation).

By the way, you deserve an award just for the name "pinyinput". How did anyone not come up with that before?

Link to comment
Share on other sites

The English locale is required to make Word and a couple of other Microsoft programs (e.g. Wordpad) not automatically change to a Chinese font for characters outside the standard ASCII range (e.g. any character with a tone mark over it), which these programs will do if the input locale is Chinese.

So I made the installation choice for input locale to be one of Chinese (Simplified PRC), Chinese (Traditional Taiwan), English (Australia), or the default locale of your computer - which in your case appears to be English (Canada) :)

So, any user who has English (Singapore) as their default locale will be able to choose that if they wish. I didn't want to force a random locale on anyone as it may have created other problems and also complicates things for non-technical users, and I figured the above options made the most amount of sense with the possible exception of English (Australia) which I put to provide an English option for users whose default locale wasn't English, and chose over more common varieties such as English (UK) or English (US) more to fly the flag than anything else :mrgreen:

By the way, you deserve an award just for the name "pinyinput". How did anyone not come up with that before?

My one tiny regret was not registering the domain name - which was free both at the time and for about a year after Pinyinput's release. Oh well, only myself to blame for that.

Link to comment
Share on other sites

I just wish MS had put a bit more thought into their automatic font changing logic in Word and made it change fonts for any Chinese character rather than just any non-ASCII character. It would have saved a whole lot of trouble as it took a good amount of poking around and trickery to get dynamic locale selection working. Not sure what it's like with the TSF, but the old IME API wants IMEs to set a single locale at compile time and be done with it. In the end I had to overwrite the VS_VERSION_INFO stucture of the IME dll manually before installing it.

Link to comment
Share on other sites

There are 4 different places in installer that will produce that error message, but from the error message alone it's difficult to know which one caused it exactly. If I supplied you with a debug version of the installer would you be happy to try running that so that I can get some logging information to find out which of them is causing the problem?

Link to comment
Share on other sites

  • 3 weeks later...

Not to piss on anybody's strawberries but this can be accomplished with Autohotkey_L in just a few minutes, totally bug-free, no need to install anything (assuming you already use Autohotkey_L) and best of all no need to switch input methods or worry about locales, etc, as you can type simultaneously not just pinyin but also several other languages if you so wish.

The following code is what I use for entring pinyin. It works with all upper, lower and mixed case and works similar to imron's Pinyinput. You can of course add code to input French, German and Spanish characters, as well as other commonly used characters such as €£¥°© on the fly without having to mess around e.g. on my system I type © I just type out hscopy (hs stands for hotstring). Anyway here's the code for pinyin.:

#If (PinyinEnabled & !WinExist("ahk_class SoPY_Status"))
:*?:ai1::āi
:*?:ai2::ái
:*?:ai3::ǎi
:*?:ai4::ài
:*?:ei1::ēi
:*?:ei2::éi
:*?:ei3::ěi
:*?:ei4::èi
:*?:i1::ī
:*?:i2::í
:*?:i3::ǐ
:*?:i4::ì
:*?:ao1::āo
:*?:ao2::áo
:*?:ao3::ǎo
:*?:ao4::ào
:*?:o1::ō
:*?:o2::ó
:*?:o3::ǒ
:*?:o4::ò
:*?:ou1::ōu
:*?:ou2::óu
:*?:ou3::ǒu
:*?:ou4::òu
:*?:u1::ū
:*?:u2::ú
:*?:u3::ǔ
:*?:u4::ù
:*?:a1::ā
:*?:a2::á
:*?:a3::ǎ
:*?:a4::à
:*?:e1::ē
:*?:e2::é
:*?:e3::ě
:*?:e4::è
:*?:v1::ǖ
:*?:v2::ǘ
:*?:v3::ǚ
:*?:v4::ǜ
:*?:an1::ān
:*?:an2::án
:*?:an3::ǎn
:*?:an4::àn
:*?:en1::ēn
:*?:en2::én
:*?:en3::ěn
:*?:en4::èn
:*?:in1::īn
:*?:in2::ín
:*?:in3::ǐn
:*?:in4::ìn
:*?:un1::ūn
:*?:un2::ún
:*?:un3::ǔn
:*?:un4::ùn
:*?:vn1::ǖn
:*?:vn2::ǘn
:*?:vn3::ǚn
:*?:vn4::ǜn
:*?:ang1::āng
:*?:ang2::áng
:*?:ang3::ǎng
:*?:ang4::àng
:*?:eng1::ēng
:*?:eng2::éng
:*?:eng3::ěng
:*?:eng4::èng
:*?:ing1::īng
:*?:ing2::íng
:*?:ing3::ǐng
:*?:ing4::ìng
:*?:ong1::ōng
:*?:ong2::óng
:*?:ong3::ǒng
:*?:ong4::òng
:*?:er1::ēr
:*?:er2::ér
:*?:er3::ěr
:*?:er4::èr
#If

Then what you do is assign a hotstring or hotkey to toggle the PinyinEnabled flag if you need to disable pinyin input i.e. if you want to type ni3 hao3 instead of nǐ hǎo. The above code also checks to see if Sogou input method is active, in which case it has no effect. On my system I switch between Chinese and English input methods using the hotstring "SDF" and toggle pinyin input on and off using the hotstring "FDS", by means of the following code.

;Toggle Sogou Chinese input language
:*?:sdf::
SetCapsLockState, Off ;Turn off CapsLock, so you can type Chinese straightaway
SendInput {Alt Down}{Shift Down}{Shift Up}{Alt Up}
Return
:*?:fds::PinyinEnabled := !PinyinEnabled

I highly recommend Autohotkey_L to everybody! It's the best thing that happened to Windows and the reason why I don't use a Mac.

Edit: I humbly apologise if this post looked like I was trying to say that my app was better than Imron's. Imron's Pinyinput was created way before Authotkey_L existed, so kudos to Imron for his slefless coding effort. If Autohotkey_L didn't exist I'd be using Pinyinput no doubt. :P

Link to comment
Share on other sites

totally bug-free

P.S. what happens if you type in rang4bu4?

(not trying to be mean, actually I think this looks like a pretty neat tool, and would probably even try it myself if I wasn't a Mac convert - well, that and I'm not really a fan of running random files downloaded from the Internet that my antivirus software flags as malware :mrgreen:).

Link to comment
Share on other sites

Thanks Imron! Well spotted, that was actually a typo in my code, sorry... :mrgreen: If you type rang4bu4 you get ràngbù. I accidentally typed an s after ang when I hit Ctrl-S to save. Fixed. I have still called it v1.02 rather naughtily though, as I don't think many people will have downloaded it.

Link to comment
Share on other sites

Join the conversation

You can post now and select your username and password later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Click here to reply. Select text to quote.

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...