/** @odoo-module **/

import {_t} from "@web/core/l10n/translation";
import {browser} from "@web/core/browser/browser";
import {registry} from "@web/core/registry";
import {routeToUrl} from "@web/core/browser/router";

function leaveTranslateMode({env}) {
    return {
        type: "item",
        description: _t("Leave the Translate Tools"),
        callback: () => {
            const route = env.services.router.current;
            route.search.translate = "";
            browser.location.href = browser.location.origin + routeToUrl(route);
        },
        sequence: 450,
    };
}

registry.category("translate").category("default").add("leaveTranslateMode", leaveTranslateMode);
