javajavadocmultilingual

How to create multi-language JavaDocs?


There is JavaDoc of a normal Java API with an English edition and a Chinese edition, but it seems to require having separate source code for each edition. Is there any more convenient way to do this?


Solution

  • No, there is essentially no way of doing this.

    The only work-around that comes to mind applies to the generated HTML pages: you could surround the JavaDocs in block elements that toggle between languages using CSS. Consider:

    /**
     * <div class="en">Documentation in English</div>
     * <div class="nl">Documentatie in Nederlands</div>
     */
    public void myFunction() {}
    

    Subsequently edit the CSS of the JavaDocs so that the user can switch languages, e.g.:

    div.en { display:none; }
    div.nl { display:block; }