chromium/chrome/services/on_device_translation/public/mojom/on_device_translation_service.mojom

// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module on_device_translation.mojom;

import "chrome/services/on_device_translation/public/mojom/translator.mojom";
import "sandbox/policy/mojom/sandbox.mojom";

// The service that provides translation capabilities through
// various implementation.
// TODO(https://crbug.com/340778819): fix the sandbox type as we cannot load the
// library from sandbox.
[ServiceSandbox=sandbox.mojom.Sandbox.kNoSandbox]
interface OnDeviceTranslationService {
  // Binds the receiver to a `Translator` implementation that could
  // do translation from `source_lang` to `target_lang`.
  CreateTranslator(
    string source_lang, string target_lang,
    pending_receiver<Translator> receiver
  ) => (bool is_sucessful);

  // Returns if the service could translate text from `source_lang` to
  // `target_lang`.
  CanTranslate(string source_lang, string target_lang) => (bool can_stranslate);
};