]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Externalize strings in org.simantics.export.ui 11/2511/2
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Fri, 30 Nov 2018 15:14:46 +0000 (17:14 +0200)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Fri, 7 Dec 2018 17:01:50 +0000 (19:01 +0200)
gitlab #210

Change-Id: I4eb50d5c00043eebac377b26a98409c9770f2e34

bundles/org.simantics.export.ui/src/org/simantics/export/ui/ContentSelectionPage.java
bundles/org.simantics.export.ui/src/org/simantics/export/ui/ExportCoreWizard.java
bundles/org.simantics.export.ui/src/org/simantics/export/ui/Messages.java [new file with mode: 0644]
bundles/org.simantics.export.ui/src/org/simantics/export/ui/OptionsPage.java
bundles/org.simantics.export.ui/src/org/simantics/export/ui/messages.properties [new file with mode: 0644]
i18n.md

index 1473c02026d97dac18ff08c0df9bef522635d334..932d1aa2257aaad4738df9dd6c72187e417835c9 100644 (file)
@@ -53,7 +53,7 @@ import org.simantics.utils.ui.workbench.StringMemento;
 public class ContentSelectionPage extends WizardPage {
        
        /** Key for preference setting that contains sub-mementos for each content URI. */
-       public static final String KEY_FORMAT_SELECTIONS = "org.simantics.modeling.ui.export.wizard.formatSelections";
+       public static final String KEY_FORMAT_SELECTIONS = "org.simantics.modeling.ui.export.wizard.formatSelections"; //$NON-NLS-1$
 
        // UI stuff
        LocalResourceManager resourceManager;
@@ -81,7 +81,7 @@ public class ContentSelectionPage extends WizardPage {
        List<Content> contentSelection = new ArrayList<Content>();
        
        public ContentSelectionPage(ExportContext ctx) throws ExportException {
-               super("Select Content", "Select the PDF Pages and the attachments", null);
+               super(Messages.ContentSelectionPage_SelectContent, Messages.ContentSelectionPage_SelectContentDescription, null);
                this.ctx = ctx;
                
                init();
@@ -89,44 +89,44 @@ public class ContentSelectionPage extends WizardPage {
        
        void init() throws ExportException {
                try {
-                       System.out.println("Found Content Types:");
+                       System.out.println("Found Content Types:"); //$NON-NLS-1$
                        for ( ContentType ct : ctx.eep.contentTypes() ) {
-                               System.out.println("   "+ct);
+                               System.out.println("   "+ct); //$NON-NLS-1$
                        }
                        System.out.println();
                        
-                       System.out.println("Exporters:");
+                       System.out.println("Exporters:"); //$NON-NLS-1$
                        for ( Exporter ex : ctx.eep.exporters() ) {
-                               System.out.println("   "+ex);
+                               System.out.println("   "+ex); //$NON-NLS-1$
                        }
                        System.out.println();
 
-                       System.out.println("Formats:");
+                       System.out.println("Formats:"); //$NON-NLS-1$
                        for ( Format format : ctx.eep.formats() ) {
-                               System.out.println("   "+format);
+                               System.out.println("   "+format); //$NON-NLS-1$
                        }
                        System.out.println();
 
-                       System.out.println("Discoverers:");
+                       System.out.println("Discoverers:"); //$NON-NLS-1$
                        for ( Discoverer discoverer : ctx.eep.discoverers() ) {
-                               System.out.println("   "+discoverer);
+                               System.out.println("   "+discoverer); //$NON-NLS-1$
                        }
                        System.out.println();
                        
-                       System.out.println("Publishers:");
+                       System.out.println("Publishers:"); //$NON-NLS-1$
                        for ( Publisher publisher : ctx.eep.publishers() ) {
-                               System.out.println("   "+publisher.id());
+                               System.out.println("   "+publisher.id()); //$NON-NLS-1$
                        }
                        System.out.println();
                        
                        // Organize formats by content types - Filter out ContentTypes that don't have exporter and format.
-                       System.out.println("Mapped ContentTypes to Exporters:");
+                       System.out.println("Mapped ContentTypes to Exporters:"); //$NON-NLS-1$
                        typeToFormatMap = MapList.use( new TreeMap<ContentType, List<Format>>(toStringComparator) );
                        for ( ContentType ct : ctx.eep.contentTypes() ) {
                                for ( Exporter exp : ctx.eep.getExportersForContentType( ct.id() ) ) {
                                        Format format = ctx.eep.getFormat( exp.formatId() );
                                        if ( format==null ) continue;
-                                       System.out.println("    "+ct.id()+" -> "+format.fileext());
+                                       System.out.println("    "+ct.id()+" -> "+format.fileext()); //$NON-NLS-1$ //$NON-NLS-2$
                                        if (!typeToFormatMap.contains(ct, format)) typeToFormatMap.add(ct, format);
                                }
                        }
@@ -140,7 +140,7 @@ public class ContentSelectionPage extends WizardPage {
                        for ( String content : ctx.selection ) {
                                initialContentHash = 13*initialContentHash + content.hashCode();
                        }
-                       initialSelectionKey = "InitialSelection-"+initialContentHash;
+                       initialSelectionKey = "InitialSelection-"+initialContentHash; //$NON-NLS-1$
                        String sel = ctx.store.get(initialSelectionKey, null);
                        if ( sel != null ) {
                                initialSelection = ExportWizardResult.parse(sel);
@@ -148,7 +148,7 @@ public class ContentSelectionPage extends WizardPage {
                                // First time wizard was called with this selection.
                                // Check in
                                for ( String contentUri : ctx.selection ) {
-                                       initialSelection.add( new Content(contentUri, null, "all", null, null, null) );
+                                       initialSelection.add( new Content(contentUri, null, "all", null, null, null) ); //$NON-NLS-1$
                                }
                        }
                        
@@ -157,10 +157,10 @@ public class ContentSelectionPage extends WizardPage {
                        StringBuilder modelsStr = new StringBuilder(); 
                        for ( String content : ctx.selection ) {
                                for ( String model : allModels ) {
-                                       if ( content.equals(model) || content.startsWith(model + "/") ) {
+                                       if ( content.equals(model) || content.startsWith(model + "/") ) { //$NON-NLS-1$
                                                if ( !selectedModels.contains( model ) ) {
                                                        selectedModels.add( model );
-                                                       if ( modelsStr.length()>0 ) modelsStr.append(", ");
+                                                       if ( modelsStr.length()>0 ) modelsStr.append(", "); //$NON-NLS-1$
                                                        modelsStr.append( model );
                                                }
                                        }
@@ -172,18 +172,18 @@ public class ContentSelectionPage extends WizardPage {
                        if ( selectedModels.isEmpty() ) selectedModels.addAll( allModels );
                        // UI labels
                        labels = new HashMap<String, Map<String, String>>();                    
-                       labels.put( "model", ctx.session.syncRequest( ExportQueries.labels( selectedModels ) ) ); // Should Model CT be used for labeling? 
+                       labels.put( "model", ctx.session.syncRequest( ExportQueries.labels( selectedModels ) ) ); // Should Model CT be used for labeling?  //$NON-NLS-1$
                        
                        // Discover contents
-                       System.out.println("Discovering content: "+modelsStr);
+                       System.out.println("Discovering content: "+modelsStr); //$NON-NLS-1$
                        content = MapList.use( new TreeMap<ContentType, List<String>>(toStringComparator) );
                        contentToTypeMap = MapList.use( new TreeMap<String, List<ContentType>>(toStringComparator) );
                        modelContent = MapList.use( new TreeMap<String, List<String>>() );
                        
                        for ( ContentType ct : typeToFormatMap.getKeys() ) {
-                               System.out.println("    "+ct.label());
+                               System.out.println("    "+ct.label()); //$NON-NLS-1$
                                for ( Discoverer discoverer : ctx.eep.getDiscoverers( ct.id() )) {
-                                       System.out.println("         "+discoverer.toString());
+                                       System.out.println("         "+discoverer.toString()); //$NON-NLS-1$
                                        
                                        // Get content Uris
                                        Collection<String> contents = discoverer.discoverContent(ctx, selectedModels);
@@ -202,7 +202,7 @@ public class ContentSelectionPage extends WizardPage {
                                                content.add( ct, contentId );
                                                contentToTypeMap.add(contentId, ct);
                                                //modelContent.add(key)
-                                               System.out.println("            "+contentId);
+                                               System.out.println("            "+contentId); //$NON-NLS-1$
                                        }
                                        
                                }
@@ -226,18 +226,18 @@ public class ContentSelectionPage extends WizardPage {
            Color contentTypeColor = resourceManager.createColor( new RGB(245, 245, 252) );
            GridColumn column = new GridColumn(grid,SWT.NONE);
            column.setTree(true);
-           column.setText("Name");
+           column.setText(Messages.ContentSelectionPage_Name);
            column.setWidth(200);           
 
            // "Pagees"
            assertColumnIndex(1);
                    
-           Format pdfFormat = ctx.eep.getFormat("pdf");
+           Format pdfFormat = ctx.eep.getFormat("pdf"); //$NON-NLS-1$
            
            
            ImageDescriptor folderID = null;
                try {
-                       URL folderUrl = new URL("platform:/plugin/com.famfamfam.silk/icons/folder.png");
+                       URL folderUrl = new URL("platform:/plugin/com.famfamfam.silk/icons/folder.png"); //$NON-NLS-1$
                    folderID = ImageDescriptor.createFromURL( folderUrl );
                } catch (MalformedURLException e) {
                        e.printStackTrace();
@@ -257,7 +257,7 @@ public class ContentSelectionPage extends WizardPage {
                if (modelContentType==null) continue;
                
                // Create Model Node
-               String modelLabel = labels.get("model").get(modelUri);
+               String modelLabel = labels.get("model").get(modelUri); //$NON-NLS-1$
                        GridItem modelNode = newLine(grid, modelLabel, modelUri, modelContentType.id()); 
                        setIcon(modelNode, 0, modelContentType.icon(modelUri));
                        modelNode.setToolTipText(0, modelUri);
@@ -319,7 +319,7 @@ public class ContentSelectionPage extends WizardPage {
                                                columnNumber++;
                                                assertColumnIndex( columnNumber );
                                                
-                                               contentNode.setText(columnNumber, "  "+pdfFormat.fileext());
+                                               contentNode.setText(columnNumber, "  "+pdfFormat.fileext()); //$NON-NLS-1$
                                                contentNode.setGrayed(columnNumber, false);
                                            contentNode.setCheckable(columnNumber, true);
                                            contentNode.setChecked(columnNumber, hasInitialSelection(contentUri, pdfFormat.id()) );
@@ -342,7 +342,7 @@ public class ContentSelectionPage extends WizardPage {
                                                if ( !contentTypesFormats.contains(format) ) contentTypesFormats.add(format);
                                                columnNumber++;
                                                assertColumnIndex( columnNumber );
-                                               contentNode.setText(columnNumber, "  "+format.fileext());
+                                               contentNode.setText(columnNumber, "  "+format.fileext()); //$NON-NLS-1$
                                                contentNode.setGrayed(columnNumber, false);
                                            contentNode.setCheckable(columnNumber, true);
                                            contentNode.setChecked(columnNumber, hasInitialSelection(contentUri, format.id()) );
@@ -432,7 +432,7 @@ public class ContentSelectionPage extends WizardPage {
                        int cc = grid.getColumnCount();
                        
                    GridColumn column = new GridColumn(grid, SWT.CHECK);
-                   column.setText( cc==1?"Pages":"Attachments");
+                   column.setText( cc==1?Messages.ContentSelectionPage_Pages:Messages.ContentSelectionPage_Attachments);
                    column.setWidth( cc==1?150:200 );
                    
                    for (GridItem gi : grid.getItems()) {
@@ -446,7 +446,7 @@ public class ContentSelectionPage extends WizardPage {
        boolean hasInitialSelection(String uri, String formatId) {
                for (Content c : initialSelection) {
                        if ( !c.url.equals( uri ) ) continue;
-                       if ( c.formatId.equals("all") || c.formatId.equals(formatId) ) return true;
+                       if ( c.formatId.equals("all") || c.formatId.equals(formatId) ) return true; //$NON-NLS-1$
                }
                return false;
        }
index ea2cb05dc9c1bdaaf9755dfcb3176f8d8e567705..cc4b3092d432c2ed28c013372b97a2e9cbf7d0be 100644 (file)
@@ -11,6 +11,7 @@ import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.wizard.IWizardPage;
 import org.eclipse.jface.wizard.Wizard;
 import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.osgi.util.NLS;
 import org.eclipse.ui.IExportWizard;
 import org.eclipse.ui.IWorkbench;
 import org.osgi.service.prefs.BackingStoreException;
@@ -36,7 +37,7 @@ public class ExportCoreWizard extends Wizard implements IExportWizard {
        OptionsPage optionsPage;
 
        public ExportCoreWizard() {
-               setWindowTitle("Export PDF files");
+               setWindowTitle(Messages.ExportCoreWizard_ExportPDFFiles);
                setNeedsProgressMonitor(true);
        }
 
@@ -83,7 +84,7 @@ public class ExportCoreWizard extends Wizard implements IExportWizard {
                        if ( !exportProblems.isEmpty() ) {
                                CollectionUtils.unique(exportProblems);
                                WizardPage cp = (WizardPage) getContainer().getCurrentPage();
-                               String str = CollectionUtils.toString(exportProblems, "\n");
+                               String str = CollectionUtils.toString(exportProblems, "\n"); //$NON-NLS-1$
                                cp.setErrorMessage( str );
                                return false;
                        }
@@ -106,7 +107,7 @@ public class ExportCoreWizard extends Wizard implements IExportWizard {
                        try {
                                ctx.store.flush();
                        } catch (BackingStoreException e) {
-                               ErrorLogger.defaultLogError("Failed to persist wizard preferences.", e);
+                               ErrorLogger.defaultLogError(Messages.ExportCoreWizard_FailedToSavePreferences, e);
                                ExceptionUtils.logError(e);
                        }
                } catch (InvocationTargetException e) {
@@ -119,13 +120,13 @@ public class ExportCoreWizard extends Wizard implements IExportWizard {
                        }
 
                        if (canceled[0]) {
-                               cp.setErrorMessage("Export canceled.");
+                               cp.setErrorMessage(Messages.ExportCoreWizard_FailedToPersistWizardPrefs);
                        } else if (t instanceof IOException) {
-                               ErrorLogger.defaultLogError("An I/O problem occurred while exporting the model. See exception for details.", t);
-                               cp.setErrorMessage("An I/O problem occurred while exporting the model.\nMessage: " + t.getMessage());
+                               ErrorLogger.defaultLogError("An I/O problem occurred while exporting the model. See exception for details.", t); //$NON-NLS-1$
+                               cp.setErrorMessage(NLS.bind(Messages.ExportCoreWizard_IOProblem, t.getMessage()));
                        } else {
-                               ErrorLogger.defaultLogError("Unexpected exception while exporting the model. See exception for details.", t);
-                               cp.setErrorMessage("Unexpected exception while exporting the model. See error log for details.\nMessage: " + t.getMessage());
+                               ErrorLogger.defaultLogError("Unexpected exception while exporting the model. See exception for details.", t); //$NON-NLS-1$
+                               cp.setErrorMessage(NLS.bind(Messages.ExportCoreWizard_UnexpectedException, t.getMessage()));
                        }
                        return false;
                } catch (InterruptedException e) {
diff --git a/bundles/org.simantics.export.ui/src/org/simantics/export/ui/Messages.java b/bundles/org.simantics.export.ui/src/org/simantics/export/ui/Messages.java
new file mode 100644 (file)
index 0000000..b7e68f5
--- /dev/null
@@ -0,0 +1,32 @@
+package org.simantics.export.ui;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.export.ui.messages"; //$NON-NLS-1$
+       public static String ContentSelectionPage_Attachments;
+       public static String ContentSelectionPage_Name;
+       public static String ContentSelectionPage_Pages;
+       public static String ContentSelectionPage_SelectContent;
+       public static String ContentSelectionPage_SelectContentDescription;
+       public static String ExportCoreWizard_FailedToSavePreferences;
+       public static String ExportCoreWizard_ExportPDFFiles;
+       public static String ExportCoreWizard_FailedToPersistWizardPrefs;
+       public static String ExportCoreWizard_IOProblem;
+       public static String ExportCoreWizard_UnexpectedException;
+       public static String OptionsPage_ExportAttachmentOf;
+       public static String OptionsPage_IncludeAttachmentTo;
+       public static String OptionsPage_Merge;
+       public static String OptionsPage_OptionsPage;
+       public static String OptionsPage_OutputOptions;
+       public static String OptionsPage_PublishTo;
+       public static String OptionsPage_SelectExportOptions;
+       public static String OptionsPage_UnExpectedError;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index 9d2cea02042eb8432d75f52c03c1a08323a57dce..499974cadab747aa1f244d8613856a3ba41bd7fc 100644 (file)
@@ -11,6 +11,7 @@ import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.ScrolledComposite;
 import org.eclipse.swt.layout.GridData;
@@ -65,11 +66,11 @@ import org.simantics.utils.ui.dialogs.ShowMessage;
  */
 public class OptionsPage extends WizardPage {
 
-       public static String S_OUTPUT_OPTIONS = "Output Options";
+       public static String S_OUTPUT_OPTIONS = Messages.OptionsPage_OutputOptions;
        public static LabelReference P_OUTPUT_OPTIONS = new LabelReference( S_OUTPUT_OPTIONS );
        
        /** A reference to combo box selection */
-       public static String S_PUBLISH = "Publish to";
+       public static String S_PUBLISH = Messages.OptionsPage_PublishTo;
        public static ChildReference P_PUBLISH = ChildReference.compile(P_OUTPUT_OPTIONS, new LabelReference(S_PUBLISH));
        
        ExportContext ctx; 
@@ -83,7 +84,7 @@ public class OptionsPage extends WizardPage {
        String selectedPublisherId;
        
        public OptionsPage(ExportContext ctx) throws ExportException {
-               super("Options page", "Select export options", null);
+               super(Messages.OptionsPage_OptionsPage, Messages.OptionsPage_SelectExportOptions, null);
                
                this.ctx = ctx;
        }
@@ -100,7 +101,7 @@ public class OptionsPage extends WizardPage {
                public void handleEvent(Event event) {
                        updatingForm = true;
                        try {
-                               Preferences contentScopePrefs = ctx.store.node( "Selection-"+selectionHash );
+                               Preferences contentScopePrefs = ctx.store.node( "Selection-"+selectionHash ); //$NON-NLS-1$
                                Preferences workspaceScopePrefs = ctx.store;
                                
                                Composite outputOptions = (Composite) form.getControl(composite, P_OUTPUT_OPTIONS);
@@ -152,16 +153,16 @@ public class OptionsPage extends WizardPage {
                                updatingForm = false;
                                validate();
                        } catch ( BindingException e ) {
-                               setErrorMessage( e.getClass().getName()+": "+ e.getMessage() );
+                               setErrorMessage( e.getClass().getName()+": "+ e.getMessage() ); //$NON-NLS-1$
                    ExceptionUtils.logError(e);                 
                        } catch (AccessorConstructionException e) {
-                               setErrorMessage( e.getClass().getName()+": "+ e.getMessage() );
+                               setErrorMessage( e.getClass().getName()+": "+ e.getMessage() ); //$NON-NLS-1$
                    ExceptionUtils.logError(e);                 
                        } catch (AccessorException e) {
-                               setErrorMessage( e.getClass().getName()+": "+ e.getMessage() );
+                               setErrorMessage( e.getClass().getName()+": "+ e.getMessage() ); //$NON-NLS-1$
                    ExceptionUtils.logError(e);                 
                        } catch (ExportException e) {
-                               setErrorMessage( e.getClass().getName()+": "+ e.getMessage() );
+                               setErrorMessage( e.getClass().getName()+": "+ e.getMessage() ); //$NON-NLS-1$
                    ExceptionUtils.logError(e);                 
                        } finally {
                                updatingForm = false;
@@ -243,7 +244,7 @@ public class OptionsPage extends WizardPage {
                        
                        for ( Format format : formats ) {
                                if ( format.isGroupFormat() && contentByFormat.getValues(format).size()>1 ) {
-                                       outputOptions.addComponent("Merge "+format.fileext()+" content into one file", Datatypes.BOOLEAN);
+                                       outputOptions.addComponent(NLS.bind(Messages.OptionsPage_Merge, format.fileext()), Datatypes.BOOLEAN); //$NON-NLS-2$
                                }
                                
                                if ( format.isContainerFormat() ) {
@@ -261,8 +262,8 @@ public class OptionsPage extends WizardPage {
                                        }
                                        
                                        if ( attachmentCount > 0 ) { 
-                                               outputOptions.addComponent("Include attachments to "+format.fileext(), Datatypes.BOOLEAN);
-                                               outputOptions.addComponent("Export attachments of "+format.fileext()+" to separate files", Datatypes.BOOLEAN);
+                                               outputOptions.addComponent(NLS.bind(Messages.OptionsPage_IncludeAttachmentTo, format.fileext()), Datatypes.BOOLEAN);
+                                               outputOptions.addComponent(NLS.bind(Messages.OptionsPage_ExportAttachmentOf, format.fileext()), Datatypes.BOOLEAN); 
                                        }
                                }
                        }
@@ -325,8 +326,8 @@ public class OptionsPage extends WizardPage {
                        {
                                selection = contents;
                                Preferences workspaceScopePrefs = ctx.store;
-                               Preferences contentScopePrefs = ctx.store.node( "Selection-"+selectionHash );
-                               selectedPublisherId = ctx.store.get("publisherId", "");         
+                               Preferences contentScopePrefs = ctx.store.node( "Selection-"+selectionHash ); //$NON-NLS-1$
+                               selectedPublisherId = ctx.store.get("publisherId", "");          //$NON-NLS-1$ //$NON-NLS-2$
                                Publisher publisher = ctx.eep.getPublisher(selectedPublisherId);
                                if ( publisher != null ) {
                                        
@@ -361,17 +362,17 @@ public class OptionsPage extends WizardPage {
                        
                } catch (BindingException e) {
             ExceptionUtils.logError(e);                        
-                       ShowMessage.showError("Unexpected error", e.getClass().getName()+" "+e.getMessage());
+                       ShowMessage.showError(Messages.OptionsPage_UnExpectedError, e.getClass().getName()+" "+e.getMessage()); //$NON-NLS-2$
                        throw new RuntimeBindingException(e);
                } catch (ExportException e) {
             ExceptionUtils.logError(e);                        
-                       ShowMessage.showError("Unexpected error", e.getClass().getName()+" "+e.getMessage());
+                       ShowMessage.showError(Messages.OptionsPage_UnExpectedError, e.getClass().getName()+" "+e.getMessage()); //$NON-NLS-2$
                } catch (DatatypeConstructionException e) {
             ExceptionUtils.logError(e);                        
-                       ShowMessage.showError("Unexpected error", e.getClass().getName()+" "+e.getMessage());
+                       ShowMessage.showError(Messages.OptionsPage_UnExpectedError, e.getClass().getName()+" "+e.getMessage()); //$NON-NLS-2$
                } catch (AccessorConstructionException e) {
             ExceptionUtils.logError(e);                        
-                       ShowMessage.showError("Unexpected error", e.getClass().getName()+" "+e.getMessage());
+                       ShowMessage.showError(Messages.OptionsPage_UnExpectedError, e.getClass().getName()+" "+e.getMessage()); //$NON-NLS-2$
                } catch (AccessorException e) {
             ExceptionUtils.logError(e);                        
                        // TODO Auto-generated catch block
@@ -491,7 +492,7 @@ public class OptionsPage extends WizardPage {
                        result.accessor = Accessors.getAccessor(result.options);
                        result.contents = selection;
                        result.type = (RecordType) options.type();
-                       result.publisherId = "file";
+                       result.publisherId = "file"; //$NON-NLS-1$
                        
                        List<ExportAction> actions = new ArrayList<ExportAction>();
                        List<Content> manifest = new ArrayList<Content>(); 
@@ -522,7 +523,7 @@ public class OptionsPage extends WizardPage {
                        
                        String publisherLabel = ExporterUtils.getUnionValue(result.accessor, P_PUBLISH);
                        Publisher publisher = ctx.eep.getPublisherByLabel(publisherLabel);
-                       result.publisherId = publisher==null?"":publisher.id();                 
+                       result.publisherId = publisher==null?"":publisher.id();                  //$NON-NLS-1$
                        
                } catch (BindingException e) {
                        throw new ExportException(e);                   
@@ -554,7 +555,7 @@ public class OptionsPage extends WizardPage {
                }
                
 
-               setErrorMessage( errs.isEmpty() ? null : CollectionUtils.toString(errs, ", ") );
+               setErrorMessage( errs.isEmpty() ? null : CollectionUtils.toString(errs, ", ") ); //$NON-NLS-1$
                setPageComplete( errs.isEmpty() );
        }
                
@@ -572,14 +573,14 @@ public class OptionsPage extends WizardPage {
                        RecordAccessor ra = Accessors.getAccessor(options);
                        String publisherId = ExporterUtils.getUnionValue(ra, P_PUBLISH); 
                        Publisher publisher = ctx.eep.getPublisherByLabel(publisherId);
-                       if ( publisher!=null ) workspaceScopePrefs.put("publisherId", publisher.id());
+                       if ( publisher!=null ) workspaceScopePrefs.put("publisherId", publisher.id()); //$NON-NLS-1$
                        
                        if ( ra.type().hasComponent(P_OUTPUT_OPTIONS.label) ) {
                                RecordAccessor rao = ra.getComponent( P_OUTPUT_OPTIONS );
                                                                
-                               Pattern merge_pattern = Pattern.compile("Merge ([^\\s]*) content into one file");
-                               Pattern include_pattern = Pattern.compile("Include attachments to ([^\\s]*)");
-                               Pattern export_pattern = Pattern.compile("Export attachments of ([^\\s]*) to separate files");
+                               Pattern merge_pattern = Pattern.compile("Merge ([^\\s]*) content into one file"); //$NON-NLS-1$
+                               Pattern include_pattern = Pattern.compile("Include attachments to ([^\\s]*)"); //$NON-NLS-1$
+                               Pattern export_pattern = Pattern.compile("Export attachments of ([^\\s]*) to separate files"); //$NON-NLS-1$
                                
                                for (int i=0; i<rao.count(); i++) {
                                        String name = rao.type().getComponent(i).name;
@@ -590,7 +591,7 @@ public class OptionsPage extends WizardPage {
                                                String fileExt = m.group(1);
                                                Format format = ctx.eep.getFormatByExt(fileExt);
                                                Boolean value = (Boolean) rao.getFieldValue(i, Bindings.BOOLEAN);
-                                               String key = format.id()+"_merge";
+                                               String key = format.id()+"_merge"; //$NON-NLS-1$
                                                contentScopePrefs.putBoolean(key, value);
                                                workspaceScopePrefs.putBoolean(key, value);
                                        }
@@ -600,7 +601,7 @@ public class OptionsPage extends WizardPage {
                                                String fileExt = m.group(1);
                                                Format format = ctx.eep.getFormatByExt(fileExt);
                                                Boolean value = (Boolean) rao.getFieldValue(i, Bindings.BOOLEAN);
-                                               String key = format.id()+"_include_attachments";
+                                               String key = format.id()+"_include_attachments"; //$NON-NLS-1$
                                                contentScopePrefs.putBoolean(key, value);
                                                workspaceScopePrefs.putBoolean(key, value);
                                        }
@@ -610,7 +611,7 @@ public class OptionsPage extends WizardPage {
                                                String fileExt = m.group(1);
                                                Format format = ctx.eep.getFormatByExt(fileExt);
                                                Boolean value = (Boolean) rao.getFieldValue(i, Bindings.BOOLEAN);
-                                               String key = format.id()+"_export_attachments";
+                                               String key = format.id()+"_export_attachments"; //$NON-NLS-1$
                                                contentScopePrefs.putBoolean(key, value);
                                                workspaceScopePrefs.putBoolean(key, value);
                                        }
@@ -639,7 +640,7 @@ public class OptionsPage extends WizardPage {
                //Preferences workspaceScopePrefs = ctx.store;
         try {
                        RecordAccessor ra = Accessors.getAccessor(options);             
-                       String publisherId = workspaceScopePrefs.get("publisherId", "");
+                       String publisherId = workspaceScopePrefs.get("publisherId", ""); //$NON-NLS-1$ //$NON-NLS-2$
                        Publisher publisher = ctx.eep.getPublisher(publisherId);
                        if ( publisher != null ) ExporterUtils.setUnionValue(ra, P_PUBLISH, publisher.label());
                        
@@ -648,7 +649,7 @@ public class OptionsPage extends WizardPage {
                                                                
                                for (Format format : ctx.eep.formats()) {
                                        if ( format.isGroupFormat() ) {
-                                               String key = format.id()+"_merge";
+                                               String key = format.id()+"_merge"; //$NON-NLS-1$
                                                Boolean value = null;
                                                if ( containsKey(contentScopePrefs, key) ) {
                                                        value = contentScopePrefs.getBoolean(key, false); 
@@ -657,7 +658,7 @@ public class OptionsPage extends WizardPage {
                                                }
                                                                                        
                                                if ( value != null ) {
-                                                       String key2 = "Merge "+format.fileext()+" content into one file";
+                                                       String key2 = "Merge "+format.fileext()+" content into one file"; //$NON-NLS-1$ //$NON-NLS-2$
                                                        int index = rao.type().getComponentIndex2(key2);
                                                        if ( index>=0 ) {
                                                                rao.setFieldValue(index, Bindings.BOOLEAN, value);
@@ -666,7 +667,7 @@ public class OptionsPage extends WizardPage {
                                        }
                                        
                                        if ( format.isContainerFormat() ) {
-                                               String key = format.id()+"_include_attachments";
+                                               String key = format.id()+"_include_attachments"; //$NON-NLS-1$
                                                Boolean value = null;
                                                if ( containsKey(contentScopePrefs, key) ) {
                                                        value = contentScopePrefs.getBoolean(key, false); 
@@ -675,7 +676,7 @@ public class OptionsPage extends WizardPage {
                                                }
                                                                                        
                                                if ( value != null ) {
-                                                       String key2 = "Include attachments to "+format.fileext();
+                                                       String key2 = "Include attachments to "+format.fileext(); //$NON-NLS-1$
                                                        int index = rao.type().getComponentIndex2(key2);
                                                        if ( index>=0 ) {
                                                                rao.setFieldValue(index, Bindings.BOOLEAN, value);
@@ -684,7 +685,7 @@ public class OptionsPage extends WizardPage {
                                        }
                                        
                                        if ( format.isContainerFormat() ) {
-                                               String key = format.id()+"_export_attachments";
+                                               String key = format.id()+"_export_attachments"; //$NON-NLS-1$
                                                Boolean value = null;
                                                if ( containsKey(contentScopePrefs, key) ) {
                                                        value = contentScopePrefs.getBoolean(key, false); 
@@ -693,7 +694,7 @@ public class OptionsPage extends WizardPage {
                                                }
                                                                                        
                                                if ( value != null ) {
-                                                       String key2 = "Export attachments of "+format.fileext()+" to separate files";
+                                                       String key2 = "Export attachments of"+format.fileext()+" to separate files"; //$NON-NLS-2$
                                                        int index = rao.type().getComponentIndex2(key2);
                                                        if ( index>=0 ) {
                                                                rao.setFieldValue(index, Bindings.BOOLEAN, value);
@@ -717,7 +718,7 @@ public class OptionsPage extends WizardPage {
        public void savePrefs() throws ExportException {
                try {
                        int oldSelectionHash = selectionHash;                   
-                       Preferences contentScopePrefs = ctx.store.node( "Selection-"+oldSelectionHash );
+                       Preferences contentScopePrefs = ctx.store.node( "Selection-"+oldSelectionHash ); //$NON-NLS-1$
                        Preferences workspaceScopePrefs = ctx.store;
                                        
                        RecordBinding binding = ctx.databoard.getMutableBinding( form.type() );
@@ -767,11 +768,11 @@ public class OptionsPage extends WizardPage {
                                
                                for (Format format : ctx.eep.formats()) {
                                        if ( format.isContainerFormat() ) {
-                                               String key = "Include attachments to "+format.fileext();
+                                               String key = "Include attachments to "+format.fileext(); //$NON-NLS-1$
                                                int index = rao.type().getComponentIndex2(key);
                                                if ( index>=0 ) rao.setFieldValue(index, Bindings.BOOLEAN, true);
                                                
-                                               key = "Export attachments of "+format.fileext()+" to separate files";;
+                                               key = "Export attachments of "+format.fileext()+" to separate files";; //$NON-NLS-1$ //$NON-NLS-2$
                                                index = rao.type().getComponentIndex2(key);
                                                if ( index>=0 ) rao.setFieldValue(index, Bindings.BOOLEAN, true);
                                        }                       
diff --git a/bundles/org.simantics.export.ui/src/org/simantics/export/ui/messages.properties b/bundles/org.simantics.export.ui/src/org/simantics/export/ui/messages.properties
new file mode 100644 (file)
index 0000000..1fa88dc
--- /dev/null
@@ -0,0 +1,18 @@
+ContentSelectionPage_Attachments=Attachments
+ContentSelectionPage_Name=Name
+ContentSelectionPage_Pages=Pages
+ContentSelectionPage_SelectContent=Select Content
+ContentSelectionPage_SelectContentDescription=Select the PDF Pages and the attachments
+ExportCoreWizard_FailedToSavePreferences=Failed to persist wizard preferences.
+ExportCoreWizard_ExportPDFFiles=Export PDF files
+ExportCoreWizard_FailedToPersistWizardPrefs=Export canceled.
+ExportCoreWizard_IOProblem=An I/O problem occurred while exporting the model.\nMessage: {0}
+ExportCoreWizard_UnexpectedException=Unexpected exception while exporting the model. See error log for details.\nMessage: {0}
+OptionsPage_ExportAttachmentOf=Export attachments of {0} to separate files
+OptionsPage_IncludeAttachmentTo=Include attachments to {0}
+OptionsPage_Merge=Merge {0} content into one file
+OptionsPage_OptionsPage=Options page
+OptionsPage_OutputOptions=Output Options
+OptionsPage_PublishTo=Publish to
+OptionsPage_SelectExportOptions=Select export options
+OptionsPage_UnExpectedError=Unexpected error
diff --git a/i18n.md b/i18n.md
index 9119c8b197aca51a5892342b8b8fae33df59e654..a2444e88a703b735142f0821f6a2c4d6b74195b6 100644 (file)
--- a/i18n.md
+++ b/i18n.md
@@ -6,6 +6,8 @@
 * [x] org.simantics.desktop.ui
 * [x] org.simantics.document.linking.ui
 * [x] org.simantics.document.ui
+* [x] org.simantics.document.ui.ontology
+* [x] org.simantics.export.ui
 * ...
 
 ## TODO ##
@@ -21,9 +23,7 @@
 * /org.simantics.browsing.ui.swt (Nothing to Exeternalize or all can be ignored) 
 * /org.simantics.debug.browser.ui (Nothing to Exeternalize or all can be ignored) 
 * /org.simantics.desktop.ui.ontology (No strings to externalize)
-* /org.simantics.document.ui
-* /org.simantics.document.ui.ontology
-* /org.simantics.export.ui
+
 * /org.simantics.fileimport.ui
 * /org.simantics.graphviz.ui
 * /org.simantics.help.ui