From 87ea83af3e209a8c3a4b19f9530a9c05b4541148 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Wed, 14 Aug 2013 15:16:42 +0100 Subject: [PATCH] JAL-1354 replacement of bare strings in GUI dialogs with i18n bundle lookup via jalview.util.MessageManager --- resources/lang/Messages.properties | 241 ++++++++++++++++++++ src/MCview/AppletPDBViewer.java | 39 ++-- src/jalview/appletgui/APopupMenu.java | 45 ++-- src/jalview/appletgui/AlignFrame.java | 218 +++++++++--------- src/jalview/appletgui/AnnotationColourChooser.java | 15 +- src/jalview/appletgui/CutAndPasteTransfer.java | 23 +- src/jalview/appletgui/FeatureColourChooser.java | 7 +- src/jalview/appletgui/FeatureRenderer.java | 3 +- src/jalview/appletgui/Finder.java | 18 +- src/jalview/appletgui/FontChooser.java | 12 +- src/jalview/appletgui/PCAPanel.java | 19 +- src/jalview/appletgui/PairwiseAlignPanel.java | 3 +- src/jalview/appletgui/RedundancyPanel.java | 7 +- src/jalview/appletgui/SliderPanel.java | 15 +- src/jalview/appletgui/TreePanel.java | 19 +- src/jalview/appletgui/UserDefinedColours.java | 7 +- src/jalview/bin/JalviewLite.java | 6 +- src/jalview/gui/AlignFrame.java | 41 ++-- src/jalview/gui/AnnotationColourChooser.java | 14 +- src/jalview/gui/AnnotationExporter.java | 11 +- src/jalview/gui/AppVarnaBinding.java | 16 +- src/jalview/gui/BlogReader.java | 13 +- src/jalview/gui/Console.java | 4 +- src/jalview/gui/CutAndPasteHtmlTransfer.java | 3 +- src/jalview/gui/CutAndPasteTransfer.java | 5 +- src/jalview/gui/DasSourceBrowser.java | 10 +- src/jalview/gui/Desktop.java | 11 +- src/jalview/gui/EPSOptions.java | 14 +- src/jalview/gui/EditNameDialog.java | 6 +- src/jalview/gui/FeatureColourChooser.java | 10 +- src/jalview/gui/FeatureRenderer.java | 15 +- src/jalview/gui/FeatureSettings.java | 21 +- src/jalview/gui/JDatabaseTree.java | 15 +- src/jalview/gui/JalviewDialog.java | 6 +- src/jalview/gui/PCAPanel.java | 3 +- src/jalview/gui/WebserviceInfo.java | 3 +- src/jalview/gui/WsJobParameters.java | 3 +- src/jalview/gui/WsPreferences.java | 3 +- src/jalview/jbgui/GRestServiceEditorPane.java | 13 +- src/jalview/util/MessageManager.java | 51 +++++ 40 files changed, 653 insertions(+), 335 deletions(-) create mode 100644 resources/lang/Messages.properties mode change 100755 => 100644 src/MCview/AppletPDBViewer.java mode change 100755 => 100644 src/jalview/appletgui/APopupMenu.java mode change 100755 => 100644 src/jalview/appletgui/AnnotationColourChooser.java mode change 100755 => 100644 src/jalview/appletgui/CutAndPasteTransfer.java mode change 100755 => 100644 src/jalview/appletgui/FeatureRenderer.java mode change 100755 => 100644 src/jalview/appletgui/Finder.java mode change 100755 => 100644 src/jalview/appletgui/FontChooser.java mode change 100755 => 100644 src/jalview/appletgui/PCAPanel.java mode change 100755 => 100644 src/jalview/appletgui/PairwiseAlignPanel.java mode change 100755 => 100644 src/jalview/appletgui/RedundancyPanel.java mode change 100755 => 100644 src/jalview/appletgui/SliderPanel.java mode change 100755 => 100644 src/jalview/appletgui/UserDefinedColours.java mode change 100755 => 100644 src/jalview/gui/AlignFrame.java mode change 100755 => 100644 src/jalview/gui/AnnotationColourChooser.java mode change 100755 => 100644 src/jalview/gui/AnnotationExporter.java mode change 100755 => 100644 src/jalview/gui/CutAndPasteTransfer.java mode change 100755 => 100644 src/jalview/gui/DasSourceBrowser.java mode change 100755 => 100644 src/jalview/gui/EPSOptions.java mode change 100755 => 100644 src/jalview/gui/FeatureRenderer.java mode change 100755 => 100644 src/jalview/gui/FeatureSettings.java mode change 100755 => 100644 src/jalview/gui/PCAPanel.java mode change 100755 => 100644 src/jalview/gui/WebserviceInfo.java create mode 100644 src/jalview/util/MessageManager.java diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties new file mode 100644 index 0000000..7a92aa0 --- /dev/null +++ b/resources/lang/Messages.properties @@ -0,0 +1,241 @@ +action.cancel = Cancel +action.create = Create +action.update = Update +action.delete = Delete +action.snapshot = Snapshot +action.clear = Clear +action.accept = Accept +action.select_ddbb = --- Select Database --- +action.undo = Undo +action.redo = Redo +action.reset = Reset +action.remove_left = Remove left +action.remove_right = Remove right +action.remove_empty_columns = Remove Empty Columns +action.remove_all_gaps = Remove All Gaps +action.boxes = Boxes +action.text = Text +action.by_pairwise_id = by Pairwise Identity +action.by_id = by Id +action.by_length = by Length +action.by_group = by Group +action.remove_redundancy = Remove Redundancy... +action.pairwise_alignment = Pairwise Alignments... +action.by_rna_helixes = by RNA Helices +action.user_defined = User Defined... +action.by_conservation = By Conservation +action.wrap = Wrap +action.show_gaps = Show Gaps +action.find = Find... +action.undefine_groups = Undefine Groups +action.make_groups_selection = Make Groups for selection +action.copy = Copy +action.cut = Cut +action.paste = Paste +action.font = Font... +action.scale_above = Scale Above +action.scale_left = Scale Left +action.scale_right = Scale Right +action.by_tree_order = By Tree Order +action.sort = Sort +action.calculate_tree = Calculate Tree +action.help = Help +action.by_annotation = by Annotation... +action.invert_sequence_selection = Invert Sequence Selection +action.invert_column_selection = Invert Column Selection +action.show = Show +action.hide = Hide +action.ok = OK +action.set_defaults = Defaults +action.remove_group = Remove Group +action.hide_sequences = Hide Sequences +action.reveal_all = Reveal All +action.reveal_sequences = Reveal Sequences +action.find_all = Find all +action.find_next = Find next +action.file = File +action.view = View +action.change_params = Change Parameters +action.apply = Apply +action.apply_threshold_all_groups = Apply threshold to all groups +action.apply_all_groups = Apply to all Groups +action.by_chain = By chain +action.by_sequence = By Sequence +action.paste_annotations = Paste Annotations +action.format = Format +action.select = Select +action.new_view = New View +action.close = Close +action.add = Add +action.save_as_default = Save as default +action.cancel_fetch = Cancel Fetch + +label.str = Str: +label.seq = Seq: +label.structures_manager = Structures Manager +label.nickname = Nickname: +label.url = URL: +label.input_file_url = Enter URL or Input File +label.select_feature = Select feature: +label.name = Name: +label.name_param = Name: {0} +label.group = Group: +label.colour = Colour: +label.description = Description: +label.start = Start: +label.end = End: +label.current_parameter_set_name = Current parameter set name: +label.service_action = Service Action: +label.post_url = POST URL: +label.url_suffix = URL Suffix +label.sequence_source = Sequence Source +label.per_seq = per Sequence +label.result_vertically_separable = Results are vertically separable +label.amend = Amend +label.undo_command = Undo {0} +label.redo_command = Redo {0} +label.principal_component_analysis = Principal Component Analysis +label.average_distance_identity = Average Distance Using % Identity +label.neighbour_joining_identity = Neighbour Joining Using % Identity +label.status_bar = Status bar +label.out_to_textbox = Output to Textbox +label.clustalx = Clustalx +label.zappo = Zappo +label.taylor = Taylor +label.hydrophobicity = Hydrophobicity +label.helix_propensity = Helix Propensity +label.strand_propensity = Strand Propensity +label.turn_propensity = Turn Propensity +label.buried_index = Buried Index +label.purine_pyrimidine = Purine/Pyrimidine +label.percentage_identity = Percentage Identity +label.blosum62_score = BLOSUM62 Score +label.tcoffee_scores = T-Coffee Scores +label.average_distance_bloslum62 = Average Distance Using BLOSUM62 +label.neighbour_blosum62 = Neighbour Joining Using BLOSUM62 +label.show_annotations = Show annotations +label.colour_text = Colour Text +label.show_non_conversed = Show nonconserved +label.overview_window = Overview Window +label.none = None +label.above_identity_threshold = Above Identity Threshold +label.nucleotide = Nucleotide +label.to_new_alignment = To New Alignment +label.to_this_alignment = Add To This Alignment +label.apply_colour_to_all_groups = Apply Colour To All Groups +label.modify_identity_thereshold = Modify Identity Threshold... +label.modify_conservation_thereshold = Modify Conservation Threshold... +label.input_from_textbox = Input from textbox +label.centre_column_labels = Centre column labels +label.automatic_scrolling = Automatic Scrolling +label.documentation = Documentation +label.about = About... +label.show_sequence_limits = Show Sequence Limits +label.feature_settings = Feature Settings... +label.sequence_features = Sequence Features +label.all_columns = All Columns +label.all_sequences = All Sequences +label.selected_columns = Selected Columns +label.selected_sequences = Selected Sequences +label.all_but_selected_region = All but Selected Region (Shift+Ctrl+H) +label.selected_region = Selected Region +label.all_sequences_columns = All Sequences and Columns +label.group_consensus = Group Consensus +label.group_conservation = Group Conservation +label.show_consensus_histogram = Show Consensus Histogram +label.show_consensus_logo = Show Consensus Logo +label.norm_consensus_logo = Normalise Consensus Logo +label.apply_all_groups = Apply to all groups +label.autocalculated_annotation = Autocalculated Annotation +label.min_colour = Min Colour +label.max_colour = Max Colour +label.use_original_colours = Use Original Colours +label.threshold_minmax = Threshold is min/max +label.represent_group_with = Represent Group with +label.selection = Selection +label.group_colour = Group Colour +label.sequence = Sequence +label.view_pdb_structure = View PDB Structure +label.min = Min: +label.max = Max: +label.colour_by_label = Colour by label +label.new_feature = New Feature +label.match_case = Match Case +label.view_alignment_editor = View in alignment editor +label.labels = Labels +label.output_values = Output Values... +label.input_data = Input Data... +label.nucleotide_matrix = Nucleotide matrix +label.protein_matrix = Protein matrix +label.show_bootstrap_values = Show Bootstrap Values +label.show_distances = Show distances +label.mark_unassociated_leaves = Mark Unassociated Leaves +label.fit_to_window = Fit To Window +label.newick_format = Newick Format +label.colours = Colours +label.view_mapping = View Mapping +label.wireframe = Wireframe +label.depthcue = Depthcue +label.z_buffering = Z Buffering +label.charge_cysteine = Charge & Cysteine +label.all_chains_visible = All Chains Visible +label.successfully_added_features_alignment = Successfully added features to alignment +label.keyboard_editing_mode = Keyboard editing mode is {0} +label.paste_features_annotations_Tcoffee_here = Paste your features / annotations / T-coffee score file here. +label.removed_columns = Removed {0} columns. +label.removed_empty_columns = Removed {0} empty columns. +label.paste_newick_tree_file = Paste your Newick tree file here. +label.order_by_params = Order by {0} +label.html_content = {0} +label.paste_pdb_file= Paste your PDB file here. +label.paste_pdb_file_for_sequence = Paste PDB file for sequence {0} +label.could_not_parse_newick_file = Could not parse Newick file\!\n {0} +label.successfully_pasted_tcoffee_scores_to_alignment= Successfully pasted T-Coffee scores to alignment. +label.failed_add_tcoffee_scores = Failed to add T-Coffee scores: +label.successfully_pasted_annotation_to_alignment= Successfully pasted annotation to alignment. +label.successfully_pasted_alignment_file = Successfully pasted alignment file +label.paste_your_alignment_file = Paste your alignment file here +label.paste_your = Paste your +label.finished_searching = Finished searching. +label.search_results= Search results {0} : {1} +label.found_match_for = Found match for {0} +label.font = Font: +label.size = Size: +label.style = Style: +label.enter_redundancy_threshold = Enter the redundancy threshold +label.calculating = Calculating.... +label.modify_conservation_visibility = Modify conservation visibility +label.colour_residues_above_occurence = Colour residues above % occurence +label.set_this_label_text = set this label text +label.sequences_from = Sequences from {0} +label.successfully_loaded_file = Successfully loaded file {0} +label.successfully_saved_to_file_in_format = Successfully saved to file: {0} in {1} format. +label.copied_sequences_to_clipboard = Copied {0} sequences to clipboard. +label.check_file_matches_sequence_ids_alignment = Check that the file matches sequence IDs in the alignment. +label.problem_reading_tcoffee_score_file = Problem reading T-COFFEE score file +label.source_to_target = {0} to '{1}' +label.per_sequence_only= Per-sequence only +label.to_file = to File +label.to_textbox = to Textbox +label.jalview = Jalview +label.csv_spreadsheet = CSV (Spreadsheet) +label.status = [Status] +label.channels = Channels +label.channel_title_item_count = {0} ({1}) +label.blog_item_published_on_date = {0} {1} +label.select_das_service_from_table = Select a DAS service from the table to read a full description here. +label.session_update = Session Update +label.new_vamsas_session = New Vamsas Session +label.groovy_console = Groovy Console... +label.lineart = Lineart +label.dont_ask_me_again = Don't ask me again +label.select_eps_character_rendering_style = Select EPS character rendering style +label.invert_selection = Invert Selection +label.optimise_order = Optimise Order +label.seq_sort_by_score = Seq sort by Score +label.load_colours = Load Colours +label.save_colours = Save Colours +label.fetch_das_features = Fetch DAS Features +label.selected_database_to_fetch_from = Selected {0} database {1} to fetch from {2} +label.database_param = Database: {0} +label.example_param = Example: {0} diff --git a/src/MCview/AppletPDBViewer.java b/src/MCview/AppletPDBViewer.java old mode 100755 new mode 100644 index 2872320..e8bfc28 --- a/src/MCview/AppletPDBViewer.java +++ b/src/MCview/AppletPDBViewer.java @@ -23,6 +23,7 @@ import java.awt.event.*; import jalview.appletgui.*; import jalview.datamodel.*; import jalview.schemes.*; +import jalview.util.MessageManager; public class AppletPDBViewer extends EmbmenuFrame implements ActionListener, ItemListener @@ -146,42 +147,42 @@ public class AppletPDBViewer extends EmbmenuFrame implements private void jbInit() throws Exception { setMenuBar(jMenuBar1); - fileMenu.setLabel("File"); - coloursMenu.setLabel("Colours"); - mapping.setLabel("View Mapping"); + fileMenu.setLabel(MessageManager.getString("action.file")); + coloursMenu.setLabel(MessageManager.getString("label.colours")); + mapping.setLabel(MessageManager.getString("label.view_mapping")); mapping.addActionListener(this); - wire.setLabel("Wireframe"); + wire.setLabel(MessageManager.getString("label.wireframe")); wire.addItemListener(this); depth.setState(true); - depth.setLabel("Depthcue"); + depth.setLabel(MessageManager.getString("label.depthcue")); depth.addItemListener(this); zbuffer.setState(true); - zbuffer.setLabel("Z Buffering"); + zbuffer.setLabel(MessageManager.getString("label.z_buffering")); zbuffer.addItemListener(this); - charge.setLabel("Charge & Cysteine"); + charge.setLabel(MessageManager.getString("label.charge_cysteine")); charge.addActionListener(this); - hydro.setLabel("Hydrophobicity"); + hydro.setLabel(MessageManager.getString("label.hydrophobicity")); hydro.addActionListener(this); - chain.setLabel("By Chain"); + chain.setLabel(MessageManager.getString("action.by_chain")); chain.addActionListener(this); - seqButton.setLabel("By Sequence"); + seqButton.setLabel(MessageManager.getString("action.by_sequence")); seqButton.addActionListener(this); - allchains.setLabel("All Chains Visible"); + allchains.setLabel(MessageManager.getString("label.all_chains_visible")); allchains.addItemListener(this); - viewMenu.setLabel("View"); - zappo.setLabel("Zappo"); + viewMenu.setLabel(MessageManager.getString("action.view")); + zappo.setLabel(MessageManager.getString("label.zappo")); zappo.addActionListener(this); - taylor.setLabel("Taylor"); + taylor.setLabel(MessageManager.getString("label.taylor")); taylor.addActionListener(this); - helix.setLabel("Helix Propensity"); + helix.setLabel(MessageManager.getString("label.helix_propensity")); helix.addActionListener(this); - strand.setLabel("Strand Propensity"); + strand.setLabel(MessageManager.getString("label.strand_propensity")); strand.addActionListener(this); - turn.setLabel("Turn Propensity"); + turn.setLabel(MessageManager.getString("label.turn_propensity")); turn.addActionListener(this); - buried.setLabel("Buried Index"); + buried.setLabel(MessageManager.getString("label.buried_index")); buried.addActionListener(this); - user.setLabel("User Defined..."); + user.setLabel(MessageManager.getString("action.user_defined")); user.addActionListener(this); jMenuBar1.add(fileMenu); jMenuBar1.add(coloursMenu); diff --git a/src/jalview/appletgui/APopupMenu.java b/src/jalview/appletgui/APopupMenu.java old mode 100755 new mode 100644 index c71818e..453e642 --- a/src/jalview/appletgui/APopupMenu.java +++ b/src/jalview/appletgui/APopupMenu.java @@ -26,6 +26,7 @@ import jalview.analysis.*; import jalview.commands.*; import jalview.datamodel.*; import jalview.schemes.*; +import jalview.util.MessageManager; import jalview.util.UrlLink; import jalview.io.AppletFormatAdapter; import jalview.io.SequenceAnnotationReport; @@ -159,7 +160,7 @@ public class APopupMenu extends java.awt.PopupMenu implements if (sg != null && sg.getSize() > 0) { - editGroupName.setLabel("Name: " + sg.getName()); + editGroupName.setLabel(MessageManager.formatMessage("label.name_param", new String[]{sg.getName()})); showText.setState(sg.getDisplayText()); showColourText.setState(sg.getColourText()); showBoxes.setState(sg.getDisplayBoxes()); @@ -300,7 +301,7 @@ public class APopupMenu extends java.awt.PopupMenu implements if (seq != null) { seqMenu.setLabel(seq.getName()); - repGroup.setLabel("Represent Group with " + seq.getName()); + repGroup.setLabel(MessageManager.formatMessage("label.represent_group_with", new String[]{seq.getName()})); } else { @@ -684,7 +685,7 @@ public class APopupMenu extends java.awt.PopupMenu implements jalview.bin.JalviewLite.addFrame(frame, "Sequence Details for " + (sequences.length == 1 ? sequences[0].getDisplayId(true) : "Selection"), 600, 500); - cap.setText("" + contents.toString() + ""); + cap.setText(MessageManager.formatMessage("label.html_content", new String[]{contents.toString()})); } void editName() @@ -719,51 +720,51 @@ public class APopupMenu extends java.awt.PopupMenu implements else { CutAndPasteTransfer cap = new CutAndPasteTransfer(true, ap.alignFrame); - cap.setText("Paste your PDB file here."); + cap.setText(MessageManager.getString("label.paste_pdb_file")); cap.setPDBImport(seq); Frame frame = new Frame(); frame.add(cap); jalview.bin.JalviewLite.addFrame(frame, - "Paste PDB file for sequence " + seq.getName(), 400, 300); + MessageManager.formatMessage("label.paste_pdb_file_for_sequence", new String[]{seq.getName()}), 400, 300); } } private void jbInit() throws Exception { - groupMenu.setLabel("Group"); - groupMenu.setLabel("Selection"); + groupMenu.setLabel(MessageManager.getString("label.group")); + groupMenu.setLabel(MessageManager.getString("label.selection")); sequenceFeature.addActionListener(this); editGroupName.addActionListener(this); - unGroupMenuItem.setLabel("Remove Group"); + unGroupMenuItem.setLabel(MessageManager.getString("action.remove_group")); unGroupMenuItem.addActionListener(this); - nucleotideMenuItem.setLabel("Nucleotide"); + nucleotideMenuItem.setLabel(MessageManager.getString("label.nucleotide")); nucleotideMenuItem.addActionListener(this); conservationMenuItem.addItemListener(this); abovePIDColour.addItemListener(this); - colourMenu.setLabel("Group Colour"); - showBoxes.setLabel("Boxes"); + colourMenu.setLabel(MessageManager.getString("label.group_colour")); + showBoxes.setLabel(MessageManager.getString("label.boxes")); showBoxes.setState(true); showBoxes.addItemListener(this); sequenceName.addActionListener(this); sequenceDetails.addActionListener(this); selSeqDetails.addActionListener(this); - displayNonconserved.setLabel("Show Nonconserved"); + displayNonconserved.setLabel(MessageManager.getString("label.show_non_conversed")); displayNonconserved.setState(false); displayNonconserved.addItemListener(this); - showText.setLabel("Text"); + showText.setLabel(MessageManager.getString("label.text")); showText.addItemListener(this); - showColourText.setLabel("Colour Text"); + showColourText.setLabel(MessageManager.getString("label.colour_text")); showColourText.addItemListener(this); - outputmenu.setLabel("Output to Textbox..."); - seqMenu.setLabel("Sequence"); - pdb.setLabel("View PDB Structure"); - hideSeqs.setLabel("Hide Sequences"); - repGroup.setLabel("Represent Group with"); - revealAll.setLabel("Reveal All"); - revealSeq.setLabel("Reveal Sequences"); - menu1.setLabel("Group"); + outputmenu.setLabel(MessageManager.getString("label.out_to_textbox")); + seqMenu.setLabel(MessageManager.getString("label.sequence")); + pdb.setLabel(MessageManager.getString("label.view_pdb_structure")); + hideSeqs.setLabel(MessageManager.getString("action.hide_sequences")); + repGroup.setLabel(MessageManager.getString("label.represent_group_with")); + revealAll.setLabel(MessageManager.getString("action.reveal_all")); + revealSeq.setLabel(MessageManager.getString("action.reveal_sequences")); + menu1.setLabel(MessageManager.getString("label.group")); add(groupMenu); this.add(seqMenu); this.add(hideSeqs); diff --git a/src/jalview/appletgui/AlignFrame.java b/src/jalview/appletgui/AlignFrame.java index 0f0ba4e..f55bb6c 100644 --- a/src/jalview/appletgui/AlignFrame.java +++ b/src/jalview/appletgui/AlignFrame.java @@ -57,6 +57,7 @@ import jalview.schemes.TaylorColourScheme; import jalview.schemes.TurnColourScheme; import jalview.schemes.ZappoColourScheme; import jalview.structure.StructureSelectionManager; +import jalview.util.MessageManager; import java.awt.BorderLayout; import java.awt.Canvas; @@ -295,7 +296,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, viewport.featureSettings.refreshTable(); } alignPanel.paintAlignment(true); - statusBar.setText("Successfully added features to alignment."); + statusBar.setText(MessageManager.getString("label.successfully_added_features_alignment")); } return featuresFile; } @@ -439,8 +440,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, case KeyEvent.VK_F2: viewport.cursorMode = !viewport.cursorMode; - statusBar.setText("Keyboard editing mode is " - + (viewport.cursorMode ? "on" : "off")); + statusBar.setText(MessageManager.formatMessage("label.keyboard_editing_mode", new String[]{(viewport.cursorMode ? "on" : "off")})); if (viewport.cursorMode) { alignPanel.seqPanel.seqCanvas.cursorX = viewport.startRes; @@ -1132,11 +1132,11 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, public void loadAnnotations() { CutAndPasteTransfer cap = new CutAndPasteTransfer(true, this); - cap.setText("Paste your features / annotations / T-coffee score file here."); + cap.setText(MessageManager.getString("label.paste_features_annotations_Tcoffee_here")); cap.setAnnotationImport(); Frame frame = new Frame(); frame.add(cap); - jalview.bin.JalviewLite.addFrame(frame, "Paste Annotations ", 400, 300); + jalview.bin.JalviewLite.addFrame(frame, MessageManager.getString("action.paste_annotations"), 400, 300); } @@ -1347,12 +1347,12 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, { undoMenuItem.setEnabled(true); CommandI command = (CommandI) viewport.historyList.peek(); - undoMenuItem.setLabel("Undo " + command.getDescription()); + undoMenuItem.setLabel(MessageManager.formatMessage("label.undo_command", new String[]{command.getDescription()})); } else { undoMenuItem.setEnabled(false); - undoMenuItem.setLabel("Undo"); + undoMenuItem.setLabel(MessageManager.getString("action.undo")); } if (viewport.redoList.size() > 0) @@ -1360,12 +1360,12 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, redoMenuItem.setEnabled(true); CommandI command = (CommandI) viewport.redoList.peek(); - redoMenuItem.setLabel("Redo " + command.getDescription()); + redoMenuItem.setLabel(MessageManager.formatMessage("label.redo_command", new String[]{command.getDescription()})); } else { redoMenuItem.setEnabled(false); - redoMenuItem.setLabel("Redo"); + redoMenuItem.setLabel(MessageManager.getString("action.redo")); } } @@ -2019,8 +2019,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, viewport.getSelectionGroup()); } - statusBar.setText("Removed " + trimRegion.getSize() + " columns."); - + statusBar.setText(MessageManager.formatMessage("label.removed_columns", new String[]{Integer.valueOf(trimRegion.getSize()).toString()})); addHistoryItem(trimRegion); for (SequenceGroup sg : viewport.getAlignment().getGroups()) @@ -2060,8 +2059,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, addHistoryItem(removeGapCols); - statusBar.setText("Removed " + removeGapCols.getSize() - + " empty columns."); + statusBar.setText(MessageManager.formatMessage("label.removed_empty_columns", new String[]{Integer.valueOf(removeGapCols.getSize()).toString()})); // This is to maintain viewport position on first residue // of first sequence @@ -2564,7 +2562,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, void loadTree_actionPerformed() { CutAndPasteTransfer cap = new CutAndPasteTransfer(true, this); - cap.setText("Paste your Newick tree file here."); + cap.setText(MessageManager.getString("label.paste_newick_tree_file")); cap.setTreeImport(); Frame frame = new Frame(); frame.add(cap); @@ -2593,7 +2591,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, .sortByTree(viewport.getAlignment(), treePanel.getTree()); // addHistoryItem(new HistoryItem("Sort", viewport.alignment, // HistoryItem.SORT)); - addHistoryItem(new OrderCommand("Order by " + title, oldOrder, + addHistoryItem(new OrderCommand(MessageManager.formatMessage("label.order_by_params", new String[]{title}), oldOrder, viewport.getAlignment())); alignPanel.paintAlignment(true); } @@ -2969,191 +2967,191 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, selectAllSequenceMenuItem.addActionListener(this); deselectAllSequenceMenuItem.addActionListener(this); invertSequenceMenuItem.addActionListener(this); - remove2LeftMenuItem.setLabel("Remove Left"); + remove2LeftMenuItem.setLabel(MessageManager.getString("action.remove_left")); remove2LeftMenuItem.addActionListener(this); - remove2RightMenuItem.setLabel("Remove Right"); + remove2RightMenuItem.setLabel(MessageManager.getString("action.remove_right")); remove2RightMenuItem.addActionListener(this); - removeGappedColumnMenuItem.setLabel("Remove Empty Columns"); + removeGappedColumnMenuItem.setLabel(MessageManager.getString("action.remove_empty_columns")); removeGappedColumnMenuItem.addActionListener(this); - removeAllGapsMenuItem.setLabel("Remove All Gaps"); + removeAllGapsMenuItem.setLabel(MessageManager.getString("action.remove_all_gaps")); removeAllGapsMenuItem.addActionListener(this); - viewBoxesMenuItem.setLabel("Boxes"); + viewBoxesMenuItem.setLabel(MessageManager.getString("action.boxes")); viewBoxesMenuItem.setState(true); viewBoxesMenuItem.addItemListener(this); - viewTextMenuItem.setLabel("Text"); + viewTextMenuItem.setLabel(MessageManager.getString("action.text")); viewTextMenuItem.setState(true); viewTextMenuItem.addItemListener(this); - sortPairwiseMenuItem.setLabel("by Pairwise Identity"); + sortPairwiseMenuItem.setLabel(MessageManager.getString("action.by_pairwise_id")); sortPairwiseMenuItem.addActionListener(this); - sortIDMenuItem.setLabel("by ID"); + sortIDMenuItem.setLabel(MessageManager.getString("action.by_id")); sortIDMenuItem.addActionListener(this); - sortLengthMenuItem.setLabel("by Length"); + sortLengthMenuItem.setLabel(MessageManager.getString("action.by_length")); sortLengthMenuItem.addActionListener(this); - sortGroupMenuItem.setLabel("by Group"); + sortGroupMenuItem.setLabel(MessageManager.getString("action.by_group")); sortGroupMenuItem.addActionListener(this); - removeRedundancyMenuItem.setLabel("Remove Redundancy..."); + removeRedundancyMenuItem.setLabel(MessageManager.getString("action.remove_redundancy")); removeRedundancyMenuItem.addActionListener(this); - pairwiseAlignmentMenuItem.setLabel("Pairwise Alignments..."); + pairwiseAlignmentMenuItem.setLabel(MessageManager.getString("action.pairwise_alignment")); pairwiseAlignmentMenuItem.addActionListener(this); - PCAMenuItem.setLabel("Principal Component Analysis"); + PCAMenuItem.setLabel(MessageManager.getString("label.principal_component_analysis")); PCAMenuItem.addActionListener(this); averageDistanceTreeMenuItem - .setLabel("Average Distance Using % Identity"); + .setLabel(MessageManager.getString("label.average_distance_identity")); averageDistanceTreeMenuItem.addActionListener(this); - neighbourTreeMenuItem.setLabel("Neighbour Joining Using % Identity"); + neighbourTreeMenuItem.setLabel(MessageManager.getString("label.neighbour_joining_identity")); neighbourTreeMenuItem.addActionListener(this); statusBar.setBackground(Color.white); statusBar.setFont(new java.awt.Font("Verdana", 0, 11)); - statusBar.setText("Status bar"); - outputTextboxMenu.setLabel("Output to Textbox"); - clustalColour.setLabel("Clustalx"); + statusBar.setText(MessageManager.getString("label.status_bar")); + outputTextboxMenu.setLabel(MessageManager.getString("label.out_to_textbox")); + clustalColour.setLabel(MessageManager.getString("label.clustalx")); clustalColour.addActionListener(this); - zappoColour.setLabel("Zappo"); + zappoColour.setLabel(MessageManager.getString("label.zappo")); zappoColour.addActionListener(this); - taylorColour.setLabel("Taylor"); + taylorColour.setLabel(MessageManager.getString("label.taylor")); taylorColour.addActionListener(this); - hydrophobicityColour.setLabel("Hydrophobicity"); + hydrophobicityColour.setLabel(MessageManager.getString("label.hydrophobicity")); hydrophobicityColour.addActionListener(this); - helixColour.setLabel("Helix Propensity"); + helixColour.setLabel(MessageManager.getString("label.helix_propensity")); helixColour.addActionListener(this); - strandColour.setLabel("Strand Propensity"); + strandColour.setLabel(MessageManager.getString("label.strand_propensity")); strandColour.addActionListener(this); - turnColour.setLabel("Turn Propensity"); + turnColour.setLabel(MessageManager.getString("label.turn_propensity")); turnColour.addActionListener(this); - buriedColour.setLabel("Buried Index"); + buriedColour.setLabel(MessageManager.getString("label.buried_index")); buriedColour.addActionListener(this); - purinePyrimidineColour.setLabel("Purine/Pyrimidine"); + purinePyrimidineColour.setLabel(MessageManager.getString("label.purine_pyrimidine")); purinePyrimidineColour.addActionListener(this); - RNAHelixColour.setLabel("by RNA Helices"); + RNAHelixColour.setLabel(MessageManager.getString("action.by_rna_helixes")); RNAHelixColour.addActionListener(this); - userDefinedColour.setLabel("User Defined..."); + userDefinedColour.setLabel(MessageManager.getString("action.user_defined")); userDefinedColour.addActionListener(this); - PIDColour.setLabel("Percentage Identity"); + PIDColour.setLabel(MessageManager.getString("label.percentage_identity")); PIDColour.addActionListener(this); - BLOSUM62Colour.setLabel("BLOSUM62 Score"); + BLOSUM62Colour.setLabel(MessageManager.getString("label.blosum62_score")); BLOSUM62Colour.addActionListener(this); - tcoffeeColour.setLabel("T-Coffee Scores"); + tcoffeeColour.setLabel(MessageManager.getString("label.tcoffee_scores")); tcoffeeColour.setEnabled(false); // it will enabled only if a score file is // provided tcoffeeColour.addActionListener(this); avDistanceTreeBlosumMenuItem - .setLabel("Average Distance Using BLOSUM62"); + .setLabel(MessageManager.getString("label.average_distance_bloslum62")); avDistanceTreeBlosumMenuItem.addActionListener(this); - njTreeBlosumMenuItem.setLabel("Neighbour Joining Using BLOSUM62"); + njTreeBlosumMenuItem.setLabel(MessageManager.getString("label.neighbour_blosum62")); njTreeBlosumMenuItem.addActionListener(this); - annotationPanelMenuItem.setLabel("Show Annotations"); + annotationPanelMenuItem.setLabel(MessageManager.getString("label.show_annotations")); annotationPanelMenuItem.addItemListener(this); - colourTextMenuItem.setLabel("Colour Text"); + colourTextMenuItem.setLabel(MessageManager.getString("label.colour_text")); colourTextMenuItem.addItemListener(this); - displayNonconservedMenuItem.setLabel("Show nonconserved"); + displayNonconservedMenuItem.setLabel(MessageManager.getString("label.show_non_conversed")); displayNonconservedMenuItem.addItemListener(this); alProperties.addActionListener(this); - overviewMenuItem.setLabel("Overview Window"); + overviewMenuItem.setLabel(MessageManager.getString("label.overview_window")); overviewMenuItem.addActionListener(this); undoMenuItem.setEnabled(false); - undoMenuItem.setLabel("Undo"); + undoMenuItem.setLabel(MessageManager.getString("action.undo")); undoMenuItem.addActionListener(this); redoMenuItem.setEnabled(false); - redoMenuItem.setLabel("Redo"); + redoMenuItem.setLabel(MessageManager.getString("action.redo")); redoMenuItem.addActionListener(this); - conservationMenuItem.setLabel("by Conservation"); + conservationMenuItem.setLabel(MessageManager.getString("action.by_conservation")); conservationMenuItem.addItemListener(this); - noColourmenuItem.setLabel("None"); + noColourmenuItem.setLabel(MessageManager.getString("label.none")); noColourmenuItem.addActionListener(this); - wrapMenuItem.setLabel("Wrap"); + wrapMenuItem.setLabel(MessageManager.getString("action.wrap")); wrapMenuItem.addItemListener(this); - renderGapsMenuItem.setLabel("Show Gaps"); + renderGapsMenuItem.setLabel(MessageManager.getString("action.show_gaps")); renderGapsMenuItem.setState(true); renderGapsMenuItem.addItemListener(this); - findMenuItem.setLabel("Find..."); + findMenuItem.setLabel(MessageManager.getString("action.find")); findMenuItem.addActionListener(this); - abovePIDThreshold.setLabel("Above Identity Threshold"); + abovePIDThreshold.setLabel(MessageManager.getString("label.above_identity_threshold")); abovePIDThreshold.addItemListener(this); - nucleotideColour.setLabel("Nucleotide"); + nucleotideColour.setLabel(MessageManager.getString("label.nucleotide")); nucleotideColour.addActionListener(this); - deleteGroups.setLabel("Undefine Groups"); + deleteGroups.setLabel(MessageManager.getString("action.undefine_groups")); deleteGroups.addActionListener(this); - grpsFromSelection.setLabel("Make Groups for selection"); + grpsFromSelection.setLabel(MessageManager.getString("action.make_groups_selection")); grpsFromSelection.addActionListener(this); - copy.setLabel("Copy"); + copy.setLabel(MessageManager.getString("action.copy")); copy.addActionListener(this); - cut.setLabel("Cut"); + cut.setLabel(MessageManager.getString("action.cut")); cut.addActionListener(this); - delete.setLabel("Delete"); + delete.setLabel(MessageManager.getString("action.delete")); delete.addActionListener(this); - pasteMenu.setLabel("Paste"); - pasteNew.setLabel("To New Alignment"); + pasteMenu.setLabel(MessageManager.getString("action.paste")); + pasteNew.setLabel(MessageManager.getString("label.to_new_alignment")); pasteNew.addActionListener(this); - pasteThis.setLabel("Add To This Alignment"); + pasteThis.setLabel(MessageManager.getString("label.to_this_alignment")); pasteThis.addActionListener(this); - applyToAllGroups.setLabel("Apply Colour To All Groups"); + applyToAllGroups.setLabel(MessageManager.getString("label.apply_colour_to_all_groups")); applyToAllGroups.setState(true); applyToAllGroups.addItemListener(this); - font.setLabel("Font..."); + font.setLabel(MessageManager.getString("action.font")); font.addActionListener(this); - scaleAbove.setLabel("Scale Above"); + scaleAbove.setLabel(MessageManager.getString("action.scale_above")); scaleAbove.setState(true); scaleAbove.setEnabled(false); scaleAbove.addItemListener(this); scaleLeft.setEnabled(false); scaleLeft.setState(true); - scaleLeft.setLabel("Scale Left"); + scaleLeft.setLabel(MessageManager.getString("action.scale_left")); scaleLeft.addItemListener(this); scaleRight.setEnabled(false); scaleRight.setState(true); - scaleRight.setLabel("Scale Right"); + scaleRight.setLabel(MessageManager.getString("action.scale_right")); scaleRight.addItemListener(this); - modifyPID.setLabel("Modify Identity Threshold..."); + modifyPID.setLabel(MessageManager.getString("label.modify_identity_thereshold")); modifyPID.addActionListener(this); - modifyConservation.setLabel("Modify Conservation Threshold..."); + modifyConservation.setLabel(MessageManager.getString("label.modify_conservation_thereshold")); modifyConservation.addActionListener(this); - sortByTreeMenu.setLabel("By Tree Order"); - sort.setLabel("Sort"); - calculate.setLabel("Calculate Tree"); + sortByTreeMenu.setLabel(MessageManager.getString("action.by_tree_order")); + sort.setLabel(MessageManager.getString("action.sort")); + calculate.setLabel(MessageManager.getString("action.calculate_tree")); autoCalculate.addItemListener(this); sortByTree.addItemListener(this); - inputText.setLabel("Input from textbox"); + inputText.setLabel(MessageManager.getString("label.input_from_textbox")); inputText.addActionListener(this); - centreColumnLabelFlag.setLabel("Centre column labels"); + centreColumnLabelFlag.setLabel(MessageManager.getString("label.centre_column_labels")); centreColumnLabelFlag.addItemListener(this); - followMouseOverFlag.setLabel("Automatic Scrolling"); + followMouseOverFlag.setLabel(MessageManager.getString("label.automatic_scrolling")); followMouseOverFlag.addItemListener(this); - helpMenu.setLabel("Help"); - documentation.setLabel("Documentation"); + helpMenu.setLabel(MessageManager.getString("action.help")); + documentation.setLabel(MessageManager.getString("label.documentation")); documentation.addActionListener(this); - about.setLabel("About..."); + about.setLabel(MessageManager.getString("label.about")); about.addActionListener(this); seqLimits.setState(true); - seqLimits.setLabel("Show Sequence Limits"); + seqLimits.setLabel(MessageManager.getString("label.show_sequence_limits")); seqLimits.addItemListener(this); - featureSettings.setLabel("Feature Settings..."); + featureSettings.setLabel(MessageManager.getString("label.feature_settings")); featureSettings.addActionListener(this); - sequenceFeatures.setLabel("Sequence Features"); + sequenceFeatures.setLabel(MessageManager.getString("label.sequence_features")); sequenceFeatures.addItemListener(this); sequenceFeatures.setState(false); - annotationColour.setLabel("by Annotation..."); + annotationColour.setLabel(MessageManager.getString("action.by_annotation")); annotationColour.addActionListener(this); - invertSequenceMenuItem.setLabel("Invert Sequence Selection"); - invertColSel.setLabel("Invert Column Selection"); - menu1.setLabel("Show"); - showColumns.setLabel("All Columns "); - showSeqs.setLabel("All Sequences"); - menu2.setLabel("Hide"); - hideColumns.setLabel("Selected Columns"); - hideSequences.setLabel("Selected Sequences"); - hideAllButSelection.setLabel("All but Selected Region (Shift+Ctrl+H)"); - hideAllSelection.setLabel("Selected Region"); - showAllHidden.setLabel("All Sequences and Columns"); - showGroupConsensus.setLabel("Group Consensus"); - showGroupConservation.setLabel("Group Conservation"); - showConsensusHistogram.setLabel("Show Consensus Histogram"); - showSequenceLogo.setLabel("Show Consensus Logo"); - normSequenceLogo.setLabel("Normalise Consensus Logo"); - applyAutoAnnotationSettings.setLabel("Apply to all groups"); + invertSequenceMenuItem.setLabel(MessageManager.getString("action.invert_sequence_selection")); + invertColSel.setLabel(MessageManager.getString("action.invert_column_selection")); + menu1.setLabel(MessageManager.getString("action.show")); + showColumns.setLabel(MessageManager.getString("label.all_columns")); + showSeqs.setLabel(MessageManager.getString("label.all_sequences")); + menu2.setLabel(MessageManager.getString("aciton.hide")); + hideColumns.setLabel(MessageManager.getString("label.selected_columns")); + hideSequences.setLabel(MessageManager.getString("label.selected_sequences")); + hideAllButSelection.setLabel(MessageManager.getString("label.all_but_selected_region")); + hideAllSelection.setLabel(MessageManager.getString("label.selected_region")); + showAllHidden.setLabel(MessageManager.getString("label.all_sequences_columns")); + showGroupConsensus.setLabel(MessageManager.getString("label.group_consensus")); + showGroupConservation.setLabel(MessageManager.getString("label.group_conservation")); + showConsensusHistogram.setLabel(MessageManager.getString("label.show_consensus_histogram")); + showSequenceLogo.setLabel(MessageManager.getString("label.show_consensus_logo")); + normSequenceLogo.setLabel(MessageManager.getString("label.norm_consensus_logo")); + applyAutoAnnotationSettings.setLabel(MessageManager.getString("label.apply_all_groups")); applyAutoAnnotationSettings.setState(true); - autoAnnMenu.setLabel("Autocalculated Annotation"); + autoAnnMenu.setLabel(MessageManager.getString("label.autocalculated_annotation")); invertColSel.addActionListener(this); showColumns.addActionListener(this); @@ -3170,9 +3168,9 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, normSequenceLogo.addItemListener(this); applyAutoAnnotationSettings.addItemListener(this); - formatMenu.setLabel("Format"); - selectMenu.setLabel("Select"); - newView.setLabel("New View"); + formatMenu.setLabel(MessageManager.getString("action.format")); + selectMenu.setLabel(MessageManager.getString("action.select")); + newView.setLabel(MessageManager.getString("action.new_view")); newView.addActionListener(this); alignFrameMenuBar.add(fileMenu); alignFrameMenuBar.add(editMenu); diff --git a/src/jalview/appletgui/AnnotationColourChooser.java b/src/jalview/appletgui/AnnotationColourChooser.java old mode 100755 new mode 100644 index d26680d..769e068 --- a/src/jalview/appletgui/AnnotationColourChooser.java +++ b/src/jalview/appletgui/AnnotationColourChooser.java @@ -24,6 +24,7 @@ import java.awt.event.*; import jalview.datamodel.*; import jalview.schemes.*; +import jalview.util.MessageManager; public class AnnotationColourChooser extends Panel implements ActionListener, AdjustmentListener, ItemListener, MouseListener @@ -170,21 +171,21 @@ public class AnnotationColourChooser extends Panel implements private void jbInit() throws Exception { minColour.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); - minColour.setLabel("Min Colour"); + minColour.setLabel(MessageManager.getString("label.min_colour")); minColour.addActionListener(this); maxColour.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); - maxColour.setLabel("Max Colour"); + maxColour.setLabel(MessageManager.getString("label.max_colour")); maxColour.addActionListener(this); thresholdIsMin.addItemListener(this); - ok.setLabel("OK"); + ok.setLabel(MessageManager.getString("action.ok")); ok.addActionListener(this); - cancel.setLabel("Cancel"); + cancel.setLabel(MessageManager.getString("action.cancel")); cancel.addActionListener(this); - defColours.setLabel("Defaults"); + defColours.setLabel(MessageManager.getString("action.set_defaults")); defColours.addActionListener(this); annotations.addItemListener(this); @@ -197,11 +198,11 @@ public class AnnotationColourChooser extends Panel implements thresholdValue.setEnabled(false); thresholdValue.setColumns(5); currentColours.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); - currentColours.setLabel("Use Original Colours"); + currentColours.setLabel(MessageManager.getString("label.use_original_colours")); currentColours.addItemListener(this); thresholdIsMin.setBackground(Color.white); - thresholdIsMin.setLabel("Threshold is min/max"); + thresholdIsMin.setLabel(MessageManager.getString("label.threshold_minmax")); this.setLayout(borderLayout1); diff --git a/src/jalview/appletgui/CutAndPasteTransfer.java b/src/jalview/appletgui/CutAndPasteTransfer.java old mode 100755 new mode 100644 index c7a49f3..8e758e6 --- a/src/jalview/appletgui/CutAndPasteTransfer.java +++ b/src/jalview/appletgui/CutAndPasteTransfer.java @@ -23,6 +23,7 @@ import java.awt.event.*; import jalview.datamodel.*; import jalview.io.*; import jalview.schemes.TCoffeeColourScheme; +import jalview.util.MessageManager; public class CutAndPasteTransfer extends Panel implements ActionListener, MouseListener @@ -68,7 +69,7 @@ public class CutAndPasteTransfer extends Panel implements ActionListener, public void setPDBImport(Sequence seq) { this.seq = seq; - accept.setLabel("Accept"); + accept.setLabel(MessageManager.getString("action.accept")); addSequences.setVisible(false); pdbImport = true; } @@ -76,14 +77,14 @@ public class CutAndPasteTransfer extends Panel implements ActionListener, public void setTreeImport() { treeImport = true; - accept.setLabel("Accept"); + accept.setLabel(MessageManager.getString("action.accept")); addSequences.setVisible(false); } public void setAnnotationImport() { annotationImport = true; - accept.setLabel("Accept"); + accept.setLabel(MessageManager.getString("action.accept")); addSequences.setVisible(false); } @@ -153,7 +154,7 @@ public class CutAndPasteTransfer extends Panel implements ActionListener, { // TODO: JAL-1102 - should have a warning message in dialog, not simply // overwrite the broken input data with the exception - textarea.setText("Could not parse Newick file!\n" + ex); + textarea.setText(MessageManager.formatMessage("label.could_not_parse_newick_file", new String[]{ex.getMessage()})); return; } } @@ -174,14 +175,12 @@ public class CutAndPasteTransfer extends Panel implements ActionListener, alignFrame.changeColour(new TCoffeeColourScheme( alignFrame.viewport.getAlignment())); alignFrame.statusBar - .setText("Successfully pasted T-Coffee scores to alignment."); + .setText(MessageManager.getString("label.successfully_pasted_tcoffee_scores_to_alignment")); } else { // file valid but didn't get added to alignment for some reason - alignFrame.statusBar.setText("Failed to add T-Coffee scores: " - + (tcf.getWarningMessage() != null ? tcf - .getWarningMessage() : "")); + alignFrame.statusBar.setText(MessageManager.formatMessage("label.failed_add_tcoffee_scores", new String[]{(tcf.getWarningMessage() != null ? tcf.getWarningMessage() : "")})); } } else @@ -236,13 +235,13 @@ public class CutAndPasteTransfer extends Panel implements ActionListener, { AlignFrame af = new AlignFrame(al, alignFrame.viewport.applet, "Cut & Paste input - " + format, false); - af.statusBar.setText("Successfully pasted alignment file"); + af.statusBar.setText(MessageManager.getString("label.successfully_pasted_annotation_to_alignment")); } else { alignFrame.addSequences(al.getSequencesArray()); alignFrame.statusBar - .setText("Successfully pasted alignment file"); + .setText(MessageManager.getString("label.successfully_pasted_alignment_file")); } } } @@ -286,7 +285,7 @@ public class CutAndPasteTransfer extends Panel implements ActionListener, private void jbInit() throws Exception { textarea.setFont(new java.awt.Font("Monospaced", Font.PLAIN, 10)); - textarea.setText("Paste your alignment file here"); + textarea.setText(MessageManager.getString("label.paste_your_alignment_file")); textarea.addMouseListener(this); this.setLayout(borderLayout1); accept.addActionListener(this); @@ -301,7 +300,7 @@ public class CutAndPasteTransfer extends Panel implements ActionListener, public void mousePressed(MouseEvent evt) { - if (textarea.getText().startsWith("Paste your")) + if (textarea.getText().startsWith(MessageManager.getString("label.paste_your"))) { textarea.setText(""); } diff --git a/src/jalview/appletgui/FeatureColourChooser.java b/src/jalview/appletgui/FeatureColourChooser.java index 235e82c..c36d680 100644 --- a/src/jalview/appletgui/FeatureColourChooser.java +++ b/src/jalview/appletgui/FeatureColourChooser.java @@ -24,6 +24,7 @@ import java.awt.event.*; import jalview.datamodel.*; import jalview.schemes.*; +import jalview.util.MessageManager; public class FeatureColourChooser extends Panel implements ActionListener, AdjustmentListener, ItemListener, MouseListener @@ -143,7 +144,7 @@ public class FeatureColourChooser extends Panel implements ActionListener, private void jbInit() throws Exception { - Label minLabel = new Label("Min:"), maxLabel = new Label("Max:"); + Label minLabel = new Label(MessageManager.getString("label.min")), maxLabel = new Label(MessageManager.getString("label.max")); minLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); maxLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); // minColour.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); @@ -182,11 +183,11 @@ public class FeatureColourChooser extends Panel implements ActionListener, jPanel3.setBackground(Color.white); colourFromLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); - colourFromLabel.setLabel("Colour by Label"); + colourFromLabel.setLabel(MessageManager.getString("label.colour_by_label")); colourFromLabel.setSize(new Dimension(139, 22)); // threshold.setBounds(new Rectangle(11, 3, 139, 22)); thresholdIsMin.setBackground(Color.white); - thresholdIsMin.setLabel("Threshold is min/max"); + thresholdIsMin.setLabel(MessageManager.getString("label.threshold_minmax")); thresholdIsMin.setSize(new Dimension(135, 23)); // thresholdIsMin.setBounds(new Rectangle(328, 3, 135, 23)); jPanel1.add(minLabel); diff --git a/src/jalview/appletgui/FeatureRenderer.java b/src/jalview/appletgui/FeatureRenderer.java old mode 100755 new mode 100644 index dd236bd..2067c7e --- a/src/jalview/appletgui/FeatureRenderer.java +++ b/src/jalview/appletgui/FeatureRenderer.java @@ -26,6 +26,7 @@ import java.awt.event.*; import jalview.datamodel.*; import jalview.schemes.AnnotationColourGradient; import jalview.schemes.GraduatedColor; +import jalview.util.MessageManager; /** * DOCUMENT ME! @@ -364,7 +365,7 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer } else { - dialog.ok.setLabel("Amend"); + dialog.ok.setLabel(MessageManager.getString("label.amend")); dialog.buttonPanel.add(deleteButton, 1); deleteButton.addActionListener(new ActionListener() { diff --git a/src/jalview/appletgui/Finder.java b/src/jalview/appletgui/Finder.java old mode 100755 new mode 100644 index 7722461..eb2a554 --- a/src/jalview/appletgui/Finder.java +++ b/src/jalview/appletgui/Finder.java @@ -23,6 +23,7 @@ import java.awt.*; import java.awt.event.*; import jalview.datamodel.*; +import jalview.util.MessageManager; public class Finder extends Panel implements ActionListener { @@ -163,7 +164,7 @@ public class Finder extends Panel implements ActionListener // 'SelectRegion' selection if (!haveResults) { - ap.alignFrame.statusBar.setText("Finished searching."); + ap.alignFrame.statusBar.setText(MessageManager.getString("label.finished_searching")); resIndex = -1; seqIndex = 0; } @@ -182,14 +183,13 @@ public class Finder extends Panel implements ActionListener { message += searchResults.getSize() + " subsequence matches."; } - ap.alignFrame.statusBar.setText("Search results: " + searchString - + " : " + message); + ap.alignFrame.statusBar.setText(MessageManager.formatMessage("label.search_results", new String[] {searchString, message})); } else { // TODO: indicate sequence and matching position in status bar - ap.alignFrame.statusBar.setText("Found match for " + searchString); + ap.alignFrame.statusBar.setText(MessageManager.formatMessage("label.found_match_for", new String[]{searchString})); } } } @@ -213,7 +213,7 @@ public class Finder extends Panel implements ActionListener private void jbInit() throws Exception { jLabel1.setFont(new java.awt.Font("Verdana", 0, 12)); - jLabel1.setText("Find"); + jLabel1.setText(MessageManager.getString("action.find")); jLabel1.setBounds(new Rectangle(3, 30, 34, 15)); this.setLayout(null); textfield.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); @@ -228,11 +228,11 @@ public class Finder extends Panel implements ActionListener }); textfield.addActionListener(this); findAll.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); - findAll.setLabel("Find all"); + findAll.setLabel(MessageManager.getString("action.find_all")); findAll.addActionListener(this); findNext.setEnabled(false); findNext.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); - findNext.setLabel("Find Next"); + findNext.setLabel(MessageManager.getString("action.find_next")); findNext.addActionListener(this); jPanel1.setBounds(new Rectangle(180, 5, 141, 64)); jPanel1.setLayout(gridLayout1); @@ -241,9 +241,9 @@ public class Finder extends Panel implements ActionListener gridLayout1.setVgap(2); createNewGroup.setEnabled(false); createNewGroup.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); - createNewGroup.setLabel("New Feature"); + createNewGroup.setLabel(MessageManager.getString("label.new_feature")); createNewGroup.addActionListener(this); - caseSensitive.setLabel("Match Case"); + caseSensitive.setLabel(MessageManager.getString("label.match_case")); caseSensitive.setBounds(new Rectangle(40, 49, 126, 23)); jPanel1.add(findNext, null); jPanel1.add(findAll, null); diff --git a/src/jalview/appletgui/FontChooser.java b/src/jalview/appletgui/FontChooser.java old mode 100755 new mode 100644 index 5df659b..9edea23 --- a/src/jalview/appletgui/FontChooser.java +++ b/src/jalview/appletgui/FontChooser.java @@ -17,6 +17,8 @@ */ package jalview.appletgui; +import jalview.util.MessageManager; + import java.awt.*; import java.awt.event.*; @@ -272,7 +274,7 @@ public class FontChooser extends Panel implements ActionListener, { label1.setFont(new java.awt.Font("Verdana", 0, 11)); label1.setAlignment(Label.RIGHT); - label1.setText("Font: "); + label1.setText(MessageManager.getString("label.font")); this.setLayout(borderLayout4); fontSize.setFont(new java.awt.Font("Verdana", 0, 11)); fontSize.addItemListener(this); @@ -280,17 +282,17 @@ public class FontChooser extends Panel implements ActionListener, fontStyle.addItemListener(this); label2.setAlignment(Label.RIGHT); label2.setFont(new java.awt.Font("Verdana", 0, 11)); - label2.setText("Size: "); + label2.setText(MessageManager.getString("label.size")); label3.setAlignment(Label.RIGHT); label3.setFont(new java.awt.Font("Verdana", 0, 11)); - label3.setText("Style: "); + label3.setText(MessageManager.getString("label.style")); fontName.setFont(new java.awt.Font("Verdana", 0, 11)); fontName.addItemListener(this); ok.setFont(new java.awt.Font("Verdana", 0, 11)); - ok.setLabel("OK"); + ok.setLabel(MessageManager.getString("action.ok")); ok.addActionListener(this); cancel.setFont(new java.awt.Font("Verdana", 0, 11)); - cancel.setLabel("Cancel"); + cancel.setLabel(MessageManager.getString("action.cancel")); cancel.addActionListener(this); this.setBackground(Color.white); panel1.setLayout(borderLayout1); diff --git a/src/jalview/appletgui/PCAPanel.java b/src/jalview/appletgui/PCAPanel.java old mode 100755 new mode 100644 index 9ddb132..80365e9 --- a/src/jalview/appletgui/PCAPanel.java +++ b/src/jalview/appletgui/PCAPanel.java @@ -21,6 +21,7 @@ import java.awt.*; import java.awt.event.*; import jalview.datamodel.*; +import jalview.util.MessageManager; import jalview.viewmodel.PCAModel; public class PCAPanel extends EmbmenuFrame implements Runnable, @@ -314,20 +315,20 @@ public class PCAPanel extends EmbmenuFrame implements Runnable, xCombobox.setFont(new java.awt.Font("Verdana", 0, 12)); xCombobox.addItemListener(this); resetButton.setFont(new java.awt.Font("Verdana", 0, 12)); - resetButton.setLabel("Reset"); + resetButton.setLabel(MessageManager.getString("action.reset")); resetButton.addActionListener(this); this.setMenuBar(menuBar1); - menu1.setLabel("File"); - menu2.setLabel("View"); - calcSettings.setLabel("Change Parameters"); - labels.setLabel("Labels"); + menu1.setLabel(MessageManager.getString("action.file")); + menu2.setLabel(MessageManager.getString("action.view")); + calcSettings.setLabel(MessageManager.getString("action.change_params")); + labels.setLabel(MessageManager.getString("label.labels")); labels.addItemListener(this); - values.setLabel("Output Values..."); + values.setLabel(MessageManager.getString("label.output_values")); values.addActionListener(this); - inputData.setLabel("Input Data..."); - nuclSetting.setLabel("Nucleotide matrix"); + inputData.setLabel(MessageManager.getString("label.input_data")); + nuclSetting.setLabel(MessageManager.getString("label.nucleotide_matrix")); nuclSetting.addItemListener(this); - protSetting.setLabel("Protein matrix"); + protSetting.setLabel(MessageManager.getString("label.protein_matrix")); protSetting.addItemListener(this); this.add(jPanel2, BorderLayout.SOUTH); jPanel2.add(jLabel1, null); diff --git a/src/jalview/appletgui/PairwiseAlignPanel.java b/src/jalview/appletgui/PairwiseAlignPanel.java old mode 100755 new mode 100644 index 8841864..a377892 --- a/src/jalview/appletgui/PairwiseAlignPanel.java +++ b/src/jalview/appletgui/PairwiseAlignPanel.java @@ -24,6 +24,7 @@ import java.awt.event.*; import jalview.analysis.*; import jalview.datamodel.*; +import jalview.util.MessageManager; public class PairwiseAlignPanel extends Panel implements ActionListener { @@ -160,7 +161,7 @@ public class PairwiseAlignPanel extends Panel implements ActionListener textarea.setFont(new java.awt.Font("Monospaced", 0, 12)); textarea.setText(""); viewInEditorButton.setFont(new java.awt.Font("Verdana", 0, 12)); - viewInEditorButton.setLabel("View in alignment editor"); + viewInEditorButton.setLabel(MessageManager.getString("label.view_alignment_editor")); viewInEditorButton.addActionListener(this); this.add(scrollPane, BorderLayout.CENTER); scrollPane.add(textarea); diff --git a/src/jalview/appletgui/RedundancyPanel.java b/src/jalview/appletgui/RedundancyPanel.java old mode 100755 new mode 100644 index ef00017..83febfc --- a/src/jalview/appletgui/RedundancyPanel.java +++ b/src/jalview/appletgui/RedundancyPanel.java @@ -25,6 +25,7 @@ import java.awt.event.*; import jalview.analysis.AlignSeq; import jalview.commands.*; import jalview.datamodel.*; +import jalview.util.MessageManager; public class RedundancyPanel extends SliderPanel implements Runnable, WindowListener @@ -49,7 +50,7 @@ public class RedundancyPanel extends SliderPanel implements Runnable, applyButton.setVisible(true); allGroupsCheck.setVisible(false); - label.setText("Enter the redundancy threshold"); + label.setText(MessageManager.getString("label.enter_redundancy_threshold")); valueField.setText("100"); slider.setVisibleAmount(1); @@ -91,7 +92,7 @@ public class RedundancyPanel extends SliderPanel implements Runnable, */ public void run() { - label.setText("Calculating...."); + label.setText(MessageManager.getString("label.calculating")); slider.setVisible(false); applyButton.setEnabled(false); @@ -123,7 +124,7 @@ public class RedundancyPanel extends SliderPanel implements Runnable, redundancy = AlignSeq.computeRedundancyMatrix(originalSequences, omitHidden, start, end, false); - label.setText("Enter the redundancy threshold"); + label.setText(MessageManager.getString("label.enter_redundancy_threshold")); slider.setVisible(true); applyButton.setEnabled(true); valueField.setVisible(true); diff --git a/src/jalview/appletgui/SliderPanel.java b/src/jalview/appletgui/SliderPanel.java old mode 100755 new mode 100644 index d25caa4..886c194 --- a/src/jalview/appletgui/SliderPanel.java +++ b/src/jalview/appletgui/SliderPanel.java @@ -24,6 +24,7 @@ import java.awt.event.*; import jalview.datamodel.*; import jalview.schemes.*; +import jalview.util.MessageManager; public class SliderPanel extends Panel implements ActionListener, AdjustmentListener, MouseListener @@ -167,14 +168,14 @@ public class SliderPanel extends Panel implements ActionListener, applyButton.setVisible(false); if (forConservation) { - label.setText("Modify conservation visibility"); + label.setText(MessageManager.getString("label.modify_conservation_visibility")); slider.setMinimum(0); slider.setMaximum(50 + slider.getVisibleAmount()); slider.setUnitIncrement(1); } else { - label.setText("Colour residues above % occurence"); + label.setText(MessageManager.getString("label.colour_residues_above_occurence")); slider.setMinimum(0); slider.setMaximum(100 + slider.getVisibleAmount()); slider.setBlockIncrement(1); @@ -316,20 +317,20 @@ public class SliderPanel extends Panel implements ActionListener, valueField.setText(" "); valueField.addActionListener(this); label.setFont(new java.awt.Font("Verdana", 0, 11)); - label.setText("set this label text"); + label.setText(MessageManager.getString("label.set_this_label_text")); jPanel1.setLayout(borderLayout1); jPanel2.setLayout(flowLayout1); applyButton.setFont(new java.awt.Font("Verdana", 0, 11)); - applyButton.setLabel("Apply"); + applyButton.setLabel(MessageManager.getString("action.apply")); applyButton.addActionListener(this); undoButton.setEnabled(false); undoButton.setFont(new java.awt.Font("Verdana", 0, 11)); - undoButton.setLabel("Undo"); + undoButton.setLabel(MessageManager.getString("action.undo")); undoButton.addActionListener(this); allGroupsCheck.setEnabled(false); allGroupsCheck.setFont(new java.awt.Font("Verdana", 0, 11)); - allGroupsCheck.setLabel("Apply threshold to all groups"); - allGroupsCheck.setName("Apply to all Groups"); + allGroupsCheck.setLabel(MessageManager.getString("action.apply_threshold_all_groups")); + allGroupsCheck.setName(MessageManager.getString("action.apply_all_groups")); this.setBackground(Color.white); this.setForeground(Color.black); jPanel2.add(label, null); diff --git a/src/jalview/appletgui/TreePanel.java b/src/jalview/appletgui/TreePanel.java index 65f3d91..5f3f6f6 100644 --- a/src/jalview/appletgui/TreePanel.java +++ b/src/jalview/appletgui/TreePanel.java @@ -23,6 +23,7 @@ import java.awt.event.*; import jalview.analysis.*; import jalview.datamodel.*; import jalview.io.*; +import jalview.util.MessageManager; public class TreePanel extends EmbmenuFrame implements ActionListener, ItemListener @@ -351,22 +352,22 @@ public class TreePanel extends EmbmenuFrame implements ActionListener, setLayout(borderLayout1); this.setBackground(Color.white); this.setFont(new java.awt.Font("Verdana", 0, 12)); - jMenu2.setLabel("View"); - fontSize.setLabel("Font..."); + jMenu2.setLabel(MessageManager.getString("action.view")); + fontSize.setLabel(MessageManager.getString("action.font")); fontSize.addActionListener(this); - bootstrapMenu.setLabel("Show Bootstrap Values"); + bootstrapMenu.setLabel(MessageManager.getString("label.show_bootstrap_values")); bootstrapMenu.addItemListener(this); - distanceMenu.setLabel("Show Distances"); + distanceMenu.setLabel(MessageManager.getString("label.show_distances")); distanceMenu.addItemListener(this); - placeholdersMenu.setLabel("Mark Unassociated Leaves"); + placeholdersMenu.setLabel(MessageManager.getString("label.mark_unassociated_leaves")); placeholdersMenu.addItemListener(this); fitToWindow.setState(true); - fitToWindow.setLabel("Fit To Window"); + fitToWindow.setLabel(MessageManager.getString("label.fit_to_window")); fitToWindow.addItemListener(this); - fileMenu.setLabel("File"); - newickOutput.setLabel("Newick Format"); + fileMenu.setLabel(MessageManager.getString("action.file")); + newickOutput.setLabel(MessageManager.getString("label.newick_format")); newickOutput.addActionListener(this); - inputData.setLabel("Input Data..."); + inputData.setLabel(MessageManager.getString("label.input_data")); add(scrollPane, BorderLayout.CENTER); jMenuBar1.add(fileMenu); diff --git a/src/jalview/appletgui/UserDefinedColours.java b/src/jalview/appletgui/UserDefinedColours.java old mode 100755 new mode 100644 index 4735006..a81e831 --- a/src/jalview/appletgui/UserDefinedColours.java +++ b/src/jalview/appletgui/UserDefinedColours.java @@ -22,6 +22,7 @@ import jalview.schemes.ColourSchemeI; import jalview.schemes.GraduatedColor; import jalview.schemes.ResidueProperties; import jalview.schemes.UserColourScheme; +import jalview.util.MessageManager; import java.awt.Button; import java.awt.Color; @@ -630,13 +631,13 @@ public class UserDefinedColours extends Panel implements ActionListener, gridLayout.setColumns(6); gridLayout.setRows(4); okButton.setFont(new java.awt.Font("Verdana", 0, 11)); - okButton.setLabel("OK"); + okButton.setLabel(MessageManager.getString("action.ok")); okButton.addActionListener(this); applyButton.setFont(new java.awt.Font("Verdana", 0, 11)); - applyButton.setLabel("Apply"); + applyButton.setLabel(MessageManager.getString("action.apply")); applyButton.addActionListener(this); cancelButton.setFont(new java.awt.Font("Verdana", 0, 11)); - cancelButton.setLabel("Cancel"); + cancelButton.setLabel(MessageManager.getString("action.cancel")); cancelButton.addActionListener(this); this.setBackground(new Color(212, 208, 223)); okcancelPanel.setBounds(new Rectangle(0, 265, 400, 35)); diff --git a/src/jalview/bin/JalviewLite.java b/src/jalview/bin/JalviewLite.java index 8fe90f5..b1f16ac 100644 --- a/src/jalview/bin/JalviewLite.java +++ b/src/jalview/bin/JalviewLite.java @@ -40,6 +40,7 @@ import jalview.javascript.JalviewLiteJsApi; import jalview.javascript.JsCallBack; import jalview.structure.SelectionListener; import jalview.structure.StructureSelectionManager; +import jalview.util.MessageManager; import java.applet.Applet; import java.awt.Button; @@ -1825,11 +1826,10 @@ public class JalviewLite extends Applet implements if (protocol == jalview.io.AppletFormatAdapter.PASTE) { - newAlignFrame.setTitle("Sequences from " - + applet.getDocumentBase()); + newAlignFrame.setTitle(MessageManager.formatMessage("label.sequences_from", new String[]{applet.getDocumentBase().toString()})); } - newAlignFrame.statusBar.setText("Successfully loaded file " + file); + newAlignFrame.statusBar.setText(MessageManager.formatMessage("label.successfully_loaded_file", new String []{file})); String treeFile = applet.getParameter("tree"); if (treeFile == null) diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java old mode 100755 new mode 100644 index ceb08ee..0a4f4b8 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -75,6 +75,7 @@ import jalview.schemes.TaylorColourScheme; import jalview.schemes.TurnColourScheme; import jalview.schemes.UserColourScheme; import jalview.schemes.ZappoColourScheme; +import jalview.util.MessageManager; import jalview.ws.jws1.Discoverer; import jalview.ws.jws2.Jws2Discoverer; import jalview.ws.seqfetcher.DbSourceProxy; @@ -475,8 +476,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, case KeyEvent.VK_F2: viewport.cursorMode = !viewport.cursorMode; - statusBar.setText("Keyboard editing mode is " - + (viewport.cursorMode ? "on" : "off")); + statusBar.setText(MessageManager.formatMessage("label.keyboard_editing_mode", new String[]{(viewport.cursorMode ? "on" : "off")})); if (viewport.cursorMode) { alignPanel.seqPanel.seqCanvas.cursorX = viewport.startRes; @@ -808,7 +808,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, final JPanel progressPanel = (JPanel) progressBars.get(new Long(id)); if (handler.canCancel()) { - JButton cancel = new JButton("Cancel"); + JButton cancel = new JButton(MessageManager.getString("action.cancel")); final IProgressIndicator us = this; cancel.addActionListener(new ActionListener() { @@ -1025,8 +1025,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, success = new Jalview2XML().SaveAlignment(this, file, shortName); - statusBar.setText("Successfully saved to file: " + fileName + " in " - + format + " format."); + statusBar.setText(MessageManager.formatMessage("label.successfully_saved_to_file_in_format",new String[]{fileName, format})); + } else @@ -1079,8 +1079,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, out.print(output); out.close(); this.setTitle(file); - statusBar.setText("Successfully saved to file: " + fileName - + " in " + format + " format."); + statusBar.setText(MessageManager.formatMessage("label.successfully_saved_to_file_in_format",new String[]{fileName, format})); } catch (Exception ex) { success = false; @@ -1347,12 +1346,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { undoMenuItem.setEnabled(true); CommandI command = (CommandI) viewport.historyList.peek(); - undoMenuItem.setText("Undo " + command.getDescription()); + undoMenuItem.setText(MessageManager.formatMessage("label.undo_command", new String[]{command.getDescription()})); } else { undoMenuItem.setEnabled(false); - undoMenuItem.setText("Undo"); + undoMenuItem.setText(MessageManager.getString("action.undo")); } if (viewport.redoList.size() > 0) @@ -1360,12 +1359,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, redoMenuItem.setEnabled(true); CommandI command = (CommandI) viewport.redoList.peek(); - redoMenuItem.setText("Redo " + command.getDescription()); + redoMenuItem.setText(MessageManager.formatMessage("label.redo_command", new String[]{command.getDescription()})); } else { redoMenuItem.setEnabled(false); - redoMenuItem.setText("Redo"); + redoMenuItem.setText(MessageManager.getString("action.redo")); } } @@ -1693,7 +1692,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, Desktop.jalviewClipboard = new Object[] { seqs, viewport.getAlignment().getDataset(), hiddenColumns }; - statusBar.setText("Copied " + seqs.length + " sequences to clipboard."); + statusBar.setText(MessageManager.formatMessage("label.copied_sequences_to_clipboard", new String[]{Integer.valueOf(seqs.length).toString()})); } /** @@ -2294,7 +2293,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, viewport.getSelectionGroup()); } - statusBar.setText("Removed " + trimRegion.getSize() + " columns."); + statusBar.setText(MessageManager.formatMessage("label.removed_columns", new String[]{Integer.valueOf(trimRegion.getSize()).toString()})); addHistoryItem(trimRegion); @@ -2342,8 +2341,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, addHistoryItem(removeGapCols); - statusBar.setText("Removed " + removeGapCols.getSize() - + " empty columns."); + statusBar.setText(MessageManager.formatMessage("label.removed_empty_columns", new String[]{Integer.valueOf(removeGapCols.getSize()).toString()})); // This is to maintain viewport position on first residue // of first sequence @@ -2951,7 +2949,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, editPane.setEditable(false); StringBuffer contents = new AlignmentProperties(viewport.getAlignment()) .formatAsHtml(); - editPane.setText("" + contents.toString() + ""); + editPane.setText(MessageManager.formatMessage("label.html_content", new String[]{contents.toString()})); JInternalFrame frame = new JInternalFrame(); frame.getContentPane().add(new JScrollPane(editPane)); @@ -4914,8 +4912,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, tcoffeeColour.setSelected(true); changeColour(new TCoffeeColourScheme(viewport.getAlignment())); isAnnotation = true; - statusBar - .setText("Successfully pasted T-Coffee scores to alignment."); + statusBar.setText(MessageManager.getString("label.successfully_pasted_tcoffee_scores_to_alignment")); } else { @@ -4924,9 +4921,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, JOptionPane .showMessageDialog( Desktop.desktop, - tcf.getWarningMessage() == null ? "Check that the file matches sequence IDs in the alignment." + tcf.getWarningMessage() == null ? MessageManager.getString("label.check_file_matches_sequence_ids_alignment") : tcf.getWarningMessage(), - "Problem reading T-COFFEE score file", + MessageManager.getString("label.problem_reading_tcoffee_score_file"), JOptionPane.WARNING_MESSAGE); } } @@ -5323,7 +5320,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, ++i; if (++icomp >= mcomp || i == (otherdb.size())) { - ifetch.setText(imname + " to '" + sname + "'"); + ifetch.setText(MessageManager.formatMessage("label.source_to_target",new String[]{imname,sname})); dfetch.add(ifetch); ifetch = new JMenu(); imname = null; @@ -5335,7 +5332,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, ++dbi; if (comp >= mcomp || dbi >= (dbclasses.length)) { - dfetch.setText(mname + " to '" + dbclass + "'"); + dfetch.setText(MessageManager.formatMessage("label.source_to_target",new String[]{mname,dbclass})); rfetch.add(dfetch); dfetch = new JMenu(); mname = null; diff --git a/src/jalview/gui/AnnotationColourChooser.java b/src/jalview/gui/AnnotationColourChooser.java old mode 100755 new mode 100644 index f2036de..61ef75f --- a/src/jalview/gui/AnnotationColourChooser.java +++ b/src/jalview/gui/AnnotationColourChooser.java @@ -30,6 +30,8 @@ import net.miginfocom.swing.MigLayout; import jalview.bin.Cache; import jalview.datamodel.*; import jalview.schemes.*; +import jalview.util.MessageManager; + import java.awt.Dimension; public class AnnotationColourChooser extends JPanel @@ -265,7 +267,7 @@ public class AnnotationColourChooser extends JPanel } }); ok.setOpaque(false); - ok.setText("OK"); + ok.setText(MessageManager.getString("action.ok")); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -274,7 +276,7 @@ public class AnnotationColourChooser extends JPanel } }); cancel.setOpaque(false); - cancel.setText("Cancel"); + cancel.setText(MessageManager.getString("action.cancel")); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -283,7 +285,7 @@ public class AnnotationColourChooser extends JPanel } }); defColours.setOpaque(false); - defColours.setText("Defaults"); + defColours.setText(MessageManager.getString("action.set_defaults")); defColours .setToolTipText("Reset min and max colours to defaults from user preferences."); defColours.addActionListener(new ActionListener() @@ -327,7 +329,7 @@ public class AnnotationColourChooser extends JPanel thresholdValue.setColumns(7); currentColours.setFont(JvSwingUtils.getLabelFont()); currentColours.setOpaque(false); - currentColours.setText("Use Original Colours"); + currentColours.setText(MessageManager.getString("label.use_original_colours")); currentColours.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -337,7 +339,7 @@ public class AnnotationColourChooser extends JPanel }); thresholdIsMin.setBackground(Color.white); thresholdIsMin.setFont(JvSwingUtils.getLabelFont()); - thresholdIsMin.setText("Threshold is Min/Max"); + thresholdIsMin.setText(MessageManager.getString("label.threshold_minmax")); thresholdIsMin.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) @@ -347,7 +349,7 @@ public class AnnotationColourChooser extends JPanel }); seqAssociated.setBackground(Color.white); seqAssociated.setFont(JvSwingUtils.getLabelFont()); - seqAssociated.setText("Per-sequence only"); + seqAssociated.setText(MessageManager.getString("label.per_sequence_only")); seqAssociated.addActionListener(new ActionListener() { diff --git a/src/jalview/gui/AnnotationExporter.java b/src/jalview/gui/AnnotationExporter.java old mode 100755 new mode 100644 index e255cd6..02758fa --- a/src/jalview/gui/AnnotationExporter.java +++ b/src/jalview/gui/AnnotationExporter.java @@ -26,6 +26,7 @@ import javax.swing.*; import jalview.datamodel.*; import jalview.io.*; +import jalview.util.MessageManager; /** * @@ -229,7 +230,7 @@ public class AnnotationExporter extends JPanel { this.setLayout(new BorderLayout()); - toFile.setText("to File"); + toFile.setText(MessageManager.getString("label.to_file")); toFile.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -237,7 +238,7 @@ public class AnnotationExporter extends JPanel toFile_actionPerformed(e); } }); - toTextbox.setText("to Textbox"); + toTextbox.setText(MessageManager.getString("label.to_textbox")); toTextbox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -245,7 +246,7 @@ public class AnnotationExporter extends JPanel toTextbox_actionPerformed(e); } }); - close.setText("Close"); + close.setText(MessageManager.getString("action.close")); close.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -259,9 +260,9 @@ public class AnnotationExporter extends JPanel GFFFormat.setOpaque(false); GFFFormat.setText("GFF"); CSVFormat.setOpaque(false); - CSVFormat.setText("CSV(Spreadsheet)"); + CSVFormat.setText(MessageManager.getString("label.csv_spreadsheet")); jLabel1.setHorizontalAlignment(SwingConstants.TRAILING); - jLabel1.setText("Format: "); + jLabel1.setText(MessageManager.getString("action.format") + " "); this.setBackground(Color.white); jPanel3.setBorder(BorderFactory.createEtchedBorder()); jPanel3.setOpaque(false); diff --git a/src/jalview/gui/AppVarnaBinding.java b/src/jalview/gui/AppVarnaBinding.java index 81452af..d19a711 100644 --- a/src/jalview/gui/AppVarnaBinding.java +++ b/src/jalview/gui/AppVarnaBinding.java @@ -17,6 +17,8 @@ */ package jalview.gui; +import jalview.util.MessageManager; + import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; @@ -104,17 +106,17 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding private JTextField _seq = new JTextField(); - private JLabel _strLabel = new JLabel(" Str:"); + private JLabel _strLabel = new JLabel(MessageManager.getString("label.str")); - private JLabel _seqLabel = new JLabel(" Seq:"); + private JLabel _seqLabel = new JLabel(MessageManager.getString("label.seq")); - private JButton _createButton = new JButton("Create"); + private JButton _createButton = new JButton(MessageManager.getString("action.create")); - private JButton _updateButton = new JButton("Update"); + private JButton _updateButton = new JButton(MessageManager.getString("action.update")); - private JButton _deleteButton = new JButton("Delete"); + private JButton _deleteButton = new JButton(MessageManager.getString("action.delete")); - private JButton _duplicateButton = new JButton("Snapshot"); + private JButton _duplicateButton = new JButton(MessageManager.getString("action.snapshot")); protected JPanel _listPanel = new JPanel(); @@ -339,7 +341,7 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding ops.add(_deleteButton); ops.add(_duplicateButton); - JLabel j = new JLabel("Structures Manager", JLabel.CENTER); + JLabel j = new JLabel(MessageManager.getString("label.structures_manager"), JLabel.CENTER); _listPanel.setLayout(new BorderLayout()); // _listPanel.add(ops, BorderLayout.SOUTH); diff --git a/src/jalview/gui/BlogReader.java b/src/jalview/gui/BlogReader.java index 7b6567d..25b5ea3 100644 --- a/src/jalview/gui/BlogReader.java +++ b/src/jalview/gui/BlogReader.java @@ -18,6 +18,8 @@ package jalview.gui; import jalview.bin.Cache; +import jalview.util.MessageManager; + import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; @@ -435,7 +437,7 @@ public class BlogReader extends JPanel topBottomSplitPane.setBottomComponent(bottomPanel); JScrollPane spTextDescription = new JScrollPane(textDescription); textDescription.setText(""); - statusBar.setText(" [Status] "); + statusBar.setText(MessageManager.getString("label.status")); buttonRefresh.addActionListener(new ActionListener() { @@ -477,7 +479,7 @@ public class BlogReader extends JPanel _popupChannels); listItems.addMouseListener(popupAdapter); listItems.setCellRenderer(new ItemsRenderer()); - lblChannels.setText("Channels"); + lblChannels.setText(MessageManager.getString("label.channels")); } private void postInit() @@ -811,8 +813,7 @@ class ChannelsRenderer extends DefaultListCellRenderer if (value instanceof Channel) { Channel channel = (Channel) value; - component.setText(channel.getTitle() + " (" - + channel.getUnreadItemCount() + ")"); + component.setText(MessageManager.formatMessage("label.channel_title_item_count", new String[]{channel.getTitle(),Integer.valueOf(channel.getUnreadItemCount()).toString()})); component.setToolTipText(channel.getURL()); } return component; @@ -835,9 +836,7 @@ class ItemsRenderer extends DefaultListCellRenderer Item item = (Item) value; if (item.getPublishDate() != null) { - component.setText(DateFormat.getDateInstance().format( - item.getPublishDate()) - + " " + item.getTitle()); + component.setText(MessageManager.formatMessage("label.blog_item_published_on_date", new String[]{DateFormat.getDateInstance().format(item.getPublishDate()).toString(),item.getTitle()})); } component.setToolTipText(item.getLink()); if (!item.isRead()) diff --git a/src/jalview/gui/Console.java b/src/jalview/gui/Console.java index 19526aa..965d010 100644 --- a/src/jalview/gui/Console.java +++ b/src/jalview/gui/Console.java @@ -17,6 +17,8 @@ */ package jalview.gui; +import jalview.util.MessageManager; + import java.io.*; import java.awt.*; import java.awt.event.*; @@ -91,7 +93,7 @@ public class Console extends WindowAdapter implements WindowListener, // textArea = cpt.getTextArea(); textArea = new JTextArea(); textArea.setEditable(false); - JButton button = new JButton("clear"); + JButton button = new JButton(MessageManager.getString("action.clear")); // frame = cpt; frame.getContentPane().setLayout(new BorderLayout()); diff --git a/src/jalview/gui/CutAndPasteHtmlTransfer.java b/src/jalview/gui/CutAndPasteHtmlTransfer.java index ccb6c59..02b375f 100644 --- a/src/jalview/gui/CutAndPasteHtmlTransfer.java +++ b/src/jalview/gui/CutAndPasteHtmlTransfer.java @@ -29,6 +29,7 @@ import javax.swing.event.HyperlinkEvent.EventType; import jalview.io.*; import jalview.jbgui.*; +import jalview.util.MessageManager; /** * Cut'n'paste files into the desktop See JAL-1105 @@ -103,7 +104,7 @@ public class CutAndPasteHtmlTransfer extends GCutAndPasteHtmlTransfer this.viewport = viewport; if (viewport != null) { - ok.setText("Add"); + ok.setText(MessageManager.getString("action.add")); } getContentPane().add(inputButtonPanel, java.awt.BorderLayout.SOUTH); diff --git a/src/jalview/gui/CutAndPasteTransfer.java b/src/jalview/gui/CutAndPasteTransfer.java old mode 100755 new mode 100644 index cb71128..b5d45f7 --- a/src/jalview/gui/CutAndPasteTransfer.java +++ b/src/jalview/gui/CutAndPasteTransfer.java @@ -25,6 +25,7 @@ import javax.swing.*; import jalview.datamodel.*; import jalview.io.*; import jalview.jbgui.*; +import jalview.util.MessageManager; /** * Cut'n'paste files into the desktop See JAL-1105 @@ -57,7 +58,7 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer this.viewport = viewport; if (viewport != null) { - ok.setText("Add"); + ok.setText(MessageManager.getString("action.add")); } getContentPane().add(inputButtonPanel, java.awt.BorderLayout.SOUTH); @@ -200,7 +201,7 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer af.currentFileFormat = format; Desktop.addInternalFrame(af, "Cut & Paste input - " + format, AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); - af.statusBar.setText("Successfully pasted alignment file"); + af.statusBar.setText(MessageManager.getString("label.successfully_pasted_alignment_file")); try { diff --git a/src/jalview/gui/DasSourceBrowser.java b/src/jalview/gui/DasSourceBrowser.java old mode 100755 new mode 100644 index 3efde6a..5f071d0 --- a/src/jalview/gui/DasSourceBrowser.java +++ b/src/jalview/gui/DasSourceBrowser.java @@ -18,6 +18,7 @@ package jalview.gui; import jalview.jbgui.GDasSourceBrowser; +import jalview.util.MessageManager; import jalview.util.TableSorter; import jalview.ws.dbsources.das.api.DasSourceRegistryI; import jalview.ws.dbsources.das.api.jalviewSourceI; @@ -170,8 +171,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements if (nickName == null) { - fullDetails.setText(text + "Select a DAS service from the table" - + " to read a full description here."); + fullDetails.setText(text + MessageManager.getString("label.select_das_service_from_table")); return; } @@ -430,15 +430,15 @@ public class DasSourceBrowser extends GDasSourceBrowser implements JTextField nametf = new JTextField(nickname, 40); JTextField urltf = new JTextField(url, 40); - JCheckBox seqs = new JCheckBox("Sequence Source"); + JCheckBox seqs = new JCheckBox(MessageManager.getString("label.sequence_source")); seqs.setSelected(seqsrc); JPanel panel = new JPanel(new BorderLayout()); JPanel pane12 = new JPanel(new BorderLayout()); - pane12.add(new JLabel("Nickname: "), BorderLayout.CENTER); + pane12.add(new JLabel(MessageManager.getString("label.structure_manager")), BorderLayout.CENTER); pane12.add(nametf, BorderLayout.EAST); panel.add(pane12, BorderLayout.NORTH); pane12 = new JPanel(new BorderLayout()); - pane12.add(new JLabel("URL: "), BorderLayout.NORTH); + pane12.add(new JLabel(MessageManager.getString("label.url")), BorderLayout.NORTH); pane12.add(seqs, BorderLayout.SOUTH); pane12.add(urltf, BorderLayout.EAST); panel.add(pane12, BorderLayout.SOUTH); diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index 877aebb..6dede64 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -23,6 +23,7 @@ import jalview.io.FormatAdapter; import jalview.io.IdentifyFile; import jalview.io.JalviewFileChooser; import jalview.io.JalviewFileView; +import jalview.util.MessageManager; import jalview.ws.params.ParamManager; import java.awt.BorderLayout; @@ -943,7 +944,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements { // This construct allows us to have a wider textfield // for viewing - JLabel label = new JLabel("Enter URL of Input File"); + JLabel label = new JLabel(MessageManager.getString("label.input_file_url")); final JComboBox history = new JComboBox(); JPanel panel = new JPanel(new GridLayout(2, 1)); @@ -1865,7 +1866,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements protected void setupVamsasConnectedGui() { - vamsasStart.setText("Session Update"); + vamsasStart.setText(MessageManager.getString("label.session_update")); vamsasSave.setVisible(true); vamsasStop.setVisible(true); vamsasImport.setVisible(false); // Document import to existing session is @@ -1877,7 +1878,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements vamsasSave.setVisible(false); vamsasStop.setVisible(false); vamsasImport.setVisible(true); - vamsasStart.setText("New Vamsas Session"); + vamsasStart.setText(MessageManager.getString("label.new_vamsas_session")); } public void vamsasStop_actionPerformed(ActionEvent e) @@ -2161,7 +2162,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements if (jalview.bin.Cache.groovyJarsPresent()) { groovyShell = new JMenuItem(); - groovyShell.setText("Groovy Console..."); + groovyShell.setText(MessageManager.getString("label.groovy_console")); groovyShell.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -2341,7 +2342,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements final JPanel progressPanel = (JPanel) progressBars.get(new Long(id)); if (handler.canCancel()) { - JButton cancel = new JButton("Cancel"); + JButton cancel = new JButton(MessageManager.getString("action.cancel")); final IProgressIndicator us = this; cancel.addActionListener(new ActionListener() { diff --git a/src/jalview/gui/EPSOptions.java b/src/jalview/gui/EPSOptions.java old mode 100755 new mode 100644 index 127e5cf..89e34f7 --- a/src/jalview/gui/EPSOptions.java +++ b/src/jalview/gui/EPSOptions.java @@ -17,6 +17,8 @@ */ package jalview.gui; +import jalview.util.MessageManager; + import java.awt.*; import java.awt.event.*; import javax.swing.*; @@ -55,13 +57,13 @@ public class EPSOptions extends JPanel private void jbInit() throws Exception { lineart.setFont(JvSwingUtils.getLabelFont()); - lineart.setText("Lineart"); + lineart.setText(MessageManager.getString("label.lineart")); text.setFont(JvSwingUtils.getLabelFont()); - text.setText("Text"); + text.setText(MessageManager.getString("action.text")); text.setSelected(true); askAgain.setFont(JvSwingUtils.getLabelFont()); - askAgain.setText("Don\'t ask me again"); - ok.setText("OK"); + askAgain.setText(MessageManager.getString("label.dont_ask_me_again")); + ok.setText(MessageManager.getString("action.ok")); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -69,7 +71,7 @@ public class EPSOptions extends JPanel ok_actionPerformed(e); } }); - cancel.setText("Cancel"); + cancel.setText(MessageManager.getString("action.cancel")); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -78,7 +80,7 @@ public class EPSOptions extends JPanel } }); jLabel1.setFont(JvSwingUtils.getLabelFont()); - jLabel1.setText("Select EPS character rendering style"); + jLabel1.setText(MessageManager.getString("label.select_eps_character_rendering_style")); this.setLayout(borderLayout1); jPanel3.setBorder(BorderFactory.createEtchedBorder()); jPanel2.add(text); diff --git a/src/jalview/gui/EditNameDialog.java b/src/jalview/gui/EditNameDialog.java index 18076e6..f3aefe4 100644 --- a/src/jalview/gui/EditNameDialog.java +++ b/src/jalview/gui/EditNameDialog.java @@ -17,6 +17,8 @@ */ package jalview.gui; +import jalview.util.MessageManager; + import java.awt.*; import javax.swing.*; @@ -24,9 +26,9 @@ public class EditNameDialog { JTextField id, description; - JButton ok = new JButton("Accept"); + JButton ok = new JButton(MessageManager.getString("action.accept")); - JButton cancel = new JButton("Cancel"); + JButton cancel = new JButton(MessageManager.getString("action.cancel")); boolean accept = false; diff --git a/src/jalview/gui/FeatureColourChooser.java b/src/jalview/gui/FeatureColourChooser.java index 1fb53e4..0fc55e1 100644 --- a/src/jalview/gui/FeatureColourChooser.java +++ b/src/jalview/gui/FeatureColourChooser.java @@ -27,6 +27,8 @@ import javax.swing.event.*; import jalview.datamodel.*; import jalview.schemes.*; +import jalview.util.MessageManager; + import java.awt.Dimension; public class FeatureColourChooser extends JalviewDialog @@ -207,9 +209,9 @@ public class FeatureColourChooser extends JalviewDialog } }); maxColour.setBorder(new LineBorder(Color.black)); - minText.setText("Min:"); + minText.setText(MessageManager.getString("label.min")); minText.setFont(JvSwingUtils.getLabelFont()); - maxText.setText("Max:"); + maxText.setText(MessageManager.getString("label.max")); maxText.setFont(JvSwingUtils.getLabelFont()); this.setLayout(borderLayout1); jPanel2.setLayout(flowLayout1); @@ -245,7 +247,7 @@ public class FeatureColourChooser extends JalviewDialog thresholdValue.setColumns(7); jPanel3.setBackground(Color.white); thresholdIsMin.setBackground(Color.white); - thresholdIsMin.setText("Threshold is Min/Max"); + thresholdIsMin.setText(MessageManager.getString("label.threshold_minmax")); thresholdIsMin .setToolTipText("Toggle between absolute and relative display threshold."); thresholdIsMin.addActionListener(new ActionListener() @@ -256,7 +258,7 @@ public class FeatureColourChooser extends JalviewDialog } }); colourByLabel.setBackground(Color.white); - colourByLabel.setText("Colour by Label"); + colourByLabel.setText(MessageManager.getString("label.colour_by_label")); colourByLabel .setToolTipText("Display features of the same type with a different label using a different colour. (e.g. domain features)"); colourByLabel.addActionListener(new ActionListener() diff --git a/src/jalview/gui/FeatureRenderer.java b/src/jalview/gui/FeatureRenderer.java old mode 100755 new mode 100644 index cc2c048..587c12f --- a/src/jalview/gui/FeatureRenderer.java +++ b/src/jalview/gui/FeatureRenderer.java @@ -30,6 +30,7 @@ import javax.swing.*; import jalview.datamodel.*; import jalview.schemes.GraduatedColor; +import jalview.util.MessageManager; /** * DOCUMENT ME! @@ -1061,7 +1062,7 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer { panel = new JPanel(new GridLayout(4, 1)); tmp = new JPanel(); - tmp.add(new JLabel("Select Feature: ")); + tmp.add(new JLabel(MessageManager.getString("label.select_feature"))); overlaps = new JComboBox(); for (int i = 0; i < features.length; i++) { @@ -1111,17 +1112,17 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer tmp = new JPanel(); panel.add(tmp); - tmp.add(new JLabel("Name: ", JLabel.RIGHT)); + tmp.add(new JLabel(MessageManager.getString("label.name"), JLabel.RIGHT)); tmp.add(name); tmp = new JPanel(); panel.add(tmp); - tmp.add(new JLabel("Group: ", JLabel.RIGHT)); + tmp.add(new JLabel(MessageManager.getString("label.group"), JLabel.RIGHT)); tmp.add(source); tmp = new JPanel(); panel.add(tmp); - tmp.add(new JLabel("Colour: ", JLabel.RIGHT)); + tmp.add(new JLabel(MessageManager.getString("label.colour"), JLabel.RIGHT)); tmp.add(colour); colour.setPreferredSize(new Dimension(150, 15)); colour.setFont(new java.awt.Font("Verdana", Font.PLAIN, 9)); @@ -1133,7 +1134,7 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer bigPanel.add(panel, BorderLayout.NORTH); panel = new JPanel(); - panel.add(new JLabel("Description: ", JLabel.RIGHT)); + panel.add(new JLabel(MessageManager.getString("label.description"), JLabel.RIGHT)); description.setFont(JvSwingUtils.getTextAreaFont()); description.setLineWrap(true); panel.add(new JScrollPane(description)); @@ -1143,9 +1144,9 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer bigPanel.add(panel, BorderLayout.SOUTH); panel = new JPanel(); - panel.add(new JLabel(" Start:", JLabel.RIGHT)); + panel.add(new JLabel(MessageManager.getString("label.start"), JLabel.RIGHT)); panel.add(start); - panel.add(new JLabel(" End:", JLabel.RIGHT)); + panel.add(new JLabel(MessageManager.getString("label.end"), JLabel.RIGHT)); panel.add(end); bigPanel.add(panel, BorderLayout.CENTER); } diff --git a/src/jalview/gui/FeatureSettings.java b/src/jalview/gui/FeatureSettings.java old mode 100755 new mode 100644 index 3ce17e2..04a70ef --- a/src/jalview/gui/FeatureSettings.java +++ b/src/jalview/gui/FeatureSettings.java @@ -37,6 +37,7 @@ import jalview.datamodel.*; import jalview.io.*; import jalview.schemes.AnnotationColourGradient; import jalview.schemes.GraduatedColor; +import jalview.util.MessageManager; import jalview.ws.dbsources.das.api.jalviewSourceI; public class FeatureSettings extends JPanel @@ -905,7 +906,7 @@ public class FeatureSettings extends JPanel dasSettingsPane.setLayout(borderLayout3); bigPanel.setLayout(borderLayout4); invert.setFont(JvSwingUtils.getLabelFont()); - invert.setText("Invert Selection"); + invert.setText(MessageManager.getString("label.invert_selection")); invert.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -914,7 +915,7 @@ public class FeatureSettings extends JPanel } }); optimizeOrder.setFont(JvSwingUtils.getLabelFont()); - optimizeOrder.setText("Optimise Order"); + optimizeOrder.setText(MessageManager.getString("label.optimise_order")); optimizeOrder.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -923,7 +924,7 @@ public class FeatureSettings extends JPanel } }); sortByScore.setFont(JvSwingUtils.getLabelFont()); - sortByScore.setText("Seq sort by Score"); + sortByScore.setText(MessageManager.getString("label.seq_sort_by_score")); sortByScore.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -941,7 +942,7 @@ public class FeatureSettings extends JPanel } }); cancel.setFont(JvSwingUtils.getLabelFont()); - cancel.setText("Cancel"); + cancel.setText(MessageManager.getString("action.cancel")); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -951,7 +952,7 @@ public class FeatureSettings extends JPanel } }); ok.setFont(JvSwingUtils.getLabelFont()); - ok.setText("OK"); + ok.setText(MessageManager.getString("action.ok")); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -960,7 +961,7 @@ public class FeatureSettings extends JPanel } }); loadColours.setFont(JvSwingUtils.getLabelFont()); - loadColours.setText("Load Colours"); + loadColours.setText(MessageManager.getString("label.load_colours")); loadColours.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -969,7 +970,7 @@ public class FeatureSettings extends JPanel } }); saveColours.setFont(JvSwingUtils.getLabelFont()); - saveColours.setText("Save Colours"); + saveColours.setText(MessageManager.getString("label.save_colours")); saveColours.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -987,7 +988,7 @@ public class FeatureSettings extends JPanel }); transparency.setMaximum(70); - fetchDAS.setText("Fetch DAS Features"); + fetchDAS.setText(MessageManager.getString("label.fetch_das_features")); fetchDAS.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -995,7 +996,7 @@ public class FeatureSettings extends JPanel fetchDAS_actionPerformed(e); } }); - saveDAS.setText("Save as default"); + saveDAS.setText(MessageManager.getString("action.save_as_default")); saveDAS.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -1006,7 +1007,7 @@ public class FeatureSettings extends JPanel dasButtonPanel.setBorder(BorderFactory.createEtchedBorder()); dasSettingsPane.setBorder(null); cancelDAS.setEnabled(false); - cancelDAS.setText("Cancel Fetch"); + cancelDAS.setText(MessageManager.getString("action.cancel_fetch")); cancelDAS.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) diff --git a/src/jalview/gui/JDatabaseTree.java b/src/jalview/gui/JDatabaseTree.java index d954b76..e747055 100644 --- a/src/jalview/gui/JDatabaseTree.java +++ b/src/jalview/gui/JDatabaseTree.java @@ -18,6 +18,7 @@ package jalview.gui; import jalview.bin.Cache; +import jalview.util.MessageManager; import jalview.ws.seqfetcher.DbSourceProxy; import java.awt.BorderLayout; @@ -58,7 +59,7 @@ public class JDatabaseTree extends JalviewDialog implements KeyListener JButton getDatabaseSelectorButton() { - final JButton viewdbs = new JButton("--- Select Database ---"); + final JButton viewdbs = new JButton(MessageManager.getString("action.select_ddbb")); viewdbs.addActionListener(new ActionListener() { @@ -405,23 +406,17 @@ public class JDatabaseTree extends JalviewDialog implements KeyListener if (allowMultiSelections) { - dbstatus.setText("Selected " - + srcs.size() - + " database" - + (srcs.size() == 1 ? "" : "s") - + " to fetch from" - + (srcs.size() > 0 ? " with " + x + " test quer" - + (x == 1 ? "y" : "ies") : ".")); + dbstatus.setText(MessageManager.formatMessage("label.selected_database_to_fetch_from", new String[]{Integer.valueOf(srcs.size()).toString(),(srcs.size() == 1 ? "" : "s"),(srcs.size() > 0 ? " with " + x + " test quer" + (x == 1 ? "y" : "ies") : ".")})); dbstatex.setText(" "); } else { if (nm.length() > 0) { - dbstatus.setText("Database: " + nm); + dbstatus.setText(MessageManager.formatMessage("label.database_param",new String[]{nm})); if (qr.length() > 0) { - dbstatex.setText("Example: " + qr); + dbstatex.setText(MessageManager.formatMessage("label.example_param", new String[]{qr})); } else { diff --git a/src/jalview/gui/JalviewDialog.java b/src/jalview/gui/JalviewDialog.java index a74c435..7356f3a 100644 --- a/src/jalview/gui/JalviewDialog.java +++ b/src/jalview/gui/JalviewDialog.java @@ -17,6 +17,8 @@ */ package jalview.gui; +import jalview.util.MessageManager; + import java.awt.Container; import java.awt.Rectangle; import java.awt.event.ActionEvent; @@ -87,7 +89,7 @@ public abstract class JalviewDialog extends JPanel this.block = block; ok.setOpaque(false); - ok.setText("OK"); + ok.setText(MessageManager.getString("action.ok")); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -97,7 +99,7 @@ public abstract class JalviewDialog extends JPanel } }); cancel.setOpaque(false); - cancel.setText("Cancel"); + cancel.setText(MessageManager.getString("action.cancel")); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) diff --git a/src/jalview/gui/PCAPanel.java b/src/jalview/gui/PCAPanel.java old mode 100755 new mode 100644 index d2a6426..663c262 --- a/src/jalview/gui/PCAPanel.java +++ b/src/jalview/gui/PCAPanel.java @@ -26,6 +26,7 @@ import javax.swing.*; import jalview.datamodel.*; import jalview.jbgui.*; +import jalview.util.MessageManager; import jalview.viewmodel.PCAModel; /** @@ -624,7 +625,7 @@ public class PCAPanel extends GPCAPanel implements Runnable, final JPanel progressPanel = (JPanel) progressBars.get(new Long(id)); if (handler.canCancel()) { - JButton cancel = new JButton("Cancel"); + JButton cancel = new JButton(MessageManager.getString("action.cancel")); final IProgressIndicator us = this; cancel.addActionListener(new ActionListener() { diff --git a/src/jalview/gui/WebserviceInfo.java b/src/jalview/gui/WebserviceInfo.java old mode 100755 new mode 100644 index c44e041..d733345 --- a/src/jalview/gui/WebserviceInfo.java +++ b/src/jalview/gui/WebserviceInfo.java @@ -29,6 +29,7 @@ import javax.swing.text.html.HTMLEditorKit; import javax.swing.text.html.StyleSheet; import jalview.jbgui.*; +import jalview.util.MessageManager; import jalview.ws.WSClientI; /** @@ -895,7 +896,7 @@ public class WebserviceInfo extends GWebserviceInfo implements final JPanel progressPanel = (JPanel) progressBars.get(new Long(id)); if (handler.canCancel()) { - JButton cancel = new JButton("Cancel"); + JButton cancel = new JButton(MessageManager.getString("action.cancel")); final IProgressIndicator us = this; cancel.addActionListener(new ActionListener() { diff --git a/src/jalview/gui/WsJobParameters.java b/src/jalview/gui/WsJobParameters.java index 77f3155..4f222bf 100644 --- a/src/jalview/gui/WsJobParameters.java +++ b/src/jalview/gui/WsJobParameters.java @@ -19,6 +19,7 @@ package jalview.gui; import jalview.gui.OptsAndParamsPage.OptionBox; import jalview.gui.OptsAndParamsPage.ParamBox; +import jalview.util.MessageManager; import jalview.ws.jws2.JabaParamStore; import jalview.ws.jws2.JabaPreset; import jalview.ws.jws2.Jws2Discoverer; @@ -337,7 +338,7 @@ public class WsJobParameters extends JPanel implements ItemListener, GridBagLayout gbl = new GridBagLayout(); SetNamePanel.setLayout(gbl); - JLabel setNameLabel = new JLabel("Current parameter set name :"); + JLabel setNameLabel = new JLabel(MessageManager.getString("label.current_parameter_set_name")); setNameLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); setNameInfo.add(setNameLabel); diff --git a/src/jalview/gui/WsPreferences.java b/src/jalview/gui/WsPreferences.java index 6be5d44..9a65e5a 100644 --- a/src/jalview/gui/WsPreferences.java +++ b/src/jalview/gui/WsPreferences.java @@ -19,6 +19,7 @@ package jalview.gui; import jalview.bin.Cache; import jalview.jbgui.GWsPreferences; +import jalview.util.MessageManager; import jalview.ws.jws2.Jws2Discoverer; import jalview.ws.rest.RestServiceDescription; @@ -445,7 +446,7 @@ public class WsPreferences extends GWsPreferences JTextField urltf = new JTextField(url, 40); JPanel panel = new JPanel(new BorderLayout()); JPanel pane12 = new JPanel(new BorderLayout()); - pane12.add(new JLabel("URL: "), BorderLayout.CENTER); + pane12.add(new JLabel(MessageManager.getString("label.url")), BorderLayout.CENTER); pane12.add(urltf, BorderLayout.EAST); panel.add(pane12, BorderLayout.NORTH); boolean valid = false; diff --git a/src/jalview/jbgui/GRestServiceEditorPane.java b/src/jalview/jbgui/GRestServiceEditorPane.java index a403088..92747b5 100644 --- a/src/jalview/jbgui/GRestServiceEditorPane.java +++ b/src/jalview/jbgui/GRestServiceEditorPane.java @@ -18,6 +18,7 @@ package jalview.jbgui; import jalview.gui.JvSwingUtils; +import jalview.util.MessageManager; import java.awt.BorderLayout; import java.awt.event.ActionEvent; @@ -106,14 +107,14 @@ public class GRestServiceEditorPane extends JPanel name = new JTextArea(1, 12); JvSwingUtils.mgAddtoLayout(cpanel, - "Short descriptive name for service", new JLabel("Name:"), + "Short descriptive name for service", new JLabel(MessageManager.getString("label.name")), name, "wrap"); action = new JComboBox(); JvSwingUtils .mgAddtoLayout( cpanel, "What kind of function the service performs (e.g. alignment, analysis, search, etc).", - new JLabel("Service Action:"), action, "wrap"); + new JLabel(MessageManager.getString("label.service_action")), action, "wrap"); descr = new JTextArea(4, 60); descrVp = new JScrollPane(); descrVp.setViewportView(descr); @@ -127,7 +128,7 @@ public class GRestServiceEditorPane extends JPanel .mgAddtoLayout( cpanel, "URL to post data to service. Include any special parameters needed here", - new JLabel("POST URL:"), urlVp, "wrap"); + new JLabel(MessageManager.getString("label.post_url")), urlVp, "wrap"); urlsuff = new JTextArea(); urlsuff.setColumns(60); @@ -136,12 +137,12 @@ public class GRestServiceEditorPane extends JPanel .mgAddtoLayout( cpanel, "Optional suffix added to URL when retrieving results from service", - new JLabel("URL Suffix:"), urlsuff, "wrap"); + new JLabel(MessageManager.getString("label.url_suffix")), urlsuff, "wrap"); // input options // details.add(cpanel = new JPanel(), BorderLayout.CENTER); // cpanel.setLayout(new FlowLayout()); - hSeparable = new JCheckBox("per Sequence"); + hSeparable = new JCheckBox(MessageManager.getString("label.per_seq")); hSeparable .setToolTipText("" + JvSwingUtils @@ -157,7 +158,7 @@ public class GRestServiceEditorPane extends JPanel } }); - vSeparable = new JCheckBox("Results are vertically separable"); + vSeparable = new JCheckBox(MessageManager.getString("label.result_vertically_separable")); vSeparable .setToolTipText("" + JvSwingUtils diff --git a/src/jalview/util/MessageManager.java b/src/jalview/util/MessageManager.java new file mode 100644 index 0000000..c5f0489 --- /dev/null +++ b/src/jalview/util/MessageManager.java @@ -0,0 +1,51 @@ +package jalview.util; + +import java.text.MessageFormat; +import java.util.Locale; +import java.util.ResourceBundle; +import java.util.logging.Logger; + +/** + * + * @author David Roldan Martinez + * @author Thomas Abeel + * + * + */ +public class MessageManager { + + private static ResourceBundle rb; + + private static Logger log=Logger.getLogger(MessageManager.class.getCanonicalName()); + + private static Locale loc = Locale.getDefault(); + + + + static{ + /* Localize Java dialogs */ + Locale.setDefault(loc); + /* Getting messages for GV */ + log.info("Getting messages for lang: "+loc); + rb = ResourceBundle.getBundle("lang.Messages", loc); + log.finest("Language keys: "+rb.keySet()); + + } + + public static String getString(String key){ + String value = "[missing key] " + key; + try{ + value = rb.getString(key); + }catch(Exception e){ + log.warning("I18N missing: "+loc+"\t"+key); + } + return value; + } + + public static Locale getLocale() { + return loc; + } + public static String formatMessage(String key, Object[] params){ + return MessageFormat.format(rb.getString(key), params); + } +} -- 1.7.10.2