Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-27-2008, 03:19 AM
Member
 
Join Date: Jul 2008
Posts: 4
paddala is on a distinguished road
localization....help needed badly
say i have a message with some html tags and \n(i.e. new line) or \t(tab)
i want to include these tags in the property resource bundle...is it possible to do so?....is there some kind of different representation to be used in a property resource bundles for these tags?

Ex: <html>"My name is \n" + name + "\t blah blah"</html>
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-27-2008, 03:44 AM
Norm's Avatar
Senior Member
 
Join Date: Jun 2008
Location: Heredia, Costa Rica
Posts: 2,225
Norm is on a distinguished road
Have you tried using the escape character to escape the \
ie \\n?
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 08-27-2008, 03:46 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 5,075
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Yes I agreed with Norm, what he suggest should work. Have you tried?
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Someone helped you?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.
Help:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Resources:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Web:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Tips:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 08-27-2008, 04:09 AM
Member
 
Join Date: Jul 2008
Posts: 4
paddala is on a distinguished road
i have tried it but what happens is this, if i have
key = core \\n name in my resource bundle
and if i print bundle.getString("key")
it prints core \n name
i want it to print like this:
core
name
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 08-27-2008, 04:46 AM
Norm's Avatar
Senior Member
 
Join Date: Jun 2008
Location: Heredia, Costa Rica
Posts: 2,225
Norm is on a distinguished road
Do a replace on the string \n with a lineend before printing.
Does the property resource bundle support lineend characters?
Have you looked at the file to see if its allowed? Try editting the file and adding a lineend and see what happens.
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 08-27-2008, 05:04 AM
Member
 
Join Date: Jul 2008
Posts: 4
paddala is on a distinguished road
this property resource bundle has been created from scratch by myself....can i support end line characters?....what do i have to do to support this?
Bookmark Post in Technorati
Reply With Quote
  #7 (permalink)  
Old 08-27-2008, 05:09 AM
Norm's Avatar
Senior Member
 
Join Date: Jun 2008
Location: Heredia, Costa Rica
Posts: 2,225
Norm is on a distinguished road
Did a quick test. Inserted the chars \n in a resouce boundle file, read it and printed it. The \n caused a line break.
Can you post the code, the name of the properties file and its contents?

Code:
import java.util.*; public class ResourceBundleTest { public static String mymethod(String ss) { ResourceBundle resources = ResourceBundle.getBundle(ss); String s = resources.getString("USER"); return s; } public static void main(String[] args) { String st = mymethod("DBase"); System.out.println(st); } } /* Following is contents of DBase.properties key=value USER=DBase only\nadfg Following is output from program: DBase only adfg */
Bookmark Post in Technorati
Reply With Quote
  #8 (permalink)  
Old 08-27-2008, 05:20 AM
Member
 
Join Date: Jul 2008
Posts: 4
paddala is on a distinguished road
oh god yea it works when i do this
key = core \n name
String s = bundle.getString("key");
System.out.println(s);

it prints:
core
name


norm...thanks a lot...

now abt the html tags i guess they would also be accepted....
so can i include the html tags in the same way?
Bookmark Post in Technorati
Reply With Quote
  #9 (permalink)  
Old 08-27-2008, 06:29 AM
Norm's Avatar
Senior Member
 
Join Date: Jun 2008
Location: Heredia, Costa Rica
Posts: 2,225
Norm is on a distinguished road
Try it and see. "The proof is in the pudding"
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
need you help badly! sheena06 New To Java 4 07-09-2008 11:15 AM
help needed!!! :S mark-mlt Networking 1 04-14-2008 11:27 AM
Object ArrayList - increment solution needed badly!! rugbyGeek New To Java 4 03-08-2008 02:47 AM
help needed. dirtycash New To Java 3 12-03-2007 11:17 PM


All times are GMT +3. The time now is 09:41 AM.


VBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org