Package ghidra.app.services
Interface StringTranslationService
public interface StringTranslationService
Interface for providing string translating services.
Implementations of this interface are usually done via a Plugin
and then registered via Plugin
's registerServiceProvided().
Consumers of this service should expect multiple instance types to be returned from
PluginTool.getServices(Class)
, and should add a service listener via
PluginTool.addServiceListener(ghidra.framework.plugintool.util.ServiceListener)
if service instances are retained to be notified when service instances are changed.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final record
Options that are given by the callers oftranslate(Program, List, TranslateOptions)
. -
Method Summary
Modifier and TypeMethodDescriptionstatic HelpLocation
createStringTranslationServiceHelpLocation
(Class<? extends Plugin> pluginClass, StringTranslationService sts) Helper that creates aHelpLocation
based on the plugin and sts.static List
<StringTranslationService> Returns a sorted list of the currently enabled StringTranslationService service providers.default HelpLocation
Returns theHelpLocation
instance that describes where to direct the user for help when they hit f1.Returns the name of this translation service.void
translate
(Program program, List<ProgramLocation> stringLocations, StringTranslationService.TranslateOptions options) Requests this translation service to translate the specified string data instances.
-
Method Details
-
getCurrentStringTranslationServices
Returns a sorted list of the currently enabled StringTranslationService service providers.- Parameters:
tool
-PluginTool
- Returns:
- sorted list of currently enabled StringTranslationServices
-
getTranslationServiceName
String getTranslationServiceName()Returns the name of this translation service. Used when building menus to allow the user to pick a translation service.- Returns:
- string name.
-
getHelpLocation
Returns theHelpLocation
instance that describes where to direct the user for help when they hit f1.- Returns:
HelpLocation
instance or null.
-
translate
void translate(Program program, List<ProgramLocation> stringLocations, StringTranslationService.TranslateOptions options) Requests this translation service to translate the specified string data instances.The implementation generally should not block when performing this action.
- Parameters:
program
- the program containing the data instances.stringLocations
-List
of string locations.options
-StringTranslationService.TranslateOptions
-
createStringTranslationServiceHelpLocation
static HelpLocation createStringTranslationServiceHelpLocation(Class<? extends Plugin> pluginClass, StringTranslationService sts) Helper that creates aHelpLocation
based on the plugin and sts.- Parameters:
pluginClass
- Plugin that provides the string translation servicests
-StringTranslationService
- Returns:
- HelpLocation with topic equal to the plugin name and anchor something like "MyTranslationServiceName_String_Translation_Service".
-