When the activationMode is set to custom, you have the flexibility to programmatically control the opening and closing of the plugin. This allows you to tailor the plugin’s behaviour according to the specific needs and conditions of your application.

Including the Plugin Script

You’ll receive your custom-built Script Tag from one of our team members. It will look like the example below. Ensure that you have included the plugin script in your HTML file. Add the provided <script> just before the closing </body> tag of your HTML:

<!-- Start of Signapse Web Translation Plugin Script Tag  -->
<script src="https://translations.signapsesolutions.com/" app-id="6aa07307-b2ce-4a48-a0d6-b6dd26f824f9" id="signapse"></script>
<!-- End of Signapse Web Translation Plugin Script Tag -->

Functions to Control the Plugin

The plugin exposes two global functions to control its visibility:

  • signapseMount(): Opens the plugin.
  • signapseUnmount(): Closes the plugin.

These functions are attached to the window object, so they can be called directly from your JavaScript code.

Example Usage

Here is an example of how to use these functions in your application:

<!DOCTYPE html>
<html>
<head>
    <title>My Application</title>
   
</head>
<body>
    <h1>Welcome to My Application</h1>
    <button onclick="signapseMount()">Open Plugin</button>
    <button onclick="signapseUnmount()">Close Plugin</button>
    <!-- Start of Signapse Web Translation Plugin Script Tag  -->
		<script src="https://translations.signapsesolutions.com/" app-id="6aa07307-b2ce-4a48-a0d6-b6dd26f824f9" id="signapse"></script>
		<!-- End of Signapse Web Translation Plugin Script Tag -->
</body>
</html>

JavaScript

You can also control the plugin through JavaScript based on your application logic. For example, you might want to open the plugin after a certain action or event.

// Example of opening the plugin after a specific action
function someActionHandler() {
    // Your application logic here
    signapseMount();
}

// Example of closing the plugin based on a condition
function someOtherActionHandler() {
    // Your application logic here
    signapseUnmount();
}

Important Considerations

  • Page Restrictions: The plugin will internally handle not appearing on pages that are not defined as allowed (not translated). If the signapseMount() or signapseUnmount() functions are invoked on these not allowed pages, they will silently fail and do nothing.
  • Session Persistence: Once the plugin is activated using signapseMount(), it will remain active for the duration of the session (until your web browser is closed) on all other “translated” pages until signapseUnmount() is called. This ensures that when navigating between translated pages, you automatically see the translation plugin open.

By following these instructions, you can effectively manage the visibility of the plugin in your application when using the custom activation mode.

Support

If you have any issues or questions, please contact us at marcus@signapse.ai.