Changeset 29009


Ignore:
Timestamp:
2014-04-29T20:07:53+12:00 (10 years ago)
Author:
ak19
Message:

Added and now using dictionary strings for GLI's new FormatConversionDialog.

Location:
main/trunk/gli
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/gli/classes/dictionary.properties

    r28626 r29009  
    940940#**********************
    941941#
     942#***** FormatConversionDialog *****
     943FormatConversionDialog.Title:Convert Greenstone 2 format statements to Greenstone 3
     944FormatConversionDialog.Reconvert:Reconvert
     945FormatConversionDialog.XHTML_Tidy:XHTML Tidy
     946FormatConversionDialog.XHTML_Tidy_Tooltip:Will run HTML Tidy over the Greenstone3 format statement to try to fix up obvious XHTML errors.
     947FormatConversionDialog.Next:Next
     948FormatConversionDialog.Accept_All:Accept All
     949FormatConversionDialog.GS2_Text_Tooltip:Greenstone2 format statement
     950FormatConversionDialog.GS3_Text_Tooltip:Greenstone3 format statement, must be XML to be active in Greenstone.
     951FormatConversionDialog.Tidy_Failed:Tidy failed.
     952FormatConversionDialog.Tidy_Done:Tidy done.
     953FormatConversionDialog.XML_Still_Invalid:XML is still invalid.
     954FormatConversionDialog.Error_GS3_Format:Error in GS3 format statement.
     955FormatConversionDialog.Invalid_XML:Invalid XML.
     956FormatConversionDialog.Invalid_XML_Warning_Title:Cancel or Continue?
     957FormatConversionDialog.Cancel_Or_Continue_Next:Either press Cancel to go back and re-edit the XML.\nOr press OK to store the current XML as-is, albeit inactive, and continue on to the next statement.\nYou can later use the Format tab to revisit this format statement if you want to update its syntax.
     958FormatConversionDialog.Cancel_Or_Accept_All:One or more GS3 format statements contains invalid XML.\nEither press Cancel to correct the XML.\nOr press OK to store the GS3 format statements as-is, albeit inactive.\nYou can later use the Format tab to revisit the format statements if you want to update their syntax.
     959
     960#**********************
     961#
    942962#***** Options Pane inside CreatePane *****
    943963OptionsPane.Cancelled: - cancelled
  • main/trunk/gli/src/org/greenstone/gatherer/gui/FormatConversionDialog.java

    r29006 r29009  
    6868   
    6969    // widgets
     70    final String WARNING_TITLE = Dictionary.get("General.Warning")
     71    + ": " + Dictionary.get("FormatConversionDialog.Invalid_XML")
     72    + " " + Dictionary.get("FormatConversionDialog.Invalid_XML_Warning_Title");
     73
    7074    private static final Border EMPTYBORDER = new EmptyBorder(5, 5, 5, 5);
    7175    private JLabel section_label = null;
     
    9296    this.setComponentOrientation(Dictionary.getOrientation());
    9397    setSize(SIZE);
    94     setTitle(Dictionary.get("FormatConversionDialog.Title"));
     98    setTitle(Dictionary.get(Dictionary.get("FormatConversionDialog.Title")));
    9599    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    96100   
     
    98102    JPanel midbutton_panel = new JPanel(); // FlowLayout by default in a JPanel
    99103    midbutton_panel.setComponentOrientation(Dictionary.getOrientation());
    100     JButton reconvert_button = new JButton("Reconvert");
     104    JButton reconvert_button = new JButton(Dictionary.get("FormatConversionDialog.Reconvert"));
    101105    midbutton_panel.add(reconvert_button);
    102106    reconvert_button.addActionListener(new ReconvertListener());
    103107    reconvert_button.setAlignmentY(Component.CENTER_ALIGNMENT);
    104108
    105     section_label = new JLabel("Section Label Goes Here");
     109    section_label = new JLabel("Section Label Goes Here"); // title will be replaced, don't need to translate
    106110    section_label.setBorder(EMPTYBORDER);
    107111    section_label.setComponentOrientation(Dictionary.getOrientation());
     
    109113    JPanel button1_panel = new JPanel();
    110114    button1_panel.setComponentOrientation(Dictionary.getOrientation());
    111     undo_button = new JButton("Undo");
     115    undo_button = new JButton(Dictionary.get("General.Undo"));
    112116    undo_button.addActionListener(new UndoListener());
    113117    undo_button.setEnabled(false);
    114118
    115     redo_button = new JButton("Redo");
     119    redo_button = new JButton(Dictionary.get("General.Redo"));
    116120    redo_button.addActionListener(new RedoListener());
    117121    redo_button.setEnabled(false);
    118122
    119     xmltidy_button = new JButton("XHTML Tidy");
     123    xmltidy_button = new JButton(Dictionary.get("FormatConversionDialog.XHTML_Tidy"));
     124    xmltidy_button.setToolTipText(Dictionary.get("FormatConversionDialog.XHTML_Tidy_Tooltip"));
    120125    xmltidy_button.addActionListener(new XMLTidyButtonListener());
    121126
     
    126131    JPanel button_panel = new JPanel(new FlowLayout());
    127132    button_panel.setComponentOrientation(Dictionary.getOrientation());
    128     count_label = new JLabel("<count>");
    129     cancel_button = new JButton("Cancel");
    130     next_button = new JButton("Next");
    131     accept_all_button = new JButton("Accept All");
     133    count_label = new JLabel("<count>"); // placeholder text for numbers, no need to translate
     134    cancel_button = new JButton(Dictionary.get("General.Cancel"));
     135    next_button = new JButton(Dictionary.get("FormatConversionDialog.Next"));
     136    accept_all_button = new JButton(Dictionary.get("FormatConversionDialog.Accept_All"));
    132137    cancel_button.addActionListener(new CancelButtonListener());
    133138    next_button.addActionListener(new NextButtonListener());
     
    152157    initTextArea(gs2_textarea);
    153158    initTextArea(gs3_textarea);
     159    gs2_textarea.setToolTipText(Dictionary.get("FormatConversionDialog.GS2_Text_Tooltip"));
     160    gs3_textarea.setToolTipText(Dictionary.get("FormatConversionDialog.GS2_Text_Tooltip"));
    154161
    155162
     
    212219    editor_textarea.setLineWrap(true);
    213220    editor_textarea.setRows(11);
    214     editor_textarea.setWrapStyleWord(false);
    215     editor_textarea.setToolTipText(Dictionary.get("CDM.FormatManager.Add_Tooltip"));
     221    editor_textarea.setWrapStyleWord(false);   
    216222    }
    217223
     
    420426        if(process_exitValue >= 2) {
    421427        System.err.println("@@@ Process exit value: " + process_exitValue);
    422         errorMsg = "Tidy failed. XML is still invalid.";
     428        errorMsg = Dictionary.get("FormatConversionDialog.Tidy_Failed")
     429            + " " + Dictionary.get("FormatConversionDialog.XML_Still_Invalid");
    423430        } else {
    424431        errorMsg = "";
     
    437444    boolean parsed = setGS3Format(i, gs3formatstr); // will parse the gs3formatstr into a DOM object
    438445    if(!parsed && errorMsg.equals("")) {
    439         errorMsg = "Tidy done. XML is still invalid.";
     446        errorMsg = Dictionary.get("FormatConversionDialog.Tidy_Done")
     447        + " " + Dictionary.get("FormatConversionDialog.XML_Still_Invalid");
    440448    }   
    441449    return errorMsg;   
     
    812820
    813821        if(!parse_success) { // invalid XML, warn the user
    814         String message = "There is an error in the XML. Either press Cancel to go back and re-edit the XML. Or press OK to store the current XML as-is, albeit inactive, and continue on to the next statement. You can later use the Format tab to revisit this format statement if you want to update its syntax.";
    815         int user_choice = JOptionPane.showConfirmDialog(FormatConversionDialog.this, message, "Warning: Invalid XML. Continue?", JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);
     822        String message = Dictionary.get("FormatConversionDialog.Invalid_XML") + " " + Dictionary.get("FormatConversionDialog.Cancel_Or_Continue_Next");
     823        int user_choice = JOptionPane.showConfirmDialog(FormatConversionDialog.this, message, WARNING_TITLE, JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);
    816824
    817825        if(user_choice == JOptionPane.CANCEL_OPTION) {
     
    850858
    851859        if(!parse_success) { // invalid XML for current format statement, warn the user
    852         setErrorStatus("Invalid XML");
    853 
    854         message = "Invalid XML. Either press Cancel to go back and re-edit the XML. Or press OK to store the current XML as-is, albeit inactive, and continue on to the next statement. You can later use the Format tab to revisit this format statement if you want to update its syntax.";
     860        setErrorStatus(Dictionary.get("FormatConversionDialog.Invalid_XML"));
     861
     862        message = Dictionary.get("FormatConversionDialog.Invalid_XML") + " " + Dictionary.get("FormatConversionDialog.Cancel_Or_Continue_Next");
    855863        }
    856864
     
    863871        if(!validationMsg.startsWith(XMLTools.WELLFORMED)) {
    864872            parse_success = false;
    865             message = "One or more GS3 format statements contains invalid XML. Either press Cancel to correct the XML. Or press OK to store the GS3 format statements as-is, albeit inactive. You can later use the Format tab to revisit the format statements if you want to update their syntax.";
     873            message = Dictionary.get("FormatConversionDialog.Cancel_Or_Accept_All");
    866874        }
    867875        }
    868876
    869877        if(!parse_success) {
    870         int user_choice = JOptionPane.showConfirmDialog(FormatConversionDialog.this, message, "Warning: Invalid XML. Continue?", JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);
     878        int user_choice = JOptionPane.showConfirmDialog(FormatConversionDialog.this, message, WARNING_TITLE, JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);
    871879        if(user_choice == JOptionPane.CANCEL_OPTION) {
    872880            return; // Don't close the dialog. Let the user continue looking at this or subsequent GS3 format statements.
     
    892900        if(process_exitValue >= 2) {
    893901        System.err.println("@@@ Process exit value: " + process_exitValue);
    894         setErrorStatus("Tidy failed.");
     902        setErrorStatus(Dictionary.get("FormatConversionDialog.Tidy_Failed"));
    895903        } else {
    896904        gs3formatstr_notags = htmltidy_string;
     
    908916
    909917        if(parse_success) {
    910             statusbar.setText("Tidy done.");
     918            statusbar.setText(Dictionary.get("FormatConversionDialog.Tidy_Done"));
    911919        } else {
    912             setErrorStatus("Tidy done. Error in GS3 format statement. Invalid XML.");
     920            setErrorStatus(Dictionary.get("FormatConversionDialog.Tidy_Done")
     921                   + " " + Dictionary.get("FormatConversionDialog.Error_GS3_Format")
     922                   + " " + Dictionary.get("FormatConversionDialog.Invalid_XML"));
    913923        }
    914924        }
Note: See TracChangeset for help on using the changeset viewer.