6

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?

3
  • 2
    Look into doclets (no, not chocolates, doclets). OTOH note that English is commonly said to be the 'lingua franca' of programming, and that source and especially documentation would then be expected to be in English. Commented Aug 22, 2012 at 13:38
  • I know (and agree) that programming should be in English, and, all the methods name, and classes, in this case, are in English. But, when we are talking about documentation, if you are developing to a especific kind of public, its better (and in this case, its demanded) to be in there native language. I did look (a litle) about doclets, but I hope that someone that had the same problem may share the final solution. Thanks for the answer. Commented Aug 22, 2012 at 13:55
  • Cool. I have not used doclets myself, so cannot give any further info. Best of luck with it. :) Commented Aug 22, 2012 at 14:25

2 Answers 2

3

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.

Sign up to request clarification or add additional context in comments.

Comments

1

You will have to find the properties files in your jdk and translate them. I think they are located at tools.jar. I only found the JDK 1.3 Doclet sources on the net. They might give you a hint on the needed property files.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.