Tuesday, April 24, 2007

How to implement the Babylon dictionaries in Ubuntu?

Have you missed the Babylon program under windows , with all those good dictionaries?
here I will tell you how to make Babylon dictionaries work under ubuntu .

StarDict works like Babylon it is resident in memory , you select the word and it will show the definition in a small pop-up window fastly, ofcourse you can change the keys . (I changed it so when I press WIN key it show me the definition of the selected word) you can install StarDict using synaptic package manager easily .

How to make the Babylon dictionaries work in ubuntu(stardict)?
they have some dictionaries on StarDict site but compared to Babylon dictionaries they are so few.. first go to Babylon site and download the dictionary which you want to use , (I download Kurdish and Farsi ones)

Now we should convert the downloaded dictionary to StarDict format ,
there is a program named dictconv , to convert dictionary formats to each other (including Babylon to StarDict)

here we go :
1- download dictconv here . you should install it by source (don't loose your pants , it is not hard)

2-Extract the zipped file which you downloaded , somewhere in your desktop .
3-Before we continue , open synaptic package manager and install "libxml2-dev" as it is needed for our program .

then go to the folder on the desktop
cd dictconv
4-then enter this :
sudo ./configure
5- if the previous thing was done without any error continue , if it gave you error , (it usualy tells you , you need to install something) solve the error and continue :
sudo make all install
Now it is installed ! but we still need another program
again go to synaptic package manager and install "dictzip".

now here we go to convert the bayblon dictionary : for example mine is Farsi.BGL
I copy it to the desktop then
cd Desktop
dictconv Farsi.BGL -o Farsi.ifo

in this example Farsi.BGL is the one which I downloaded from Babylon site and Farsi.ifo is the name of the output file which I want to make .

if you have done it successfully ,it should generate 3 files !

one of those 3 generated files is Farsi.dict (Farsi in my case)
now we should do this :
dictzip Farsi.dict
this command changes our .dict file to .dz !

now we should have three files
create a folder on your desktop and move these 3 files to that folder .
and move those generated files to there , in my case I created Farsi in desktop and moved them
to the Farsi folder .

now we should move the whole things to the StarDict folder
sudo mv Farsi /usr/share/stardict/dic

and now I restart the StarDict and click on the "manager dictionaries" (it is in the Right Bottom corner of the window) and Enable the Farsi dictionary.

Thats all folks . I am enjoying Babylon dictionry under ubuntu !


cj said...

Hey man, great guide - thanks!

I have a little stardict problem that you maybe can help me with though. Everything works like it should - have installed 2 dictionaries following your guide, and they work in the main query window.

However the floating lookup thing that appears when I hold the scan-key down always just say '<not found>' on _every_ word, even the most trivial ones.

Do you have any idea of how I can fix this?

Shewdiz said...

hey does it happen always ? or it is just sometimes ?

cj said...

it happens always when I highlight a word and press the stardict scan key.
but everything does work fine when I use the regular query window directly.

one other question; in the query window, when I type in a word, a lot of the suggested words gets suffixed with a number within $-signs.
any idea on how to get rid of those?

ex: 'word' -> suggested 'wordiness$92420$'

Thanks man! :)

Shewdiz said...

in manage dictionaries Disable and Re-Enable your dictionaries ,
and in prefreneces change the settings that may help !

but let me tell you something, some dictionaries are not in standard format so when you convert it, there would be Errors in it , you have two ways
1- convert them to standard format manualy by yourself

2- find another dictionary , and try another dictionary,

that should help 1

Anonymous said...

Hi Shewdiz,

thanks for this great tutorial. I followed it and I have english-spanish-english dictionaries on my computer. Just one thing, maybe you know it... I get a lot of word listed with strange number at the end , just like this: pigheaded$60836$. Do you know why this happens and how to correct it?

Thank you in advance...

cj said...

Tried restarting and that - doesn't help unfortunately.
I'll look and see if I can see if the word$13123$ problem stems from some weird characters still being in the dictionaries perhaps.
I'll let you (or your blog at least) know if I find anything :)


Jan said...

How to install c++, cc, cxx and so on? I can't find the proper packages in Synaptic. Please write that down and give the broader picture to the none-programmer Ubuntu user.

checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking for g++... no
checking for c++... no
checking for gpp... no
checking for aCC... no
checking for CC... no
checking for cxx... no
checking for cc++... no
checking for cl... no
checking for FCC... no
checking for KCC... no
checking for RCC... no
checking for xlC_r... no
checking for xlC... no
checking for C++ compiler default output file name... configure: error: C++ compiler cannot create executables
See `config.log' for more details.

Jan said...

My email is jan.ekbom@gmail.com

Anonymous said...

Hi Shevin, tnx a lot for your guide.

Hi Jan.

Synaptec Package Manager, and search g++, and install it, after that try it pls. i hope that the error will disappear. good luck

my email is muugii_gal@yahoo.com

Anonymous said...

Nice guide! Unfortunately, I have the same problem as cj when using Babylon-English-English.BGL dictionary.

Hope dictconv gets better in the near future.


Xenith said...

Special tx for ur guide :)

Anonymous said...

Ian, I had to install an incredible amount of software to succeed. Install fortran, and in particularly do not forget xml2 DEV (devel packages).

Anonymous said...

Salaam doctor..

I've installed the dictionary as well as some packages form the babylon website.

The problem is stardict does not translate anything.. it just lists all available words and thats it...

any idea?

did I miss anything?

nqsonk9 said...

What a guide, nice work, man.
Thanks a lot :)

W_Shark said...

Hi Shevin!
I tried to do as you said but at last step when I try convert dictionary from .BLG to .ifo I get the next error message : Segmentation fault (core dumped)

Do you have any suggestion what reason for this ?

Tmantiko said...

very nice guide.

I was wondering whether you found it possible to bind a keyboard shortcut to translate selected text (as in babylon)?

keinome said...

hey there, very clear, but i only want to install arabic and portuguese dictionaries for example, on a patched version of babylon.so, what do i do, i go on the babylon site and install them, ok, but when i return to the software, the .bgl's don`t quite work, actually don`t work at all.
please, i really need this program, HEEELP me please.

Anonymous said...

You are the guy, I've looked many years a software to convert .bgl to other format, like stardict. Thank you very much!
I had the same problem with word$94944$ and I think that it could easily fixed, maybe. I think the problem is in the .idx files. I still didn't look the source code but I imagine that when you are generating the .idx you could check the 'word$448484$' patern and fix it to 'word'.
Thank you again! ;-)

eliocha said...

Hi, I have installed English Hebrew babylon dictionary but for some reason I'm getting jybrish instead of Hebrew, what can I do?

RedBlue said...

There is an easy (not so elegant) way to tackle the word$12345$ problem. Just convert as usual the .bgl dictionary to plain text .dic. Open it in Open Office Writer, in “find and replace” dialog, check “Regular expression” and use \$[:digit:]*\$ for replacing all the occurrences of $12345$.
Save and use the stardict-editor tool for building stardict dictionary from plain text file (“tab file” in stardict terminology). stardict-editor comes with stardict-tools package.
Next, dictzip the .dict file and move to stardict share directory as usuall.


florian said...

I fixed the bug with the dollar sign words, and the problem that it does not recognize some simple words.

If you want to have that version, please write me to my gmail-accout, username is florian.bw.

I will try to contact the dictconv author and put it online somewhere when I have time.

Bast, Florian

florian said...

For those who dont want to wait, here some small instructions:

1) wget http://mattneri.altervista.org/files/dictconv-0.2.1.tar.gz
(there are some other bugs fixed in that file, dunno if they influence the outcome)
2) unzip file
3) gedit src/babylonreader.cpp
4) after while( entry.headword != "" )
(line 52) insert

int pos = entry.headword.find_first_of('$');
if (pos > 0)
entry.headword = entry.headword.substr(0,pos);

5) done! ./configure && make && sudo make install

Ahmad said...

Have you tried to convert "hfarsi advanced"?
It gives me the error: "Error opening hfarsi.bgl"
Hfarsi is a really great English to Farsi dictionry and It would be so nice to have it also in stardic.
If you could convert it, please let me know.
Thanks, Ahmad.

Anonymous said...

Hmmm probably obvious to others but make sure you use the correct directory names in your native language. Desktop = Skrivbord in Swedish ahhh.

Marcio Wesley Borges said...

Hey, man. Thank you for posting your help. It aid me.

Marcio Wesley Borges

Grissino said...

Thank you very much for your help!

Anonymous said...

Thanks for the help...great tutorial.

Anonymous said...

you are great !

how can I install Farsi font for the dictionary?

Anonymous said...

thank you.

ytaggs said...

I used your guide in one on my computers and it worked perfectly, nevertheless in another one i did the same thing but stardict cant see the dictionaries, i mean they are in /usr/share/stardict/dics but when i open stardict and go to manage dictionaries they are not there... what can i do?

my email is t4ggs@yahoo.com

thank u.

Amin said...

The Deb package is in debian ftp archive:

Babak said...

fantastic tutorial.

Thanks Thanks and thanks again :D

Nayak said...

Thanks for your Lucidly explained Tutorial. I am able to install all of my Dictionary.
A very good tutorial for beginners.

Anonymous said...

hi need help:
./configure went well no errors
but when i do sudo make all install
i get this output:
babylon.cpp: In member function ‘bool Babylon::open()’:
babylon.cpp:53: error: ‘memcmp’ was not declared in this scope
babylon.cpp: In member function ‘void Babylon::convertToUtf8(std::string&, uint)’:
babylon.cpp:349: error: ‘memset’ was not declared in this scope
make[2]: *** [babylon.o] Error 1
make[2]: Leaving directory `/home/usr/apps/dictconv-0.2/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/usr/apps/dictconv-0.2'
make: *** [all] Error 2

