You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by ni...@apache.org on 2015/08/01 19:39:40 UTC

svn commit: r1693746 - /tika/trunk/tika-core/src/main/java/org/apache/tika/language/translate/EmptyTranslator.java

Author: nick
Date: Sat Aug  1 17:39:40 2015
New Revision: 1693746

URL: http://svn.apache.org/r1693746
Log:
Empty Translator, similar to the ones for Parser and Detector, for use in testing etc

Added:
    tika/trunk/tika-core/src/main/java/org/apache/tika/language/translate/EmptyTranslator.java

Added: tika/trunk/tika-core/src/main/java/org/apache/tika/language/translate/EmptyTranslator.java
URL: http://svn.apache.org/viewvc/tika/trunk/tika-core/src/main/java/org/apache/tika/language/translate/EmptyTranslator.java?rev=1693746&view=auto
==============================================================================
--- tika/trunk/tika-core/src/main/java/org/apache/tika/language/translate/EmptyTranslator.java (added)
+++ tika/trunk/tika-core/src/main/java/org/apache/tika/language/translate/EmptyTranslator.java Sat Aug  1 17:39:40 2015
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tika.language.translate;
+
+/**
+ * Dummy translator that always declines to give any text. Useful as a 
+ * sentinel translator for when none others are available.
+ * for unknown document types.
+ */
+public class EmptyTranslator implements Translator {
+    public String translate(String text, String sourceLanguage, String targetLanguage) {
+        return null;
+    }
+
+    public String translate(String text, String targetLanguage) {
+        return null;
+    }
+
+    public boolean isAvailable() {
+        return true;
+    }
+}