Package org.omegat.core.dictionaries
Class StarDict
- java.lang.Object
-
- org.omegat.core.dictionaries.StarDict
-
- All Implemented Interfaces:
IDictionaryFactory
public class StarDict extends java.lang.Object implements IDictionaryFactory
StarDict Dictionary support.StarDict format described on https://github.com/huzheng001/stardict-3/blob/master/dict/doc/StarDictFileFormat
A StarDict dictionary plugin uses stardict4j access library. Every dictionary consists of these files:
- somedict.ifo
- somedict.idx or somedict.idx.gz
- somedict.dict or somedict.dict.dz
- somedict.syn (optional)
-
-
Constructor Summary
Constructors Constructor Description StarDict()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isSupportedFile(java.io.File file)
Determine whether or not the supplied file is supported by this factory.IDictionary
loadDict(java.io.File file)
Load the given file and return anIDictionary
that wraps it.IDictionary
loadDict(java.io.File file, Language language)
Load the given file and return anIDictionary
that wraps it.static void
loadPlugins()
Plugin loader.static void
unloadPlugins()
Plugin unloader.
-
-
-
Method Detail
-
loadPlugins
public static void loadPlugins()
Plugin loader.
-
unloadPlugins
public static void unloadPlugins()
Plugin unloader.
-
isSupportedFile
public boolean isSupportedFile(java.io.File file)
Description copied from interface:IDictionaryFactory
Determine whether or not the supplied file is supported by this factory. This is intended to be a lightweight check, e.g. looking for a file extension.- Specified by:
isSupportedFile
in interfaceIDictionaryFactory
- Parameters:
file
- The file to check- Returns:
- Whether or not the file is supported
-
loadDict
public IDictionary loadDict(java.io.File file) throws java.lang.Exception
Description copied from interface:IDictionaryFactory
Load the given file and return anIDictionary
that wraps it. Deprecated; useIDictionaryFactory.loadDict(File, Language)
instead.- Specified by:
loadDict
in interfaceIDictionaryFactory
- Parameters:
file
- The file to load- Returns:
- An IDictionary file that can read articles from the file
- Throws:
java.lang.Exception
- If the file could not be loaded for reasons that were not determined byIDictionaryFactory.isSupportedFile(File)
-
loadDict
public IDictionary loadDict(java.io.File file, Language language) throws java.lang.Exception
Description copied from interface:IDictionaryFactory
Load the given file and return anIDictionary
that wraps it. The supplied file is guaranteed to have returned true fromIDictionaryFactory.isSupportedFile(File)
.- Specified by:
loadDict
in interfaceIDictionaryFactory
- Parameters:
file
- The file to loadlanguage
- The language of the dictionary's index (e.g. English for an English-French dictionary)- Returns:
- An IDictionary file that can read articles from the file
- Throws:
java.lang.Exception
- If the file could not be loaded for reasons that were not determined byIDictionaryFactory.isSupportedFile(File)
-
-