Japanese Language Stack Exchange is a question and answer site for students, teachers, and linguists wanting to discuss the finer points of the Japanese language. It's 100% free, no registration required.

Perhaps we could expand this question to include all Japanese on what's the most commonly used scheme they use when forced / choose to type in romaji on computer?
–
LukmanOct 3 '11 at 7:05

really not sure what you mean by "in code" (comments? variable names?), but the answer lies more in encoding and compiler issues (the vast majority of languages only support ascii character in parsable code). Little to do with Japanese usage at any rate.
–
Dave♦Oct 3 '11 at 7:19

@Dave: Actually, Unicode identifiers are supported in some of the more recent popular languages like Java and C#. There are thousands of programming languages out there, but most code is written in just a few...
–
Zhen LinOct 3 '11 at 9:25

2 Answers
2

I agree with Matt that there's no fixed standard about which romanization scheme to use. My guess is that it depends on the project, author, term and the author's swing of mood at the moment, just as in any other context of Japanese romanization.

[Personal point-of-view] If I were to use a Japanese variable name, I'd use Hepburn-style romanization, because it feels more phonetically consistent. However, when typing hiragana/kanji text through an IME, I mostly use Nihon-shiki to save keystrokes. [/Personal point-of-view]

Now be warned, my point-of-view can be biased, especially the first part, according to my work-partner. Let me share his story here.

I first asked him why his code is entirely in English, although he's not very fluent in it. He answered:

That's because at the first company I worked for, about ten or more years ago, the predominant attitude toward Japanese naming in source code was "embarrassing." (はずかしい)

To be precise, there were two groups of programmers in the game industry then:
(1) Those who habitually used Japanese. (2) Those who thought it embarrassing. I don't know but there seemed to be a trend going against using Japanese among the younger programmers around that time.

Me: Were there any fixed way to romanize those Japanese variables? Like tsu vs tu?

Yeah, they used tu [Nihon-shiki] exclusively. I think that's all they knew, what they learned at school. [*]

Me: But what about fuga, as in hoge, fuga, piyo? (Common metasyntactic variable names among Japanese programmers.) Shouldn't it be huga, if you want to be consistent?

Ah, these came from an entirely different class of programmers, those who'd been in the field for ages, near-bilingual, programming-language-lovers. They know English, they're very careful about spelling. We [game programmers] didn't know or care about these meta-vars. We'd just use a if we needed a placeholder.

So to recap, any of the following can affect the choice of romanization scheme: perceived phonetical consistency, keystroke efficiency, local culture, school curriculum, or convention. (Again be warned that this nice-looking summary is the result of a survey with a sample count of only 2.)

[*] Kunrei-shiki, a variant of Nihon-shiki, in fact, is the one taught in elementary schools. ref: wikipedia

@KarlKnechtel "onomatopoeia" - Exactly. Japanese has separate terms for sound imitation words (ぎおんご) and sight imitation words (ぎたいご) and I hoped to capture both by "imitative". But all the English definitions of "imitative word" I can find seem to lean towards sound imitations. hummm
–
entoOct 5 '11 at 1:41

I don't think that there is an absolute industry standard ("programmers" can't even agree on the best way of indenting code...), but in my admittedly limited experience, Word-processor-style, influenced by Nihon-shiki, is most common. Thus, 東京 is "toukyou" and "情報" is "zyouhou", "普通" is "hutuu".

Pure speculation: This might be because if you romanize things this way, it's exactly the same as entering the words in your IME (without the IME step, of course), and so the amount of effort required is minimal.

(Incidentally, I am talking about function and variable names here, in languages where these can be set relatively freely, like C++ and Ruby.)

I agree that the romanization in code probably comes from romanization used in IMEs. However, IMEs accept both “zyouhou” and “jouhou,” and therefore I do not know whether/why many people choose Nihon-shiki romanization.
–
Tsuyoshi ItoOct 3 '11 at 10:31

@TsuyoshiIto That's a good point. In general I concur with ento's (superior) answer: the people I'm thinking of are relatively young and don't care about English at all, so it doesn't bother them that English speakers would find "joho" easier to read than "zyoho". They just go with the logical system that they learned in school (at least in the years they weren't taught by a teacher who preferred Hepburn or whatever).
–
MattOct 3 '11 at 23:48