« Linux Traduction Rapide » : différence entre les versions
Apparence
Page créée avec « ===Commande et Raccourci Clavier pour une Traduction Rapide === <syntaxhighlight lang="bash" line copy> sudo apt install translate-shell </syntaxhighlight> ==== Créez un script ~/scripts/traduire.sh: ==== <syntaxhighlight lang="bash" line> #!/bin/bash # Enregistrez ceci sous ~/traduire.sh # Récupère le texte du presse-papiers texte_copie=$(xclip -o -selection clipboard 2>/dev/null) # Vérifie si le presse-papiers est vide if [ -z "$texte_copie" ]; then... » |
Aucun résumé des modifications |
||
| Ligne 49 : | Ligne 49 : | ||
→ Désormais, copiez un texte et appuyez sur Super+T pour voir la traduction ! | → Désormais, copiez un texte et appuyez sur Super+T pour voir la traduction ! | ||
[[Catégorie:Linux | [[Catégorie:Linux]] [[Catégorie:Debian]] | ||
Version du 3 mai 2025 à 23:23
Commande et Raccourci Clavier pour une Traduction Rapide
sudo apt install translate-shell
Créez un script ~/scripts/traduire.sh:
#!/bin/bash
# Enregistrez ceci sous ~/traduire.sh
# Récupère le texte du presse-papiers
texte_copie=$(xclip -o -selection clipboard 2>/dev/null)
# Vérifie si le presse-papiers est vide
if [ -z "$texte_copie" ]; then
zenity --error --text="Le presse-papiers est vide !"
exit 1
fi
# Traduction et affichage
traduction=$(trans -b "$texte_copie" -t fr)
zenity --info --title="Traduction" --text="$traduction" --width=500
Rendez-le exécutable :
chmod +x ~/scripts/traduire.sh
Créer un alias
dans ~/.bashrc
alias traduire='bash /home/geo/scripts/traduire.sh'
→ Désormais, copiez un texte et dans le terminal, tapez :
traduire
Ajoutez un raccourci clavier
Paramètres → Clavier → Raccourcis personnalisés
Commande : bash -c '~/scripts/traduire.sh'
Raccourci : Super+T
→ Désormais, copiez un texte et appuyez sur Super+T pour voir la traduction !