How to generate a translated javadoc with javadoc.exe? (not the content, but the structure)

java, javadoc, translation

Solution

We had to do that on a project of ours. This is what we did:

First, we decompiled the following classes from Java's `tools.jar` file:

- com\sun\tools\doclets\formats\html\resources\standard.class

- com\sun\tools\doclets\internal\toolkit\resources\doclets.class

Those two classes act like `.properties` files: their only method returns an array of keys-values pairs of strings.

Most of those strings are the ones that appear on the HTML files created by Javadoc, such as the navigation bar, section headers and help page.

After translating the files, we renamed them, adding _pt_BR to their names.

We also changed the name of their classes, also adding _pt_BR.

Finally, we compiled the files and put them into `tools.jar`, on their correct packages.

After that, the HTML output from Javadoc was presented in Portuguese.

Problem

I'm working on a pt_BR project that provides a final user API to extends functionalities. I need to generate the javadoc of this classes (in Java), but, when using javadoc.exe the static texts, not the content, of the output document is in English. So, I want to generate the documentation in `pt_BR`. I tried to use like this: ``` javadoc -locale pt_BR -sourcepath scr -d c:\TEMP ``` But it didn't work. Note: Just to be clear, I'm not intent to translate the content (that is already in `pt_BR`) but the static texts (the navigation bar, titles, etc). How can I do that?

Original source