You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Thorsten Schäfer <Ne...@ThorstenSchaefer.de> on 2003/01/20 17:37:55 UTC

Separating settings from texts in Ressources

Hi,

I'm using a properties file in which there are some settings (name of
database, ...) and also a lot of text to show in the JSPs. If I want to
i18n my application, I've to translate these text. Is there a way to
separate the settings from the text?

TIA,

Thorsten



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Separating settings from texts in Ressources

Posted by Attila Szegedi <sz...@freemail.hu>.
When you're using resource bundles, you can place language-neutral settings
in a language-neutral bundle. I.e. you place language-dependent things in
myBundle_en.properties, myBundle_de.properties, myBundle_es.properties, etc.
and place language-neutral settings into myBundle.properties. When something
is not found in a language-specific bundle, it'll get looked up in the
language-neutral bundle.

--
Attila Szegedi
home: http://www.szegedi.org


----- Original Message -----
From: "Thorsten Schäfer" <Ne...@ThorstenSchaefer.de>
To: "'Struts Users Mailing List'" <st...@jakarta.apache.org>
Sent: 2003. január 21. 10:32
Subject: RE: Separating settings from texts in Ressources


> Hi,
>
> > > I'm using a properties file in which there are some settings (name
> of
> > > database, ...) and also a lot of text to show in the JSPs. If I want
> to
> > > i18n my application, I've to translate these text. Is there a way to
> > > separate the settings from the text?
> >
> > This function is pretty much what the <bean:message> tag is for.  You
> keep
> > your various translations in properties files, and the tag picks the
> > correct one based on the Locale associated with this user.
>
> Yes, I'm using <bean:message> and it works. But the problem is, that
> these messages are located in the Application.properties file. But there
> are also other properties located there, which aren't messages, like the
> database name for example. If I use i18n, I'll create other properties
> files, which contain also these settings. So if I want to change the DB
> name, I've to change it n times. That's why I'm searching for a
> solution, to use two properties files: one for the settings and one for
> the messages. But how can I write this in my struts.config?
>
> Greetings,
>
> Thorsten
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Separating settings from texts in Ressources

Posted by Thorsten Schäfer <Ne...@ThorstenSchaefer.de>.
Hi,

> > I'm using a properties file in which there are some settings (name
of
> > database, ...) and also a lot of text to show in the JSPs. If I want
to
> > i18n my application, I've to translate these text. Is there a way to
> > separate the settings from the text?
> 
> This function is pretty much what the <bean:message> tag is for.  You
keep
> your various translations in properties files, and the tag picks the
> correct one based on the Locale associated with this user.

Yes, I'm using <bean:message> and it works. But the problem is, that
these messages are located in the Application.properties file. But there
are also other properties located there, which aren't messages, like the
database name for example. If I use i18n, I'll create other properties
files, which contain also these settings. So if I want to change the DB
name, I've to change it n times. That's why I'm searching for a
solution, to use two properties files: one for the settings and one for
the messages. But how can I write this in my struts.config?

Greetings,

Thorsten


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Separating settings from texts in Ressources

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Mon, 20 Jan 2003, Thorsten Schäfer wrote:

> Date: Mon, 20 Jan 2003 17:37:55 +0100
> From: Thorsten Schäfer <Ne...@ThorstenSchaefer.de>
> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> To: 'Struts Users Mailing List' <st...@jakarta.apache.org>
> Subject: Separating settings from texts in Ressources
>
> Hi,
>
> I'm using a properties file in which there are some settings (name of
> database, ...) and also a lot of text to show in the JSPs. If I want to
> i18n my application, I've to translate these text. Is there a way to
> separate the settings from the text?
>

This function is pretty much what the <bean:message> tag is for.  You keep
your various translations in properties files, and the tag picks the
correct one based on the Locale associated with this user.

For an example of this in action, deploy the struts-example webapp (from
1.1b3) and change your browser preferences to Japanese.  The Japanese
resourcess will be used automatically.

> TIA,
>
> Thorsten

Craig


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>