Salve!
ho creato un file Interhello.java ed ho creato i vari file .properties come
MessagesBundle_de_DE.proprierties, ma non funziona e non riesco a
capirci più nulla, perchè il codice mi sembra corretto.
il codice di InterHello.java è il seguente:
Grazie!!!codice:/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package ipackage; import java.util.*; /** * * @author Matty */ public class InterHello { static public void main(String[] args) { String language; String country; System.out.println( "Choose yout own language" + " 1 - english " + " 2 - francaise " + " 3 - italiano " + " 4 - deutch " ); Scanner scan; scan = new Scanner(System.in); int chooser = scan.nextInt(); switch(chooser){ case 1: language = "en"; country = "US"; break; case 2: language = "fr"; country = "FR"; break; case 3: language = "it"; country = "IT"; break; case 4: language = "de"; country = "DE"; break; default: language = "it"; country = "IT"; } Locale currentLocale; ResourceBundle messages; currentLocale = new Locale(language, country); messages = ResourceBundle.getBundle("MessagesBundle", currentLocale); System.out.println(messages.getString("greetings")); System.out.println(messages.getString("inquiry")); System.out.println(messages.getString("farewell")); } }

Rispondi quotando