Package ghidra.program.util

# Class LanguageTranslatorFactory

java.lang.Object
ghidra.program.util.LanguageTranslatorFactory

public class LanguageTranslatorFactory extends Object
`LanguageTranslatorFactory` manages all language translators within Ghidra. Language translators support either a version translation for a single language, or a language transition from one language to another. The following types of translators are supported:

- Simple translators are established based upon a translator XML specification file (*.trans).
- Explicit translators are class implementations of the LanguageTranslator interface. The abstract LanguageTranslatorAdapter has been supplied for this purpose so that default mappings can be used if needed. Such custom translator classes should not be created within the 'ghidra.program.util' package since they will be ignored by the factory.
- Default translators can be instantiated for languages whose address spaces map to one-another. Such default translations may be lossy with register mappings and could result in lost register variables and references.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `LANGUAGE_TRANSLATOR_FILE_EXT`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `LanguageTranslator`
  `getLanguageTranslator(LanguageID languageName, int majorVersion)`
  Returns a language translation for a language version which is no longer supported.
  `LanguageTranslator`
  `getLanguageTranslator(Language fromLanguage, Language toLanguage)`
  Returns a language translator for the transition from an oldLanguage to a newLanguage.
  `static LanguageTranslatorFactory`
  `getLanguageTranslatorFactory()`
  Returns the single instance of the OldLanguageFactory.
  `static void`
  `registerLanguageTranslatorFactoryMinion(LanguageTranslatorFactoryMinion minion)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### LANGUAGE_TRANSLATOR_FILE_EXT

    public static final String LANGUAGE_TRANSLATOR_FILE_EXT
    See Also:
      - Constant Field Values

- ## Method Details

  - ### registerLanguageTranslatorFactoryMinion

    public static void registerLanguageTranslatorFactoryMinion(LanguageTranslatorFactoryMinion minion)

  - ### getLanguageTranslatorFactory

    public static LanguageTranslatorFactory getLanguageTranslatorFactory()
    Returns the single instance of the OldLanguageFactory.

  - ### getLanguageTranslator

    public LanguageTranslator getLanguageTranslator(Language fromLanguage, Language toLanguage)
    Returns a language translator for the transition from an oldLanguage to a newLanguage. The toLanguage may be a different language or a newer version of fromLanguage.
    Parameters:
      `fromLanguage` - old language
      `toLanguage` - new language
    Returns:
      language translator if transition is supported, otherwise null is returned.

  - ### getLanguageTranslator

    public LanguageTranslator getLanguageTranslator(LanguageID languageName, int majorVersion)
    Returns a language translation for a language version which is no longer supported.
    Parameters:
      `languageName` - old unsupported language name
      `majorVersion` - language major version within program
    Returns:
      language translator if one can be determined, otherwise null is returned.