#Issue 14 use parameters in BUNDLE

This commit is contained in:
Didier Clermonté 2016-06-07 00:21:31 +02:00
parent 5a3c7f863c
commit 481aff9124
7 changed files with 26 additions and 29 deletions

Binary file not shown.

View File

@ -75,16 +75,15 @@ public class SibaCLI
{ {
boolean result; boolean result;
result = SibaManager.check(fileToCheck); result = SibaManager.check(fileToCheck);
String yourFile = BUNDLE.getString("confirmDialogYourString.text"); //$NON-NLS-1$
String good = BUNDLE.getString("confirmDialogGood.text"); //$NON-NLS-1$
String bad = BUNDLE.getString("confirmDialogBad.text"); //$NON-NLS-1$
if (result) if (result)
{ {
System.out.println(yourFile + fileToCheck.getName() + good); String message = String.format(BUNDLE.getString("confirmDialogGood.text"), fileToCheck.getName());
System.out.println(message);
} }
else else
{ {
System.out.println(yourFile + fileToCheck.getName() + bad); String message = String.format(BUNDLE.getString("confirmDialogBad.text"), fileToCheck.getName());
System.out.println(message);
} }
} }

View File

@ -1,7 +1,7 @@
confirmDialog.text=Your directory has been backup \n in the file :\n confirmDialog.text=Your directory has been backup \n in the file :\n
confirmDialogYourString.text=Your File confirmDialogYourString.text=Your File
confirmDialogGood.text=has been check and is good confirmDialogGood.text=Your File %s has been check and is good
confirmDialogBad.text = is corrupted confirmDialogBad.text =Your File %s is corrupted
badUsage.text = Bad usage badUsage.text = Bad usage
missingDirectoryToSave.text = Missing the directory to backup missingDirectoryToSave.text = Missing the directory to backup
directoryToSaveNotExist.text = The directory to save do not exist directoryToSaveNotExist.text = The directory to save do not exist

View File

@ -1,7 +1,7 @@
confirmDialog.text = Votre répertoire a été sauvegardé \n dans le fichier :\n confirmDialog.text = Votre répertoire a été sauvegardé \n dans le fichier :\n
confirmDialogYourString.text=Votre fichier confirmDialogYourString.text=Votre fichier
confirmDialogGood.text=a été vérifié et ne comporte pas d'erreurs confirmDialogGood.text=Votre fichier %s a été vérifié et ne comporte pas d'erreurs
confirmDialogBad.text = comporte des erreurs confirmDialogBad.text = Votre fichier %s comporte des erreurs
badUsage.text = mauvais usage badUsage.text = mauvais usage
missingDirectoryToSave.text = Il manque le répertoire à sauvegarder missingDirectoryToSave.text = Il manque le répertoire à sauvegarder
directoryToSaveNotExist.text = Le répertoire à sauvegarder n'existe pas directoryToSaveNotExist.text = Le répertoire à sauvegarder n'existe pas

View File

