• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Localization issue - Help Shreya print her bookmarks

 
Author
Posts: 375
19
  • Mark post as helpful
  • send pies
  • 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
  • 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
19
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
girl power ... turns out to be about a hundred watts. But they seriuosly don't like being connected to the grid. Tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic