You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by worookie <wo...@hotmail.com> on 2003/06/12 03:13:12 UTC

Locale property file

----- Original Message -----
From: "worookie" <wo...@hotmail.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Wednesday, June 11, 2003 5:41 PM
Subject: Re: getting started tutorial - Demo app


> Another question that I could not find an answer from Tapestry's website
or
> the archive of this forum.
> In Harish's demo, there is a file called "Registration.properties" for the
> Registration page component.
> I added another file called "Registration.properties.zh_TW".
> I assume the property file should work just like other java standard
> property files, which means the java program should automatically pick up
> the property file for the current Locale. In other words, if the
environment
> (of the server) is zh_TW (Taiwan), then Tapestry should use
> "Registration.properties.zh_TW" instead of "Registration.properteis".
> Unfortunately, it didn't execute as what I expected.
> So, my question is how and where I can tell Tapestry that the system's
> Locale is zh_TW (Taiwan).

I found an answer for my locale question. It's in Developer's Guide Section
3.
Tapestry's property files look like "Registration_zh_TW.properties" but not
like standard java property files ("Registration.properties.zh_TW").
Anyway, Tapestry still cannot correctly show the contents of my localized
property file. There must be an encoding/decoding problem somewhere.
I am going to try more and I will keep you guys updated... Thx

Rookie

Re: Locale property file

Posted by Mindbridge <mi...@yahoo.com>.
Hi,

> Thank you MB very much. I tried native2ascii and it works.

Great!

> By the way, I couldn't access the archive website news.gmane.org for about
> 24 hours. Is there any other way that I can read your previous post in the
> dev list about the char encoding?

You can also get links to archives of the Jakarta lists from here:
 http://jakarta.apache.org/site/mail2.html

Here is the archive of my message:
http://nagoya.apache.org/eyebrowse/ReadMsg?listName=tapestry-dev@jakarta.apache.org&msgNo=423

Please write to the -dev list if you have comments about it -- it is the
perfect place to discuss new features.

Best regards,
-mb


Re: Locale property file

Posted by worookie <wo...@hotmail.com>.
Thank you MB very much. I tried native2ascii and it works.

I look forward the improvement of charset encoding to Tapestry.

By the way, I couldn't access the archive website news.gmane.org for about
24 hours. Is there any other way that I can read your previous post in the
dev list about the char encoding?

Thank you.

Sincerely,

Rookie

----- Original Message -----
From: "Mindbridge" <mi...@yahoo.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Thursday, June 12, 2003 2:25 AM
Subject: Re: Locale property file


> Please see my post on charsets and encoding in the dev list archives (it
was
> sent sometime in the beginning of the month). This will be improved/fixed
> soon.
>
> Temporarily you can fix the issue by doing -Dfile.encoding=<your encoding>
> or doing -DDfile.encoding=utf-8 and using native2ascii on the text files.
> This is certainly not optimal, but it works.
>
> Best regards,
> -mb
>
> ----- Original Message -----
> From: "worookie" <wo...@hotmail.com>
> To: "Tapestry users" <ta...@jakarta.apache.org>
> Sent: Thursday, June 12, 2003 12:17 PM
> Subject: Re: Locale property file
>
>
> > Hi,
> >
> > I guess that I have narrowed down the lines of code that cause the
problem
> > of incorrectly displaying messages from property files.
> >
> > Please look at the code at:
> >
>
org.apache.tapestry.engine.DefaultComponentMessagesSource.readProperties(...
> > )
> > lines 253-255:
> >
> >             InputStream input = propertiesURL.openStream();
> >             result.load(input);
> >
> > where "propertiesURL" is java.net.URL and "result" is
> java.util.Properties.
> >
> > The problem comes from the method Properties.load(InputStream) which
> ALWAYS
> > assume the InputStream uses the ISO 8859-1 character encoding. So when
the
> > URL source is encoded by other than ISO 8859-1, then you might get
> troubles.
> > Well, most single-byte character encoding (such as English, French,
> Spanish,
> > Germany, etc) can still survive the ISO 8859-1 translation because they
> are
> > all single-byte data. Unfortunately, when the source is encoded by
2-byte
> or
> > 3-byte chararacter-encoding (such as Chinese) then you (actually,
probably
> > just I myself) will get troubles. And I believe this is the reason why
my
> > properties files (written in traditional Chinese) cannot be correctly
> > displayed by Tapestry.
> >
> > Fixing it needs to modify a lot of codes. Since I am not yet familiar
with
> > the Tapestry code structure, it is better to let our real Tapestry
> > developers to fix it.
> > Or, if possible, you can guide me how to contribute code to Tapestry.
> >
> > I also signed up for the other tapestry-dev forum but that forum seems
> > pretty quiet. So, what should I do next to get this problem fixed? Is
> there
> > any bug report system? Thank you.
> >
> > Any other feedbacks, suggestions, or corrections will be highly
> appreciated.
> > Thanks again.
> >
> > Sincerely,
> >
> > Rookie
> >
> > ----- Original Message -----
> > From: "worookie" <wo...@hotmail.com>
> > To: "Tapestry users" <ta...@jakarta.apache.org>
> > Sent: Wednesday, June 11, 2003 6:57 PM
> > Subject: Re: Locale property file
> >
> >
> > > Hi,
> > >
> > > I've done a lot of testings...
> > > Unfortunately the mechanism provided by Tapestry cannot properly
display
> > the
> > > contents of a localized property file written in Chinese. (Although it
> can
> > > properly display the corresponding html file.) Can anyone help me to
> solve
> > > this issue?
> > >
> > > TIA
> > >
> > > Rookie
> > >
> > > ----- Original Message -----
> > > From: "worookie" <wo...@hotmail.com>
> > > To: "Tapestry users" <ta...@jakarta.apache.org>
> > > Sent: Wednesday, June 11, 2003 6:13 PM
> > > Subject: Locale property file
> > >
> > >
> > > >
> > > > ----- Original Message -----
> > > > From: "worookie" <wo...@hotmail.com>
> > > > To: "Tapestry users" <ta...@jakarta.apache.org>
> > > > Sent: Wednesday, June 11, 2003 5:41 PM
> > > > Subject: Re: getting started tutorial - Demo app
> > > >
> > > >
> > > > > Another question that I could not find an answer from Tapestry's
> > website
> > > > or
> > > > > the archive of this forum.
> > > > > In Harish's demo, there is a file called "Registration.properties"
> for
> > > the
> > > > > Registration page component.
> > > > > I added another file called "Registration.properties.zh_TW".
> > > > > I assume the property file should work just like other java
standard
> > > > > property files, which means the java program should automatically
> pick
> > > up
> > > > > the property file for the current Locale. In other words, if the
> > > > environment
> > > > > (of the server) is zh_TW (Taiwan), then Tapestry should use
> > > > > "Registration.properties.zh_TW" instead of
> "Registration.properteis".
> > > > > Unfortunately, it didn't execute as what I expected.
> > > > > So, my question is how and where I can tell Tapestry that the
> system's
> > > > > Locale is zh_TW (Taiwan).
> > > >
> > > > I found an answer for my locale question. It's in Developer's Guide
> > > Section
> > > > 3.
> > > > Tapestry's property files look like "Registration_zh_TW.properties"
> but
> > > not
> > > > like standard java property files ("Registration.properties.zh_TW").
> > > > Anyway, Tapestry still cannot correctly show the contents of my
> > localized
> > > > property file. There must be an encoding/decoding problem somewhere.
> > > > I am going to try more and I will keep you guys updated... Thx
> > > >
> > > > Rookie
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>

Re: Locale property file

Posted by Mindbridge <mi...@yahoo.com>.
Please see my post on charsets and encoding in the dev list archives (it was
sent sometime in the beginning of the month). This will be improved/fixed
soon.

Temporarily you can fix the issue by doing -Dfile.encoding=<your encoding>
or doing -DDfile.encoding=utf-8 and using native2ascii on the text files.
This is certainly not optimal, but it works.

Best regards,
-mb

----- Original Message ----- 
From: "worookie" <wo...@hotmail.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Thursday, June 12, 2003 12:17 PM
Subject: Re: Locale property file


