|
-
July 17th, 2009, 06:31 PM
#1
Formtting text within resource bundle .properties files
So I have a resource bundle with key/value pairs, e.g.
alert.NoPromoCodeRequired=No promotion code required.
If I wanted to bold, say, the "promotion code" phrase within the first sentence of the text value above, how would I accomplish that? Can I just dump html into the properties file, like so?
alert.NoPromoCodeRequired=No <span class="baseCopyEm">promotion code</span> required.
This strikes me as NOT a best practice but I canot find any guidance.
Conversely creating three separate key values ("No", "promotion code" and "required") pulling them each into the web page than applying html around the second text value does not seem like the way to go either.
Thanks.
-
July 18th, 2009, 02:26 AM
#2
Re: Formtting text within resource bundle .properties files
 Originally Posted by dylanmac
Can I just dump html into the properties file, like so?
alert.NoPromoCodeRequired=No <span class="baseCopyEm">promotion code</span> required.
I don't see why not - you need some way to indicate the formatting, and HTML has the tags for the job, plus you can plug it directly into your display component.
This strikes me as NOT a best practice but I canot find any guidance.
Why, what's wrong with it? If you want the property to be more readable in the property file, you could put each part on a separate logical line (still for the one property), using the '\' to escape the line termination (see Properties.load(Reader reader)).
Conversely creating three separate key values ("No", "promotion code" and "required") pulling them each into the web page than applying html around the second text value does not seem like the way to go either.
I agree that doesn't seem particularly helpful.
The outcome of any serious research can only be to make two questions grow where only one grew before...
T. Veblen
Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.
-
July 24th, 2009, 07:01 PM
#3
Re: Formtting text within resource bundle .properties files
Alright thanks for reply!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|