any ideas anyone? please :)

Anonymous said...

Online Pharmacy for Cialis, Levitra, Tamiflu, Viagra. Order Generic Medication In own Pharmacy. Buy Pills Central.
[url=http://buypillscentral.com/buy-generic-viagra-online.html]Purchase Cheap Viagra, Cialis, Levitra, Tamiflu[/url]. rx generic pills. Cheap drugs pharmacy

Liviu said...

thanks man!

Anonymous said...

I wrote an article about this subject including instructions on fixing the bug with the dollar sign based on the fix posted by florian (thanks florian!). It also gives a solution to the 'memset' error posted by Anonymous. You can find my article here: http://saibot.no-ip.info/wiki/Babylon_dictionaries_and_Linux

Also I wouldn't be able to write the article without this guide. Thanks!

Cleber said...

thank you all so much for sharing this solution... especially medya, pereira serrano and florian =]

Anonymous said...


I wonder if the converting is possible in windows?! (can I convert babylon to stardict on windows!) if it's possible pls could u send a step by step tutorial for that or a short discription?

In case it's not possible to do the convertin in windows could u pls convet the below dictionaries and upload them for me, really appreciate it.

1. Swedish-Persian/Persian- Swedish
2. English-Swedish/Swedish-English
3. hFarsi advanced

Pls e-mail to m_rabee2002@hotmail.com

Thanx in advance

Anonymous said...

Free arrest records search

Jan van der Mooren said...

Really great, clear way of explaining! Thx a lot.

Anonymous said...

I'm experiencing a problem with converted Russian dictionaries. Seems that Babylon does not know what Unicode encoding is.

Hamze said...

thank you. it worked very well.

AliNa said...

Really useful. Thanks a lot.
Just one problem I have with some dictionaries is that Stardict doesn't support rich text and the codes for make "bold" text or a link.



computer (48) ubuntu (46) linux (28) tutorial (20) opinion (17) programming (14) software overview (13) terminal (12) troubleshooting (8) life (7) literature (7) poem (7) human languages (6) vim (6) bash (5) google (5) python (5) android (4) cars (4) phpBB (4) suggestion (4) tips (4) 12.04 (3) Chef (3) extension and addons (3) firefox (3) java (3) personal (3) russian (3) shell (3) windows (3) 64bit (2) Calligraphy (2) Chicago (2) Vagrant (2) apple (2) backup (2) bug (2) code (2) eclipse (2) funny (2) google chrome (2) idea (2) monitor (2) php (2) phpBB3 (2) shorter prompt (2) ssh (2) virtualbox (2) $_SERVER['REQUEST_URI'] (1) 2.7 (1) ALT+Backspace (1) AVR (1) Alt-Printscreen-K (1) AutoRotate (1) CTRL+ALT+DELETE (1) DRM (1) Debugging (1) Gimp (1) Gimp 2.8 (1) Microcontroler (1) Restart X (1) UML (1) Ventra (1) adsense (1) amazon (1) audio (1) aws (1) background process (1) battery (1) bing (1) blank (1) blogging (1) bmw (1) boot (1) business review (1) car (1) cd (1) chrome (1) comcast (1) computer kubuntu (1) conference (1) cookie (1) cron (1) database (1) date (1) display (1) domain name (1) download manager (1) dual boot (1) dual monitor (1) extensions (1) feature request (1) file (1) folder (1) freeze (1) gimp single window (1) git (1) gnome 3.10 (1) google docs (1) google plust (1) google+ (1) grep (1) icon (1) install (1) iterator (1) links (1) linu (1) linux links (1) list (1) mac os (1) media server (1) microsoft (1) moonlight (1) music (1) mysql (1) name (1) nautilus (1) netflix (1) notepad++ (1) parking (1) permission (1) philosophy (1) photo (1) prompt (1) protest (1) ps3mediaserver (1) putty (1) read from file (1) realtek (1) resolution (1) roku (1) samsung (1) scala (1) screenshot (1) security (1) selinux (1) server (1) skype (1) space (1) spam (1) spambot (1) sql (1) suspension (1) system monitor (1) tar (1) task manager (1) template design (1) th23 domain (1) thinking (1) ubuntu 13.10 (1) unity (1) vimrc (1) virtual machine (1) weblogic (1) wget (1) with space (1) xorg (1) xrand (1)