New user registration is currently disabled due to spam abuse / Регистрация новых пользователей в настоящее время приостановлена из-за злоупотреблений спаммерами

Brief Tutorial: Creating Mdict (mdx) dictionaries

General discussion

Brief Tutorial: Creating Mdict (mdx) dictionaries

Postby medwatt » Fri Aug 22, 2014 12:57 am

Hello,
For as long as I can remember creating dictionaries, they've been in the Abbyy Lingvo format, DSL. For one, DSL dictionaries are really easy to create, test and edit as there is no need to compile. However, due to this simplicity it is profoundly lacking in features that makes creating sophisticated looking dictionaries impossible. Don't get me wrong, DSL is great for pure text-based dictionaries with a flat homogenous structure. I looked into other formats and came across DSLGD; a fork extension of DSL by a Russian programmer. Although DSLGD appears to have all the possible extensions that one might need in DSL, it lacks a community behind it and DSLGD dictionaries are not supported by the standard Goldendict software. So why bother !!
Comes Mdict. Mdict is the answer to all my woes. Its supported by the desktop version of Goldendict, is based on HTML for structure and CSS for design and has a large, active community. With a few adjustments, anyone with knowledge in HTML can immediately create Mdict dictionaries. The problem is that Mdict doesn't seem to have a documentation anywhere (at least I couldn't find one) and its Chinese based. I have been creating Mdict dictionaries for the past few days after hours of wading through google-translated Chinese websites. This short tutorial will get you started creating mdx dictionaries in no time. I have decided to be deliberately verbose to make it possible for anyone to understand, irrespective of their skills. So, here are the steps in creating an mdx dictionary:
___________-
1. The structure is HTML based meaning I don't have to explain what the tags are for. There is no need for tags like <html>, <boby>, <title>. Just use tags that usually go inside the <body> tag like <p>, <br>, <div> etc.

2. Every article is considered an HTML page of itself beginning with the headword and ending with </>, each on a line of their own. </> denotes the end of the article. You can use any tag whilst structuring the contents of the article.
Code: Select all
word1
<br>Article content goes here
</>
word2
<br>Article content goes here
</>

3. If the code above is used, when looking-up word1, word1 will not be displayed with its article. Only the article is displayed. For word1 to be displayed you need to add it to the start of the article line.
Code: Select all
word1
<b>word1</b><br>Article content goes here
<b>

4. CSS can either be inline, internal or external as usual. Since each article is considered a HTML page of itself, a style in one article is only for that article. So, for a particular style to be applied to every article, every article must have the style declared between its headword and </>. Hence, for a dictionary of 100,000 words the style has to be duplicated 100,000 times inside all of the articles. Its obvious that one should not use internal styles except when that style is specific to a few articles. Therefore, write all your styles to an external stylesheet and then link the article to it. For an external stylesheet to apply to every article, every article must have a link to the external stylesheet:
Code: Select all
word1
<link rel="stylesheet" type="text/css" href="styleName.css" />
<br>Article content goes here
</>
word2
<link rel="stylesheet" type="text/css" href="styleName.css" />
<br>Article content goes here
</>

5. DSL used to give me headaches when providing references to other headwords because in DSL both the link and what is displayed are the same. So in DSL, if a headword is "DICTIONARY" and in another article there's a word "DICTIONARIES" and you want to provide a link to the "DICTIONARY", it can't be done unless you create another entry "DICTIONARIES" with identical content. As mdx is HTML based, the issue is non-existent. Here's how you can reference another headword:
Code: Select all
<a href="entry://headword">text_that_is displayed</a>

6. In case two headwords somehow happen to have the same content, just provide @@@LINK=headword instead of the duplicating the article. For example
Code: Select all
dictionaries
@@@LINK=dictionary
</>

7. Images and sounds can be added just the regular HTML way. For example, adding an image:
Code: Select all
<img src="filename"></img>

8. Most other HTML stuff work the same way. For the CSS file, everything is as expected with the exception that the first line of the CSS file must be left blank, otherwise the dictionary won't compile.

9. Now that your dictionary file is ready, it should be saved in .txt and the CSS in .css. The CSS file must be placed in an empty folder which will serve as the root folder for the dictionary. Within this folder, images, sounds, if used, are to be placed. If you prefer, you can create an "IMAGES" folder (or whatever) within this root folder and group all your image files in there. Since the images are no longer in the root folder, the image link must be changed to signify the new location as such: <img src="IMAGES/filename"></img>.

10. To combine everything, go to http://www.octopus-studio.com/download.en.htm and download MdxBuilder. There's also an Mdict viewer available (in the same site) in case you want don't want to use Goldendict. Mdict uses WebBrowser Control as it's HTML Viewer meaning that the display on Mdict viewer depends on the version of internet explorer installed. So if you're using some CSS3 elements and your installed IE doesn't support them, they will be rendered incorrectly in Mdict viewer. Sometimes you might have the latest IE installed but Windows uses older versions for rendering HTML in apps with WebBrowser control such as CHM and Mdict viewers. In such cases, you need to add a registry entry for Mdict viewer. I have IE8 installed and I'm using 64 bit Win7. The contents of the dword should correspond to the version of IE installed. Find the hex word of your version of your IE online. Here's mine:
Code: Select all
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION]
"mdict.exe"=dword:0000270f

Here's a preview of MdxBuilder:
Image

The look of the resulting dictionary is solely based on you. A great design results in a great look:
Image
Image
Last edited by medwatt on Sun Aug 24, 2014 2:09 am, edited 4 times in total.
medwatt
 
Posts: 8
Joined: Thu Nov 07, 2013 8:53 pm

Re: Pour them wate

Postby medwatt » Sat Aug 23, 2014 5:14 pm

deloto wrote:We can <a href="http://www.paperhelp.org/order.html?pid=1468">do your homework for you</a>. Just ask!


It's html, you can of course !! It'll just open the link in your default browser.
medwatt
 
Posts: 8
Joined: Thu Nov 07, 2013 8:53 pm


Return to General

Who is online

Users browsing this forum: Google [Bot] and 10 guests

cron