Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 118805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:33:10+00:00 2026-05-11T03:33:10+00:00

We are localising the user-interface text for a web application that runs on Java

  • 0

We are localising the user-interface text for a web application that runs on Java 5, and have a dilemma about how we output messages that are defined in properties files – the kind used by java.util.Properties.

Some messages include a placeholder that will be filled using java.text.MessageFormat. For example:

search.summary = Your search for {0} found {1} items. 

MessageFormat is annoying, because a single quote is a special character, despite being common in English text. You have to type two for a literal single quote:

warning.item = This item''s {0} is not valid. 

However, three-quarters of the application’s 1000 or so messages do not include a placeholder. This means that we can output them directly, avoiding MessageFormat, and leave the single quotes alone:

help.url = The web page's URL 

Question: should we use MessageFormat for all messages, for consistent syntax, or avoid MessageFormat where we can, so most messages do not need escaping?

There are clearly pros and cons either way.

Note that the API documentation for MessageFormat acknowledges the problem and suggests a non-solution:

The rules for using quotes within message format patterns unfortunately have shown to be somewhat confusing. In particular, it isn’t always obvious to localizers whether single quotes need to be doubled or not. Make sure to inform localizers about the rules, and tell them (for example, by using comments in resource bundle source files) which strings will be processed by MessageFormat.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T03:33:10+00:00Added an answer on May 11, 2026 at 3:33 am

    Just write your own implementation of MessageFormat without this annoying feature. You may look at the code of SLF4J Logger.

    They have their own version of message formatter which can be used as followed:

    logger.debug('Temperature set to {}. Old temperature was {}.', t, oldT); 

    Empty placeholders could be used with default ordering and numbered for some localization cases where different languages do permutations of words or parts of sentences.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 91k
  • Answers 91k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can set the internal field separator (IFS) variable, and… May 11, 2026 at 6:19 pm
  • Editorial Team
    Editorial Team added an answer Just implement a subclass of logging.Filter: http://docs.python.org/library/logging.html#filter-objects. It will have… May 11, 2026 at 6:19 pm
  • Editorial Team
    Editorial Team added an answer It's possible to simply "nest" working copies in Git. So… May 11, 2026 at 6:19 pm

Related Questions

I'm localizing an MFC app into Japanese, and have the resources working right. My
We are developing a little application that given a directory with PDF files creates
We are working on designing an application that is typically OLTP (think: purchasing system).
We are getting new dev machines and moving up to Vista 64 Ultimate to

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.