> Hi,
>
> I guess that I have narrowed down the lines of code that cause the problem
> of incorrectly displaying messages from property files.
>
> Please look at the code at:
>
org.apache.tapestry.engine.DefaultComponentMessagesSource.readProperties(...
> )
> lines 253-255:
>
>             InputStream input = propertiesURL.openStream();
>             result.load(input);
>
> where "propertiesURL" is java.net.URL and "result" is
java.util.Properties.
>
> The problem comes from the method Properties.load(InputStream) which
ALWAYS
> assume the InputStream uses the ISO 8859-1 character encoding. So when the
> URL source is encoded by other than ISO 8859-1, then you might get
troubles.
> Well, most single-byte character encoding (such as English, French,
Spanish,
> Germany, etc) can still survive the ISO 8859-1 translation because they
are
> all single-byte data. Unfortunately, when the source is encoded by 2-byte
or
> 3-byte chararacter-encoding (such as Chinese) then you (actually, probably
> just I myself) will get troubles. And I believe this is the reason why my
> properties files (written in traditional Chinese) cannot be correctly
> displayed by Tapestry.
>
> Fixing it needs to modify a lot of codes. Since I am not yet familiar with
> the Tapestry code structure, it is better to let our real Tapestry
> developers to fix it.
> Or, if possible, you can guide me how to contribute code to Tapestry.
>
> I also signed up for the other tapestry-dev forum but that forum seems
> pretty quiet. So, what should I do next to get this problem fixed? Is
there
> any bug report system? Thank you.
>
> Any other feedbacks, suggestions, or corrections will be highly
appreciated.
> Thanks again.
>
> Sincerely,
>
> Rookie
>
> ----- Original Message -----
> From: "worookie" <wo...@hotmail.com>
> To: "Tapestry users" <ta...@jakarta.apache.org>
> Sent: Wednesday, June 11, 2003 6:57 PM
> Subject: Re: Locale property file
>
>
> > Hi,
> >
> > I've done a lot of testings...
> > Unfortunately the mechanism provided by Tapestry cannot properly display
> the
> > contents of a localized property file written in Chinese. (Although it
can
> > properly display the corresponding html file.) Can anyone help me to
solve
> > this issue?
> >
> > TIA
> >
> > Rookie
> >
> > ----- Original Message -----
> > From: "worookie" <wo...@hotmail.com>
> > To: "Tapestry users" <ta...@jakarta.apache.org>
> > Sent: Wednesday, June 11, 2003 6:13 PM
> > Subject: Locale property file
> >
> >
> > >
> > > ----- Original Message -----
> > > From: "worookie" <wo...@hotmail.com>
> > > To: "Tapestry users" <ta...@jakarta.apache.org>
> > > Sent: Wednesday, June 11, 2003 5:41 PM
> > > Subject: Re: getting started tutorial - Demo app
> > >
> > >
> > > > Another question that I could not find an answer from Tapestry's
> website
> > > or
> > > > the archive of this forum.
> > > > In Harish's demo, there is a file called "Registration.properties"
for
> > the
> > > > Registration page component.
> > > > I added another file called "Registration.properties.zh_TW".
> > > > I assume the property file should work just like other java standard
> > > > property files, which means the java program should automatically
pick
> > up
> > > > the property file for the current Locale. In other words, if the
> > > environment
> > > > (of the server) is zh_TW (Taiwan), then Tapestry should use
> > > > "Registration.properties.zh_TW" instead of
"Registration.properteis".
> > > > Unfortunately, it didn't execute as what I expected.
> > > > So, my question is how and where I can tell Tapestry that the
system's
> > > > Locale is zh_TW (Taiwan).
> > >
> > > I found an answer for my locale question. It's in Developer's Guide
> > Section
> > > 3.
> > > Tapestry's property files look like "Registration_zh_TW.properties"
but
> > not
> > > like standard java property files ("Registration.properties.zh_TW").
> > > Anyway, Tapestry still cannot correctly show the contents of my
> localized
> > > property file. There must be an encoding/decoding problem somewhere.
> > > I am going to try more and I will keep you guys updated... Thx
> > >
> > > Rookie
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Locale property file

Posted by worookie <wo...@hotmail.com>.
Hi,

I guess that I have narrowed down the lines of code that cause the problem
of incorrectly displaying messages from property files.

Please look at the code at:
org.apache.tapestry.engine.DefaultComponentMessagesSource.readProperties(...
)
lines 253-255:

            InputStream input = propertiesURL.openStream();
            result.load(input);

where "propertiesURL" is java.net.URL and "result" is java.util.Properties.

The problem comes from the method Properties.load(InputStream) which ALWAYS
assume the InputStream uses the ISO 8859-1 character encoding. So when the
URL source is encoded by other than ISO 8859-1, then you might get troubles.
Well, most single-byte character encoding (such as English, French, Spanish,
Germany, etc) can still survive the ISO 8859-1 translation because they are
all single-byte data. Unfortunately, when the source is encoded by 2-byte or
3-byte chararacter-encoding (such as Chinese) then you (actually, probably
just I myself) will get troubles. And I believe this is the reason why my
properties files (written in traditional Chinese) cannot be correctly
displayed by Tapestry.

