• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
  • paul wheaton
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Rob Spoor
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:

Internationalization and Word Order

 
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to have an internationalized String that takes the following format:

Returned results for "PLACEHOLDER" in:

where PLACEHOLDER is something dynamic that is returned from a data store and is already internationalized.

I was thinking that I could have two keys in a properties file:

1) returned=Returned results for
2) returned.part.two=in:

The problem is that I know that word order can vary in different languages (English, Spanish, etc) and that it would be difficult for a translator to get the word order correct for a String that is made up of multiple parts.

How are people doing this? Please help. Thanks.
 
Marshal
Posts: 27987
94
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From the API docs for java.text.MessageFormat:

"MessageFormat provides a means to produce concatenated messages in language-neutral way. Use this to construct messages displayed for end users."

Sounds exactly like your question. You could probably go a long way with that class.
 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


I was thinking that I could have two keys in a properties file:
1) returned=Returned results for
2) returned.part.two=in:
The problem is that I know that word order can vary in different languages...


The only way to avoid this kind of problem is to not separate in two tokens the sentence. Instead you should use a message with argument(s):

returned=Returned results for {0} in:

Then it would be easy to change the word order in another locale.
You should read the documentation of java.text.MessageFormat class.

Regards
 
Poop goes in a willow feeder. Wipe with this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic