Localize form




I have a problem with localize form. Please, help my, how I can do this.

Situation is nest:

In form there are two text field element. All element contains caption. In application (Java based) user can switch between different locale (language) and form must be generated in selected locale. How I can do this?

1. Create different template files (xdp) for different locale.

2. Set caption for fields in xml data file which will be used when form generated.

But this methods not optimal. What about resource files which uses in all languages? May be there is a different way to do this more "beautifully"?