Search in sources :

Example 6 with NotLoadedProject

use of org.omegat.core.data.NotLoadedProject in project omegat by omegat-org.

the class GlossaryReaderTBXTest method testRead.

@Test
public void testRead() throws Exception {
    Core.setProject(new NotLoadedProject() {

        public ProjectProperties getProjectProperties() {
            try {
                return new ProjectProperties(new File("stub")) {

                    @Override
                    public Language getSourceLanguage() {
                        return new Language("en");
                    }

                    @Override
                    public Language getTargetLanguage() {
                        return new Language("hu");
                    }
                };
            } catch (Exception ex) {
                throw new RuntimeException(ex);
            }
        }
    });
    List<GlossaryEntry> g = GlossaryReaderTBX.read(new File("test/data/glossaries/sampleTBXfile.tbx"), false);
    assertEquals(1, g.size());
    assertEquals("alpha smoothing factor", g.get(0).getSrcText());
    assertEquals("hu translation", g.get(0).getLocText());
}
Also used : Language(org.omegat.util.Language) NotLoadedProject(org.omegat.core.data.NotLoadedProject) ProjectProperties(org.omegat.core.data.ProjectProperties) File(java.io.File) Test(org.junit.Test)

Example 7 with NotLoadedProject

use of org.omegat.core.data.NotLoadedProject in project omegat by omegat-org.

the class Core method initializeGUI.

/**
 * Initialize application components.
 */
public static void initializeGUI(ClassLoader classLoader, final Map<String, String> params) throws Exception {
    cmdLineParams = params;
    // 1. Initialize project
    currentProject = new NotLoadedProject();
    // 2. Initialize theme
    UIDesignManager.initialize(classLoader);
    // 3. Initialize application frame
    MainWindow me = new MainWindow();
    mainWindow = me;
    Core.registerMarker(new ProtectedPartsMarker());
    Core.registerMarker(new RemoveTagMarker());
    Core.registerMarker(new NBSPMarker());
    Core.registerMarker(new TransTipsMarker());
    Core.registerMarker(new WhitespaceMarkerFactory.SpaceMarker());
    Core.registerMarker(new WhitespaceMarkerFactory.TabMarker());
    Core.registerMarker(new WhitespaceMarkerFactory.LFMarker());
    Core.registerMarker(new BidiMarkers());
    Core.registerMarker(new ReplaceMarker());
    Core.registerMarker(new ComesFromAutoTMMarker());
    Core.registerMarker(new FontFallbackMarker());
    LanguageToolWrapper.init();
    segmenter = new Segmenter(Preferences.getSRX());
    filterMaster = new FilterMaster(Preferences.getFilters());
    // 4. Initialize other components. They add themselves to the main window.
    editor = new EditorController(me);
    tagValidation = new TagValidationTool();
    issuesWindow = new IssuesPanelController(me);
    matcher = new MatchesTextArea(me);
    GlossaryTextArea glossaryArea = new GlossaryTextArea(me);
    glossary = glossaryArea;
    glossaryManager = new GlossaryManager(glossaryArea);
    notes = new NotesTextArea(me);
    comments = new CommentsTextArea(me);
    machineTranslatePane = new MachineTranslateTextArea(me);
    dictionaries = new DictionariesTextArea(me);
    spellChecker = new SpellChecker();
    multiple = new MultipleTransPane(me);
    new SegmentPropertiesArea(me);
    SaveThread th = new SaveThread();
    saveThread = th;
    th.start();
    new VersionCheckThread(10).start();
}
Also used : NBSPMarker(org.omegat.gui.editor.mark.NBSPMarker) MachineTranslateTextArea(org.omegat.gui.exttrans.MachineTranslateTextArea) EditorController(org.omegat.gui.editor.EditorController) MultipleTransPane(org.omegat.gui.multtrans.MultipleTransPane) DictionariesTextArea(org.omegat.gui.dictionaries.DictionariesTextArea) BidiMarkers(org.omegat.gui.editor.mark.BidiMarkers) WhitespaceMarkerFactory(org.omegat.gui.editor.mark.WhitespaceMarkerFactory) GlossaryManager(org.omegat.gui.glossary.GlossaryManager) ReplaceMarker(org.omegat.gui.editor.mark.ReplaceMarker) NotesTextArea(org.omegat.gui.notes.NotesTextArea) IMainWindow(org.omegat.gui.main.IMainWindow) MainWindow(org.omegat.gui.main.MainWindow) IssuesPanelController(org.omegat.gui.issues.IssuesPanelController) ProtectedPartsMarker(org.omegat.gui.editor.mark.ProtectedPartsMarker) FontFallbackMarker(org.omegat.gui.editor.mark.FontFallbackMarker) SaveThread(org.omegat.core.threads.SaveThread) RemoveTagMarker(org.omegat.gui.editor.mark.RemoveTagMarker) CommentsTextArea(org.omegat.gui.comments.CommentsTextArea) ComesFromAutoTMMarker(org.omegat.gui.editor.mark.ComesFromAutoTMMarker) Segmenter(org.omegat.core.segmentation.Segmenter) TagValidationTool(org.omegat.core.tagvalidation.TagValidationTool) MatchesTextArea(org.omegat.gui.matches.MatchesTextArea) VersionCheckThread(org.omegat.core.threads.VersionCheckThread) GlossaryTextArea(org.omegat.gui.glossary.GlossaryTextArea) NotLoadedProject(org.omegat.core.data.NotLoadedProject) FilterMaster(org.omegat.filters2.master.FilterMaster) ISpellChecker(org.omegat.core.spellchecker.ISpellChecker) SpellChecker(org.omegat.core.spellchecker.SpellChecker) SegmentPropertiesArea(org.omegat.gui.properties.SegmentPropertiesArea) TransTipsMarker(org.omegat.gui.glossary.TransTipsMarker)

Aggregations

NotLoadedProject (org.omegat.core.data.NotLoadedProject)7 ProjectProperties (org.omegat.core.data.ProjectProperties)3 TagValidationTool (org.omegat.core.tagvalidation.TagValidationTool)3 IMainWindow (org.omegat.gui.main.IMainWindow)3 Before (org.junit.Before)2 EntryKey (org.omegat.core.data.EntryKey)2 SourceTextEntry (org.omegat.core.data.SourceTextEntry)2 Segmenter (org.omegat.core.segmentation.Segmenter)2 ISpellChecker (org.omegat.core.spellchecker.ISpellChecker)2 SpellChecker (org.omegat.core.spellchecker.SpellChecker)2 SaveThread (org.omegat.core.threads.SaveThread)2 FilterMaster (org.omegat.filters2.master.FilterMaster)2 CommentsTextArea (org.omegat.gui.comments.CommentsTextArea)2 DictionariesTextArea (org.omegat.gui.dictionaries.DictionariesTextArea)2 EditorController (org.omegat.gui.editor.EditorController)2 IEditor (org.omegat.gui.editor.IEditor)2 ComesFromAutoTMMarker (org.omegat.gui.editor.mark.ComesFromAutoTMMarker)2 FontFallbackMarker (org.omegat.gui.editor.mark.FontFallbackMarker)2 NBSPMarker (org.omegat.gui.editor.mark.NBSPMarker)2 ProtectedPartsMarker (org.omegat.gui.editor.mark.ProtectedPartsMarker)2