• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Localization issue - Help Shreya print her bookmarks

 
Author
Posts: 375
22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone -

Its an honor to promote my book at JavaRanch.
To make this promotion interesting, I'll post questions or code for ranchers to answer.

So here's an exercise on Localization

=================================
Shreya was asked to create book marks for her language teachers (German, Spanish and English) at her school. All the bookmarks were to include text 'Good day!' in the language that the teacher taught.

Because Shreya didn't know the equivalent text in all these languages, she created book marks without the text as follows:



Then she requested her German and Spanish friends to send her text equivalent to 'Good Day'. This is what she received:

'Good day' in German = Guten tag
'Good day' in Spanish = Buen dia


Now she wanted to print out these labels on the bookmarks, so that they look like this.



Can you write a quick Java method that retrieves these text labels from the following (separate) text files, when passed an appropriate language.







Here's partial code:




Happy coding!

With much respect,
Mala
 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mala,

Here's the reply to your above question:




And yes, this is getting interesting!!
 
Mala Gupta
Author
Posts: 375
22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mohile -

Thanks for posting your answer, which is correct! Good to learn that you think its getting interesting.

A few quick questions -

1) Can I use myapp.mytags instead of 'mytags' in the following code? If yes, do you need to make any changes?


2) How does Java runtime find the .properties files? Is it related to importing it or the system PATH?

Thanks.

With much respect,
Mala


 
M Mohile
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mala,

1) Can I use myapp.mytags instead of 'mytags' in the following code? If yes, do you need to make any changes?



--> Yes. You simply need to make a directory with name as 'myapp' where the properties files shall be placed.

2) How does Java runtime find the .properties files? Is it related to importing it or the system PATH?



--> You don't need to import anything. The Java runtime searches for the directory 'myapp' from where the application was started.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic