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}" />