@ -85,7 +85,7 @@ public class CheckPanel extends JPanel
{ {
try try
{ {
CheckPanel.this.choosenFile = choosenDirectory(); CheckPanel.choosenFile = choosenDirectory();
} }
catch (IOException e1) catch (IOException e1)
@ -101,9 +101,9 @@ public class CheckPanel extends JPanel
} }
}); });
this.textField = new JTextField(); CheckPanel.textField = new JTextField();
add(this.textField, "3, 2, fill, default"); add(CheckPanel.textField, "3, 2, fill, default");
this.textField.setColumns(10); CheckPanel.textField.setColumns(10);
add(btnNewButton, "4, 2, left, top"); add(btnNewButton, "4, 2, left, top");
JButton btnNewButton_1 = new JButton(BUNDLE.getString("CheckPanel.btnNewButton_1.text")); //$NON-NLS-1$ JButton btnNewButton_1 = new JButton(BUNDLE.getString("CheckPanel.btnNewButton_1.text")); //$NON-NLS-1$
@ -116,22 +116,20 @@ public class CheckPanel extends JPanel
try try
{ {
if (!(CheckPanel.this.choosenFile == null) && CheckPanel.this.choosenFile.exists()) if (!(CheckPanel.choosenFile == null) && CheckPanel.choosenFile.exists())
{ {
boolean check = SibaManager.check(CheckPanel.this.choosenFile); boolean check = SibaManager.check(CheckPanel.choosenFile);
String titre = BUNDLE.getString("CheckPanel.confirmDialogTitle.text"); String titre = BUNDLE.getString("CheckPanel.confirmDialogTitle.text");
String yourFile = BUNDLE.getString("CheckPanel.confirmDialogYourString.text");
if (check) if (check)
{ {
String message = yourFile + CheckPanel.this.choosenFile.getName() + " " String message = String.format(BUNDLE.getString("CheckPanel.confirmDialogGood.text"),
+ BUNDLE.getString("CheckPanel.confirmDialogGood.text"); CheckPanel.choosenFile.getName());
JOptionPane.showMessageDialog(null, message, titre, JOptionPane.INFORMATION_MESSAGE); JOptionPane.showMessageDialog(null, message, titre, JOptionPane.INFORMATION_MESSAGE);
} }
else else
{ {
String message = yourFile + CheckPanel.this.choosenFile.getName() + " " String message = String.format(BUNDLE.getString("CheckPanel.confirmDialogBad.text"),
+ BUNDLE.getString("CheckPanel.confirmDialogBad.text"); CheckPanel.choosenFile.getName());
JOptionPane.showMessageDialog(null, message, titre, JOptionPane.INFORMATION_MESSAGE); JOptionPane.showMessageDialog(null, message, titre, JOptionPane.INFORMATION_MESSAGE);
} }
} }
@ -157,11 +155,11 @@ public class CheckPanel extends JPanel
{ {
File result; File result;
this.choosenFile = CheckDirectorySelector.showSelectorDialog(null, null); CheckPanel.choosenFile = CheckDirectorySelector.showSelectorDialog(null, null);
if (!(CheckPanel.this.choosenFile == null) && CheckPanel.this.choosenFile.exists()) if (!(CheckPanel.choosenFile == null) && CheckPanel.choosenFile.exists())
{ {
this.textField.setText(this.choosenFile.getName()); CheckPanel.textField.setText(CheckPanel.choosenFile.getName());
result = this.choosenFile; result = CheckPanel.choosenFile;
} }
else else
{ {

View File

@ -18,8 +18,8 @@ BackupPanel.targetFileChooserButton.text=Target Directory
CheckDirectorySelector.this.dialogTitle=Directory where is the backup CheckDirectorySelector.this.dialogTitle=Directory where is the backup
CheckPanel.btnNewButton.text=\u2026 CheckPanel.btnNewButton.text=\u2026
CheckPanel.btnNewButton_1.text=Check CheckPanel.btnNewButton_1.text=Check
CheckPanel.confirmDialogBad.text=is corrupted CheckPanel.confirmDialogBad.text=Your File %s is corrupted
CheckPanel.confirmDialogGood.text=has been check and is good CheckPanel.confirmDialogGood.text=Your File %s has been check and is good
CheckPanel.confirmDialogTitle.text=Check done CheckPanel.confirmDialogTitle.text=Check done
CheckPanel.confirmDialogYourString.text=Your File CheckPanel.confirmDialogYourString.text=Your File
CheckPanel.lblNewLabel.text=File to be Checked CheckPanel.lblNewLabel.text=File to be Checked

View File

@ -23,8 +23,8 @@ BackupPanel.confirmDialogTitle.text = Sauvegarde faite
BackupPanel.confirmDialogMessage.text = Votre répertoire a été sauvegardé \n dans le fichier :\n BackupPanel.confirmDialogMessage.text = Votre répertoire a été sauvegardé \n dans le fichier :\n
CheckPanel.confirmDialogTitle.text = Vérification faite CheckPanel.confirmDialogTitle.text = Vérification faite
CheckPanel.confirmDialogYourString.text = Votre fichier CheckPanel.confirmDialogYourString.text = Votre fichier
CheckPanel.confirmDialogGood.text = a été vérifié et ne comporte pas d'erreurs CheckPanel.confirmDialogGood.text = Votre fichier %s a été vérifié et ne comporte pas d'erreurs
CheckPanel.confirmDialogBad.text = comporte des erreurs CheckPanel.confirmDialogBad.text = Votre fichier %s comporte des erreurs
BackupPanel.dataMissing.text = Données incomplètes BackupPanel.dataMissing.text = Données incomplètes
BackupPanel.TitleWarning.text = Attention BackupPanel.TitleWarning.text = Attention
SibaGUI.mnFile.text=Fichier SibaGUI.mnFile.text=Fichier