Results 1 to 9 of 9
- 08-27-2008, 01:19 AM #1
Member
- Join Date
- Jul 2008
- Posts
- 11
- Rep Power
- 0
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>
- 08-27-2008, 01:44 AM #2
Have you tried using the escape character to escape the \
ie \\n?
- 08-27-2008, 01:46 AM #3
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Yes I agreed with Norm, what he suggest should work. Have you tried?
- 08-27-2008, 02:09 AM #4
Member
- Join Date
- Jul 2008
- Posts
- 11
- Rep Power
- 0
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
- 08-27-2008, 02:46 AM #5
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.
- 08-27-2008, 03:04 AM #6
Member
- Join Date
- Jul 2008
- Posts
- 11
- Rep Power
- 0
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?
- 08-27-2008, 03:09 AM #7
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?
Java 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 */
- 08-27-2008, 03:20 AM #8
Member
- Join Date
- Jul 2008
- Posts
- 11
- Rep Power
- 0
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?
- 08-27-2008, 04:29 AM #9
Similar Threads
-
need you help badly!
By sheena06 in forum New To JavaReplies: 4Last Post: 07-09-2008, 09:15 AM -
help needed!!! :S
By mark-mlt in forum NetworkingReplies: 1Last Post: 04-14-2008, 09:27 AM -
Object ArrayList - increment solution needed badly!!
By rugbyGeek in forum New To JavaReplies: 4Last Post: 03-08-2008, 12:47 AM -
help needed.
By dirtycash in forum New To JavaReplies: 3Last Post: 12-03-2007, 09:17 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks