diff -r 6c633be53dd6 -r 8854e172a18f java/rozsirene-atributy/src/cz/frantovo/rozsireneAtributy/Startér.java --- a/java/rozsirene-atributy/src/cz/frantovo/rozsireneAtributy/Startér.java Thu Dec 16 01:16:55 2010 +0100 +++ b/java/rozsirene-atributy/src/cz/frantovo/rozsireneAtributy/Startér.java Tue Dec 28 17:02:08 2010 +0100 @@ -8,6 +8,8 @@ import java.awt.event.KeyEvent; import java.io.File; import java.io.IOException; +import java.text.MessageFormat; +import java.util.ResourceBundle; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JComponent; @@ -30,6 +32,7 @@ public class Startér { private static final Logger log = Logger.getLogger(Startér.class.getSimpleName()); + private static final ResourceBundle překlady = ResourceBundle.getBundle("cz.frantovo.rozsireneAtributy.Překlady"); /** * @param args název souboru @@ -37,6 +40,7 @@ */ public static void main(String[] args) throws IOException { + if (args.length == 1 && args[0].length() > 0) { File soubor = new File(args[0]); @@ -60,21 +64,21 @@ }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - f.setTitle("Rozšířené stributy souboru: " + soubor); + f.setTitle(MessageFormat.format(překlady.getString("titulek"), soubor)); f.setSize(640, 240); f.setLocationRelativeTo(null); f.setVisible(true); } else { - ukončiChybou("Soubor neexistuje: " + soubor); + ukončiChybou(MessageFormat.format(překlady.getString("chyba.souborNeexistuje"), soubor)); } } else { - ukončiChybou("Očekávám právě jeden parametr – název souboru."); + ukončiChybou(překlady.getString("chyba.chybíParametr")); } } private static void ukončiChybou(String hláška) { log.log(Level.SEVERE, hláška); - JOptionPane.showMessageDialog(null, hláška, "Chyba", JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(null, hláška, překlady.getString("chyba.titulek"), JOptionPane.ERROR_MESSAGE); System.exit(1); } }