As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
If this question can be reworded to fit the rules in the help center, please edit the question.

5

Just like programming in spanish/portuguese/whatever, code should always be written in english.
–
user1827Feb 10 '11 at 19:39

1

@M28 It's a bit different though when you have to use a foreign alphabet. Try to write a simple hello world app using the Greek alphabet for all the keywords.
–
biziclopFeb 10 '11 at 19:42

3

@M28: Just out of curiosity: are there any programming languages that have been designed for characters outside the latin alphabet? And if compilers allow for encodings other than ASCII, I guess even Java could be written with all symbols in Japanese, except for language keywords...
–
FrustratedWithFormsDesignerFeb 10 '11 at 19:43

2 Answers
2

In practice, most programming languages in active use outside of the US use keywords that resemble English, but it's important to realize that for the most part those of us who write code as native English speakers aren't really writing in "English", either.

There are a few dozen languages that actually support non-ASCII-range keywords and these are often designed to reduce the cognitive friction for non-English speakers trying to learn programming.

Additionally, some older implementations of languages that translate code into tokens (not true compiling), can spit out the same code in an editor using the, say, German equivalent; my first experience with Microsoft Office's VBA was like this when I was a student in Germany.

Many English-like programming languages, including C#, Java, and others, now allow variable names and method names in Japanese, as long as the source code is encoded in UTF-8 or another suitable encoding. It wasn't common to have even comments in Japanese in C, however, unless you were using a compiler that supported Shift-JIS or Unicode. String literals in C were almost always escaped using the literal encoding method unless you had an external resource file format to work with, as in Visual Studio.

In practice, many programs written by Japanese teams that don't expect to require maintenance outside of Japan are written with comments or javadoc/docstrings/etc. in Japanese. My wife generally writes code with a sort of Japanese-like English, using terms that didn't necessarily match my own use or understanding of English ("regist" for "post" or "story", regist_date for publication date), and occasional comments in Japanese or Janglish.

Most programs that have an international community around them, that originate in Japan, use some form of English naming convention. See, for example, Matz' source code for ruby.

What if the project doesn't know if they're going to release the source outside Japan? Like a video game developed in Japan. They sometimes don't know if an English publisher will want to release the game say in the US.
–
ZenoFeb 10 '11 at 20:13

@Zeno - That's internationalizing character strings the user will see. That's important to do even if the code is by and for English-speakers. Comments & variable names & internal language aren't really correlated unless the code is going to be released as an API.
–
GregFeb 10 '11 at 20:21

Not really, often times video games published outside Japan will include more features so the code is directly changed too. Like Final Fantasy VII included new bosses (Ruby WEAPON) in the US version but not the Japanese version.
–
ZenoFeb 10 '11 at 20:33

Are those new features language-dependent? What's the difference versus just marketing a different feature-set in Tokyo than in Nagoya?
–
GregFeb 10 '11 at 21:12

Like in the US, people sometimes make assumptions that their app will never be used outside of their country, and that sometimes results in code changes being necessary to release for other markets. But comments rarely need to be rewritten for localization processes if modern approaches to internationalization are used, because code is not generally touched by localizers.
–
JasonTrueFeb 10 '11 at 21:35

As someone who has programmed in Japan. I can honestly say that I have seen code in all forms. Most of the cleaner code that I have seen that was intended to be supported only by Japanese programmers had all of the comments and documentation in Japanese.

As for some of the horrendous code that I have seen, I remember seeing Java and (I believe) VB code that actually used kanji or katakana for variable names.