Leading Project for Biosimulation > Cell/Biodynamics Simulation > simBio
 

Bilingual Feature

Javadoc taglets for separating English and Japanese API documentation

Introduction

simBio use inline taglets to produce separate English and Japanese API documentation from Java source code which contains both languages in the comments. More information about the taglets can be found here.

Configuration

To use taglets, the javadoc package, which is in the Java SDK's lib/tools.jar file, must be added to the build path. To add tools.jar to the build path follow the instruction, Add tools.jar User Library.

Writing comments using taglets

In the source code, English comments should be written between "{@.en" and "}", and Japanese comments should be written between "{@.ja" and "}", as in the example below:

/**
 * {@.en This is a javadoc taglet writing test. }
 * {@.ja javadocドキュメントをNLS化ã?™ã‚‹ä¸€èˆ¬çš„ã?ªæ–¹æ³•ã?¯ã€? ã?‚る言語 (主言語) ã?§ç”Ÿæˆ?ã?•ã‚Œã?Ÿjavadocドキュメントをã??ã?®ä»–ã?®è¨€èªž (副言語) ã?«ç¿»è¨³ã?™ã‚‹ã?“ã?¨ã?§ã?™ã€‚}
 */

Each taglet should contain only one sentence, to make sure that it is parsed correctly.

Running Javadoc with taglets

The simBio project contains four classes that implement the com.sun.tools.doclets.Taglet interface: EnOff, EnOn, JaOff and JaOn. To generate Japanese documentation, JaOn and EnOff are added to the Javadoc command, and for English documentation EnOn and JaOff are added instead. In Eclipse you can create Javadoc using the menu or with an Ant build.xml file. In simBio, these taglets have been added to the Javadoc command in simBio's Ant build.xml files.

The example below are from the simBio/build.xml file and this will produce English documentation.

<taglet name="org.simBio.util.taglets.EnOn"
	path="${build.classes}" />
<taglet name="org.simBio.util.taglets.JaOff"
	path="${build.classes}" />