Fixing it needs to modify a lot of codes. Since I am not yet familiar with
the Tapestry code structure, it is better to let our real Tapestry
developers to fix it.
Or, if possible, you can guide me how to contribute code to Tapestry.

I also signed up for the other tapestry-dev forum but that forum seems
pretty quiet. So, what should I do next to get this problem fixed? Is there
any bug report system? Thank you.

Any other feedbacks, suggestions, or corrections will be highly appreciated.
Thanks again.

Sincerely,

Rookie

----- Original Message -----
From: "worookie" <wo...@hotmail.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Wednesday, June 11, 2003 6:57 PM
Subject: Re: Locale property file


> Hi,
>
> I've done a lot of testings...
> Unfortunately the mechanism provided by Tapestry cannot properly display
the
> contents of a localized property file written in Chinese. (Although it can
> properly display the corresponding html file.) Can anyone help me to solve
> this issue?
>
> TIA
>
> Rookie
>
> ----- Original Message -----
> From: "worookie" <wo...@hotmail.com>
> To: "Tapestry users" <ta...@jakarta.apache.org>
> Sent: Wednesday, June 11, 2003 6:13 PM
> Subject: Locale property file
>
>
> >
> > ----- Original Message -----
> > From: "worookie" <wo...@hotmail.com>
> > To: "Tapestry users" <ta...@jakarta.apache.org>
> > Sent: Wednesday, June 11, 2003 5:41 PM
> > Subject: Re: getting started tutorial - Demo app
> >
> >
> > > Another question that I could not find an answer from Tapestry's
website
> > or
> > > the archive of this forum.
> > > In Harish's demo, there is a file called "Registration.properties" for
> the
> > > Registration page component.
> > > I added another file called "Registration.properties.zh_TW".
> > > I assume the property file should work just like other java standard
> > > property files, which means the java program should automatically pick
> up
> > > the property file for the current Locale. In other words, if the
> > environment
> > > (of the server) is zh_TW (Taiwan), then Tapestry should use
> > > "Registration.properties.zh_TW" instead of "Registration.properteis".
> > > Unfortunately, it didn't execute as what I expected.
> > > So, my question is how and where I can tell Tapestry that the system's
> > > Locale is zh_TW (Taiwan).
> >
> > I found an answer for my locale question. It's in Developer's Guide
> Section
> > 3.
> > Tapestry's property files look like "Registration_zh_TW.properties" but
> not
> > like standard java property files ("Registration.properties.zh_TW").
> > Anyway, Tapestry still cannot correctly show the contents of my
localized
> > property file. There must be an encoding/decoding problem somewhere.
> > I am going to try more and I will keep you guys updated... Thx
> >
> > Rookie


Re: Locale property file

Posted by worookie <wo...@hotmail.com>.
Hi,

I've done a lot of testings...
Unfortunately the mechanism provided by Tapestry cannot properly display the
contents of a localized property file written in Chinese. (Although it can
properly display the corresponding html file.) Can anyone help me to solve
this issue?

TIA

Rookie

----- Original Message -----
From: "worookie" <wo...@hotmail.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Wednesday, June 11, 2003 6:13 PM
Subject: Locale property file


>
> ----- Original Message -----
> From: "worookie" <wo...@hotmail.com>
> To: "Tapestry users" <ta...@jakarta.apache.org>
> Sent: Wednesday, June 11, 2003 5:41 PM
> Subject: Re: getting started tutorial - Demo app
>
>
> > Another question that I could not find an answer from Tapestry's website
> or
> > the archive of this forum.
> > In Harish's demo, there is a file called "Registration.properties" for
the
> > Registration page component.
> > I added another file called "Registration.properties.zh_TW".
> > I assume the property file should work just like other java standard
> > property files, which means the java program should automatically pick
up
> > the property file for the current Locale. In other words, if the
> environment
> > (of the server) is zh_TW (Taiwan), then Tapestry should use
> > "Registration.properties.zh_TW" instead of "Registration.properteis".
> > Unfortunately, it didn't execute as what I expected.
> > So, my question is how and where I can tell Tapestry that the system's
> > Locale is zh_TW (Taiwan).
>
> I found an answer for my locale question. It's in Developer's Guide
Section
> 3.
> Tapestry's property files look like "Registration_zh_TW.properties" but
not
> like standard java property files ("Registration.properties.zh_TW").
> Anyway, Tapestry still cannot correctly show the contents of my localized
> property file. There must be an encoding/decoding problem somewhere.
> I am going to try more and I will keep you guys updated... Thx
>
> Rookie
>