You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Joe Yuen <jo...@chisq.com> on 2007/05/30 22:16:18 UTC

Multi lingual web site

I am trying to build a mutilingual website. I'm currently using a resource file and that all work great except for some select boxes the data comes from the database where the data is in english. I was wondering how other people handle this situation? Should I have the same table also store the same words in spanish for example? Any ideas?Suggestions?
 
 
Thanks,
-Joe


Re: Multi lingual web site

Posted by Roger Varley <ro...@googlemail.com>.
>
> Using the locale, you should be able to construct a SQL query to load
> the correct data from the table structure I mentioned.
>

Or you could add language choice as a user selectable option on either
your login page (if you use a login) or on your "home" page.

Regards
Roger

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Multi lingual web site

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Joe,

Joe Yuen wrote:
> How does one detect which language and country is selected?

Since you are posting to the Struts mailing list, I would imagine that
you are using Struts. Struts 1.x allows you to grab the user's Locale by
using Action.getLocale(HttpServletRequest).

Using the locale, you should be able to construct a SQL query to load
the correct data from the table structure I mentioned.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGXe0H9CaO5/Lv0PARAkXSAJ9ROGo9mYMmTid2e0Oq9Vw2AEzAQwCffleL
cdidIIhks83iWO/OUDGQT3A=
=Ydlm
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Multi lingual web site

Posted by Joe Yuen <jo...@chisq.com>.
Thanks Chris.
 
How does one detect which language and country is selected?

________________________________

From: Christopher Schultz [mailto:chris@christopherschultz.net]
Sent: Wed 5/30/2007 1:37 PM
To: Struts Users Mailing List
Subject: Re: Multi lingual web site



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Joe,

Joe Yuen wrote:
> I'm currently using a
> resource file and that all work great except for some select boxes
> the data comes from the database where the data is in English. I was
> wondering how other people handle this situation?

You'll need your tables to accommodate other languages. I usually do
something like this:

CREATE TABLE foo
(
    id INTEGER NOT NULL, -- the PK
    ...
)
;


CREATE TABLE foo_text
(
    foo_id INTEGER NOT NULL,   -- PK(1)
    language CHAR(2) NOT NULL, -- PK(2)
    country CHAR(2) NULL,      -- PK(3)

    -- text fields go here, and are localized
)
;

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGXeCB9CaO5/Lv0PARAmWsAKCsAHjVQmfnK8WxWkW65zRcoiZsSwCfaWFg
xZUX4rFBrn5MdvZjNrqYYbw=
=YWFU
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org





Re: Multi lingual web site

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Joe,

Joe Yuen wrote:
> I'm currently using a
> resource file and that all work great except for some select boxes
> the data comes from the database where the data is in English. I was
> wondering how other people handle this situation?

You'll need your tables to accommodate other languages. I usually do
something like this:

CREATE TABLE foo
(
    id INTEGER NOT NULL, -- the PK
    ...
)
;


CREATE TABLE foo_text
(
    foo_id INTEGER NOT NULL,   -- PK(1)
    language CHAR(2) NOT NULL, -- PK(2)
    country CHAR(2) NULL,      -- PK(3)

    -- text fields go here, and are localized
)
;

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGXeCB9CaO5/Lv0PARAmWsAKCsAHjVQmfnK8WxWkW65zRcoiZsSwCfaWFg
xZUX4rFBrn5MdvZjNrqYYbw=
=YWFU
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Multi lingual web site

Posted by Martin Gainty <mg...@hotmail.com>.
encode as UTF-16
Good Luck,

This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.

----- Original Message ----- 
From: "wang huan" <fi...@gmail.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Wednesday, May 30, 2007 9:16 PM
Subject: Re: Multi lingual web site


> We usually have several resource files, and output fields with  tag
> <bean:message key="key_in_resource_file" />.  Instead of storing values, 
> we
> store those keys in DB.
>
> for instance:
> <html:select property="attributeStyle">
>              <html:option value="pagecontent.date"><bean:message key="
> pagecontent.date"/></html:option>
>              <html:option value="pagecontent.string"><bean:message key="
> pagecontent.string"/></html:option>
>              <html:option value="pagecontent.integer"><bean:message key="
> pagecontent.integer"/></html:option>
>             </html:select>
>
>
> -- 
> 北半球的狗几月份掉毛?
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Multi lingual web site

Posted by wang huan <fi...@gmail.com>.
We usually have several resource files, and output fields with  tag
<bean:message key="key_in_resource_file" />.  Instead of storing values, we
store those keys in DB.

for instance:
<html:select property="attributeStyle">
              <html:option value="pagecontent.date"><bean:message key="
pagecontent.date"/></html:option>
              <html:option value="pagecontent.string"><bean:message key="
pagecontent.string"/></html:option>
              <html:option value="pagecontent.integer"><bean:message key="
pagecontent.integer"/></html:option>
             </html:select>


-- 
北半球的狗几月份掉毛?

RE: Multi lingual web site

Posted by Jon Cruz <Jo...@ncen.com>.
Hello,

There are a few ways I've gotten around this:

1. Store the other languages in the same table that populates the
"select" control.  In the future, if you add more languages to your
site, you just add to that table.  (Which would be similar to adding
another resource file for that new language.)

2. If the "select" controls have a few "options" associated with them,
you could use a Map to populate the "select" control.  This Map could be
generated within your Action, and could be populated using the
appropriate resource, (according to the language/Locale that the user
requires).  Again, it all depends on how many "options" your "select"
has.  I use it for those "selects" that have no more than 10 "options".


Jon 

-----Original Message-----
From: Joe Yuen [mailto:joe.yuen@chisq.com] 
Sent: Wednesday, May 30, 2007 1:16 PM
To: Struts Users Mailing List
Subject: Multi lingual web site

I am trying to build a mutilingual website. I'm currently using a
resource file and that all work great except for some select boxes the
data comes from the database where the data is in english. I was
wondering how other people handle this situation? Should I have the same
table also store the same words in spanish for example? Any
ideas?Suggestions?
 
 
Thanks,
-Joe


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org