README ¶
ldetect
Simple tool to run different command according to the language used in stdin.
Installation
The tool is available in the AUR:
yay -S ldetect
Otherwise, you can build it:
git clone https://git.sr.ht/~primalmotion/ldetect
cd ldetect
go install
Examples
This will use bat -n
to display "hello world"
$ echo "hello world" | ldetect --fr cat --en "bat -n"
This will use cat
to display "bonjour"
$ echo "bonjour" | ldetect --fr cat --en "bat -n"
You can use string substition to pass the content to stdin as a solid argument:
$ echo "bonjour" | ldetect --fr "echo le texte est: %s" --en "echo the text is: %s"
le texte est: bonjour
You can use the --detect
flag to simply print the detected language
based on a given candidates list:
$ echo "Hola" | ldetect --detect fr,en,es
spanish
I made this tool for text-to-speech so you can do something like:
wl-paste -p | ldetect \
--fr "mimic3 --voice fr_FR/m-ailabs_low" \
--en "mimic3 --voice en_US/hifi-tts_low"
This will use the correct voice based on the language of the content of the the primary clipboard.
Usage
Forwards stdin to different commands based on input language
Usage:
ldetect [flags]
Flags:
--af string Command to run if the text is in Afrikaans
--ar string Command to run if the text is in Arabic
--az string Command to run if the text is in Azerbaijani
--be string Command to run if the text is in Belarusian
--bg string Command to run if the text is in Bulgarian
--bn string Command to run if the text is in Bengali
--bs string Command to run if the text is in Bosnian
--ca string Command to run if the text is in Catalan
--cs string Command to run if the text is in Czech
--cy string Command to run if the text is in Welsh
--da string Command to run if the text is in Danish
--de string Command to run if the text is in German
--detect strings Just print the detected language from the list of candidates
--el string Command to run if the text is in Greek
--en string Command to run if the text is in English
--eo string Command to run if the text is in Esperanto
--es string Command to run if the text is in Spanish
--et string Command to run if the text is in Estonian
--eu string Command to run if the text is in Basque
--fa string Command to run if the text is in Persian
--fi string Command to run if the text is in Finnish
--fr string Command to run if the text is in French
--ga string Command to run if the text is in Irish
--gu string Command to run if the text is in Gujarati
--he string Command to run if the text is in Hebrew
-h, --help help for ldetect
--hi string Command to run if the text is in Hindi
--hr string Command to run if the text is in Croatian
--hu string Command to run if the text is in Hungarian
--hy string Command to run if the text is in Armenian
--id string Command to run if the text is in Indonesian
--is string Command to run if the text is in Icelandic
--it string Command to run if the text is in Italian
--ja string Command to run if the text is in Japanese
--ka string Command to run if the text is in Georgian
--kk string Command to run if the text is in Kazakh
--ko string Command to run if the text is in Korean
--la string Command to run if the text is in Latin
--lg string Command to run if the text is in Ganda
--lt string Command to run if the text is in Lithuanian
--lv string Command to run if the text is in Latvian
--mi string Command to run if the text is in Maori
--mk string Command to run if the text is in Macedonian
--mn string Command to run if the text is in Mongolian
--mr string Command to run if the text is in Marathi
--ms string Command to run if the text is in Malay
--nb string Command to run if the text is in Bokmal
--nl string Command to run if the text is in Dutch
--nn string Command to run if the text is in Nynorsk
--pa string Command to run if the text is in Punjabi
--pl string Command to run if the text is in Polish
--pt string Command to run if the text is in Portuguese
--ro string Command to run if the text is in Romanian
--ru string Command to run if the text is in Russian
--sk string Command to run if the text is in Slovak
--sl string Command to run if the text is in Slovene
--sn string Command to run if the text is in Shona
--so string Command to run if the text is in Somali
--sq string Command to run if the text is in Albanian
--sr string Command to run if the text is in Serbian
--st string Command to run if the text is in Sotho
--sv string Command to run if the text is in Swedish
--sw string Command to run if the text is in Swahili
--ta string Command to run if the text is in Tamil
--te string Command to run if the text is in Telugu
--th string Command to run if the text is in Thai
--tl string Command to run if the text is in Tagalog
--tn string Command to run if the text is in Tswana
--tr string Command to run if the text is in Turkish
--ts string Command to run if the text is in Tsonga
--uk string Command to run if the text is in Ukrainian
--ur string Command to run if the text is in Urdu
--vi string Command to run if the text is in Vietnamese
--xh string Command to run if the text is in Xhosa
--yo string Command to run if the text is in Yoruba
--zh string Command to run if the text is in Chinese
--zu string Command to run if the text is in Zulu
That's it.
Documentation ¶
There is no documentation for this package.
Click to show internal directories.
Click to hide internal directories.