/**************************************************************************
 OmegaT - Computer Assisted Translation (CAT) tool 
          with fuzzy matching, translation memory, keyword search, 
          glossaries, and translation leveraging into updated projects.

 Copyright (C) 2015-2019 Thomas Cordonnier
               Home page: http://www.omegat.org/
               Support center: http://groups.yahoo.com/group/OmegaT/

 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 3 of the License, or
 (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 **************************************************************************/

package org.omegat.core.machinetranslators.dummy;

import org.omegat.gui.editor.EditorUtils;

import org.omegat.gui.exttrans.IMachineTranslation;
import org.omegat.util.Language;

/**
 * Translates anything as identical to source. To be used for pseudo-translation
 * 
 * @author Thomas Cordonnier
 */
public class SourceTranslate implements IMachineTranslation {

	private boolean withGlos = false;

	public SourceTranslate() {}
	
	public SourceTranslate(boolean withGlos) { this.withGlos = withGlos; }
	
    public String getName() {
        return "Source" + (withGlos ? " with glossaries" : "");
    }

    public String getTranslation(Language sLang, Language tLang, String text) {
        if (! withGlos) return text;
        return EditorUtils.replaceGlossaryEntries(text);
    }

}
