SkillsGrove
SkillsGrove/Productivité/JAICHANGPARK/flutter_gemini_live/gemini-live-translate

gemini-live-translate

Installation

$npx skills add https://github.com/JAICHANGPARK/flutter_gemini_live --skill gemini-live-translate
$git clone --depth 1 https://github.com/JAICHANGPARK/flutter_gemini_live.git /tmp/flutter_gemini_live && mkdir -p ~/.claude/skills && cp -r /tmp/flutter_gemini_live/.hermes/skills/gemini-live-translate ~/.claude/skills/gemini-live-translate
Installe pour moi cette Agent Skill : https://github.com/JAICHANGPARK/flutter_gemini_live/tree/8e51a205f69168cc37834c8b0193c83a9f270f5c/.hermes/skills/gemini-live-translate — lis d’abord son SKILL.md et ses scripts, et ne l’installe dans mon dossier de compétences qu’après avoir vérifié qu’elle est sûre.

Résumé

Description d’origine · BSD-3-ClauseImplement real-time, bidirectional speech-to-speech translation in Flutter using the Gemini Live Translate model. Use when connecting to gemini-3.5-live-translate-preview, configuring TranslationConfig (targetLanguageCode, echoTargetLanguage), or building dual-sided/split-screen interpreter UI applications.
Le SKILL.md ci-dessous est reproduit depuis JAICHANGPARK/flutter_gemini_live (commit 8e51a20) sous licence BSD-3-Clause. Le texte est inchangé ; seules les métadonnées d’en-tête du fichier sont omises, les images sont affichées sous forme de liens et les fichiers très longs sont tronqués. Copyright 2025, Dreamwalker. Licence : LICENSE. Seul le fichier d’instructions est affiché ; consultez le dépôt d’origine pour les éventuels scripts.

Gemini Live Speech-to-Speech Translation Skill

This skill provides instructions for building real-time, low-latency live speech translation applications using Google's dedicated Live Translate model (gemini-3.5-live-translate-preview).


🌐 Model & Translation Configuration

The Live translation model operates as a streaming audio-in, audio-out interpreter:

Parameter Recommended Value Notes
Model ID gemini-3.5-live-translate-preview (LiveModels.gemini35LiveTranslatePreview) Dedicated streaming translation model.
targetLanguageCode BCP-47 tag (e.g., 'es', 'ja', 'ko', 'fr') Language to translate the speaker's voice into.
echoTargetLanguage false (default) If true, repeats the spoken target text before playing translation.
Response Modalities [Modality.AUDIO] Audio output containing the translated voice.

🚀 Setting Up Live Translation Session

import 'package:flutter/material.dart';
import 'package:gemini_live/gemini_live.dart';

Future<void> connectTranslator({
  required GeminiLiveSessionController controller,
  required String targetLanguage, // e.g. 'es' (Spanish), 'ko' (Korean)
  GeminiLiveVoice voice = GeminiLiveVoice.puck,
}) async {
  await controller.connect(
    LiveConnectParameters(
      model: LiveModels.gemini35LiveTranslatePreview,
      config: GenerationConfig(
        responseModalities: [Modality.AUDIO],
        speechConfig: SpeechConfig.fromLiveVoice(voice),
        // Live speech-to-speech translation settings
        translationConfig: TranslationConfig(
          targetLanguageCode: targetLanguage,
          echoTargetLanguage: false,
        ),
      ),
      // Transcribe both user speech and translated model speech
      inputAudioTranscription: AudioTranscriptionConfig(),
      outputAudioTranscription: AudioTranscriptionConfig(),
      callbacks: LiveCallbacks(
        onError: (e, st) => debugPrint('Translation Error: $e'),
      ),
    ),
  );
}

📱 Face-to-Face Dual-Sided UI Pattern

For in-person conversations where two people sit across from each other, render a split screen where the top half is flipped 180 degrees for the counterparty:

Widget buildSplitScreenInterpreter(BuildContext context, GeminiLiveSessionController controller) {
  return Column(
    children: [
      // 1. Counterparty Screen (Rotated 180 degrees)
      Expanded(
        child: RotatedBox(
          quarterTurns: 2, // 180 degree flip for person sitting opposite
          child: Container(
            color: Colors.blueGrey.shade900,
            padding: const EdgeInsets.all(20),
            child: Center(
              child: Text(
                controller.lastModelText ?? 'Listening for counterparty...',
                style: const TextStyle(fontSize: 22, color: Colors.white),
                textAlign: TextAlign.center,
              ),
            ),
          ),
        ),
      ),

      const Divider(height: 2, thickness: 2, color: Colors.amber),

      // 2. User Screen (Normal Orientation)
      Expanded(
        child: Container(
          color: Colors.grey.shade900,
          padding: const EdgeInsets.all(20),
          child: Center(
            child: Text(
              controller.lastUserText ?? 'Speak to translate...',
              style: const TextStyle(fontSize: 22, color: Colors.white),
              textAlign: TextAlign.center,
            ),
          ),
        ),
      ),
    ],
  );
}

🚨 Critical Translation Rules

  1. Always use the dedicated Translate model: Do not use standard gemini-3.8-live with a translation prompt if gemini-3.5-live-translate-preview is available. The dedicated translate model has specialized low-latency streaming pipeline optimizations.
  2. Handle target language switches dynamically: When users switch conversational directions (e.g. English -> Korean to Korean -> English), reconnect with the updated targetLanguageCode.
Voir le texte intégral de la licence (BSD-3-Clause)
BSD 3-Clause License

Copyright (c) 2025, Dreamwalker

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
   list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
   this list of conditions and the following disclaimer in the documentation
   and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
   contributors may be used to endorse or promote products derived from
   this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.