Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to internationalize java source code?
    primarykey
    data
    text
    <p><strong>EDIT</strong>: I completely re-wrote the question since it seems like I was not clear enough in my first two versions. <strong>Thanks for the suggestions so far.</strong></p> <p>I would like to internationalize the <strong>source code</strong> for a tutorial project (please notice, not the runtime application). Here is an example (in Java):</p> <pre><code>/** A comment */ public String doSomething() { System.out.println("Something was done successfully"); } </code></pre> <p>in English , and then have the French version be something like:</p> <pre><code>/** Un commentaire */ public String faitQuelqueChose() { System.out.println("Quelque chose a été fait avec succès."); } </code></pre> <p>and so on. And then have something like a properties file somewhere to edit these translations with usual tools, such as:</p> <pre><code>com.foo.class.comment1=A comment com.foo.class.method1=doSomething com.foo.class.string1=Something was done successfully </code></pre> <p>and for other languages:</p> <pre><code>com.foo.class.comment1=Un commentaire com.foo.class.method1=faitQuelqueChose com.foo.class.string1=Quelque chose a été fait avec succès. </code></pre> <p>I am trying to find the easiest, most efficient and unobtrusive way to do this with the least amount of manual grunt work (other than obviously translating the actual text). Preferably working under Eclipse. For example, the original code would be written in English, then externalized (to properties, preferably leaving the original source untouched), translated (humanly) and then re-generated (as a separate source file / project).</p> <p>Some trails I have found (other than what AlexS suggested):</p> <ul> <li><a href="http://www.antlr.org/" rel="nofollow">AntLR</a>, a language parser / generator. There seems to be a supporting <a href="http://www.antlr.org/wiki/display/ANTLR3/Integration+with+Development+Environments#IntegrationwithDevelopmentEnvironments-%C2%A0Eclipse33forAntlr3x" rel="nofollow">Eclipse plugin</a></li> <li>Using <a href="http://www.eclipse.org/articles/article.php?file=Article-JavaCodeManipulation_AST/index.html#sec-how-to-apply-changes" rel="nofollow">Eclipse's AST</a> (Abstract Syntax Tree) and I guess building some kind of plugin.</li> </ul> <p>I am just surprised there isn't a tool out there that does this already.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload