Linux slogan
Visite também: Segurança Linux · BR-Linux.org · Dicas-L · Doode · NoticiasLinux · SoftwareLivre.org · UnderLinux



» Screenshot
Linux: Extreme Multimidia
Por davi182
» Login
Login:
Senha:

Se você ainda não possui uma conta, clique aqui.

Esqueci minha senha



Scripts

Linux user

Publicado por Cléber Ferreira Oliveira em 01/02/2006    [ 4966 hits ]

Login: texugo89, 19958 pontos

   


Descrição

Bom galera, eu estava navegando por ai, procurando coisas sobre Shell-Script e acabei me deparando com esse script aqui.

Este script é um tradutor multi-línguas (frontend para o Babel Fish), e é bem útil para efetuarmos traduções em modo texto (num terminal).

Galera, vale a pena conferir !

+ Informações no site:
http://faleiros.eti.br/translate

Vlw

[ Download: translate.sh ]   [ Enviar nova versão ]

[ Esconder código-fonte ]

  1   #!/bin/sh
  2   #
  3   # translate - Babel Fish front-end.
  4   # Copyright (C) 2006 Herbert Alexander Faleiros
  5   #
  6   # This program is free software; you can redistribute it and/or modify
  7   # it under the terms of the GNU General Public License as published by
  8   # the Free Software Foundation; either version 2 of the License, or
  9   # (at your option) any later version.
10   #
11   # This program is distributed in the hope that it will be useful,
12   # but WITHOUT ANY WARRANTY; without even the implied warranty of
13   # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   # GNU General Public License for more details.
15   #
16   # You should have received a copy of the GNU General Public License
17   # along with this program; if not, write to the Free Software
18   # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19   #
20   # Herbert Alexander Faleiros aka ratmmmam <herbert@faleiros.eti.br>
21   #
22
23   HOST=http://babelfish.altavista.com/tr
24   OPTS="-dump -source"
25
26   LNGS=`lynx $OPTS $HOST | grep option | sort -u | \
27           sed -r '1d;s/.+=\"(.+)/\\t\1/g;s/\">/ = /g;s/<.+//g'`
28
29   function translate() {
30
31           echo -n $i | sed -r 's/_.+//'
32           echo ": $2"
33
34           echo -n $i | sed -r 's/.+_//'
35           echo -n ": "
36
37           lynx $OPTS "$HOST?trtext=$2&lp=$1" | grep div | \
38               sed -r 's/(.+;>)(.+)(<\/d.+)/\2/' | sed -n 3p
39
40           exit 0
41   }
42
43   function usage() {
44
45           echo -e "\n  Usage: $0 lang_lang \"input text\""
46           echo "Example: $0 pt_en \"Feliz ano novo\""
47           echo -e "\n\tAvailable languages/possibilities:\n"
48           echo -e "$LNGS\n"
49
50           exit 1
51   }
52
53   [ "$2" = "" ] && usage
54
55   for i in `echo $LNGS | tr -s ' ' '\n' | sed -rn '/_/p'`; do
56           [ "$1" = "$i" ] && translate $1 "$2"
57   done
58
59   usage
60

Scripts recomendados
   Script Linux recomendado getdnsrouter
   Script Linux recomendado Autenticado Velox Empresarial II
   Script Linux recomendado lk
   Script Linux recomendado Criando uma lixeira p/ o usuário
   Script Linux recomendado Script simples para adicionar usuarios do djbdns

Comentários
[1] Comentário enviado por xfabi0x em 09/08/2006 - 11:03h:

Cara D+ esse script, vlw :D

[2] Comentário enviado por roddy em 28/06/2007 - 14:22h:

Muito legal!






Contribuir com comentário


  
Para executar esta ação você precisa estar logado no site, caso contrário, tudo o que for digitado será perdido.
Responsável pelo site: Fábio Berbert de Paula - Conteúdo distribuído sob licença GNU FDL
Site hospedado por:

Viva o Linux

A maior comunidade Linux da América Latina! Artigos, dicas, tutoriais, fórum, scripts e muito mais. Ideal para quem busca auto-ajuda em Linux.