用非英语语言编写 Java,例如西班牙语或日语
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17743108/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Coding Java in non english language, for eg Spanish or Japanese
提问by Abhilash
Is it possible to code Java in a language other than English?. I am not asking about the logs messages which may be shown in another language. If possible does it requires a different compiler ( or JDK with different language support).?
是否可以用英语以外的语言编写 Java 代码?我不是在询问可能以另一种语言显示的日志消息。如果可能,它是否需要不同的编译器(或具有不同语言支持的 JDK)。?
回答by Insane Coder
Go through this para if you know some theory about compilers otherwise read next para
.
When a compiler is to be written,keywords and other symbols are already pre-defined and the lexical analyzer matches them and stores them in the symbol table and subsequent phases are then followed before finally developing a machine code.
Go through this para if you know some theory about compilers otherwise read next para
. 在编写编译器时,关键字和其他符号已经预先定义,词法分析器将它们匹配并将它们存储在符号表中,然后在最终开发机器代码之前进行后续阶段。
The answer to your question is both NO
and YES
.
你的问题的答案是NO
和YES
。
NO
because James Gosling and his team
developed Java JDK with English keywords so you have to follow that if you are using his JDK.
NO
因为James Gosling and his team
Java JDK是用英文关键字开发的,所以如果你使用他的JDK,你必须遵循它。
YES
because you can develop your own Java Compiler with different keywords in different language.But that will definitely not be called Java Compiler but another compiler using OOPS concepts.
YES
因为您可以使用不同语言的不同关键字开发自己的Java Compiler。但这绝对不会称为Java Compiler,而是另一个使用OOPS 概念的编译器。
回答by Vinothkumar Arputharaj
I have one suggestion. you define a word mapping to map all the available, acceptable java keywords to your language.
我有一个建议。您定义一个词映射来将所有可用的、可接受的 java 关键字映射到您的语言。
public => publique
static => statique
like this. Then do word processing. convert your language to english in background and generate java files in english language. Compile those java classes.
像这样。然后进行文字处理。在后台将您的语言转换为英语,并以英语生成 java 文件。编译那些java类。
I'm not verymuch confident about this approach. This may give a small idea. Pardon me if I'm talking something else than what you are looking for. If you have any thoughts on it, kindly let me know. I'm interested working in this project.
我对这种方法不是很有信心。这可能会给出一个小想法。如果我说的不是你要找的东西,请原谅我。如果您对此有任何想法,请告诉我。我对这个项目很感兴趣。
回答by NINCOMPOOP
No. You can name the identifiers whatever you like , provided they are legal as per the language specs, but the keywords,API methods etc. will always be the same. They should be used in its original form. Hence you cannot substitute the Spanish equivalent of word throwin place of throw
in Java .
没有。您可以随意命名标识符,前提是它们根据语言规范是合法的,但关键字、API 方法等将始终相同。它们应该以其原始形式使用。因此,您不能用西班牙语中的单词throw代替throw
Java 。
Probably read Grammars.
大概读过语法。
回答by Iren Patel
This is Not Possible. Java Code write in only English Language.
这不可能。Java 代码仅用英语编写。