Skip to content

Technical Documentation

Michal Boleslav Měchura edited this page Jan 17, 2018 · 8 revisions

Welcome to the European Dictionary Portal wiki. This page summarizes what you need know if you want to make changes to the source code hosted in this GitHub repository.

Opening up the source code

You need Microsoft Visual Studio, version 2015 or newer. You can download and install the Community Edition which is free of charge. Then open the solution file \Website\Website.sln.

Understanding the source code

When an HTTP request arrives at the website, the code in \Website\Global.asax.cs runs first. This is where we decide where to redirect the request to. Most requests are redirected to the page \Website\Default.aspx. This page serves as the website's homepage and also as the 'Find a dictionary' page.

Some requests are redirected to the page \Website\About.aspx. This page reads a Markdown file from the folder \Website\markdown and displays it as an "about" page.

URLs on the website always contain a language code, for example the en in http://www.dictionaryportal.eu/en/. When they don't, the website makes an attempt to guess the user's preferred UI language and redirects to it. The language detection happens in \Website\Data.cs in the method DetectUILang().

The page Default.aspx typically connects to the portal's SQL Server database and calls a stored procedure to retrieve some data from the database. The connection string for the database is hard-coded into \Website\Data.cs in the method GetConnectionString().

When you've made changes you need to rebuild the project (one way to do that is to right-click Website in Visual Studio's Solution Explorer on the right-hand side and then click Build). This will produce a new version of the file \Website\bin\Website.dll which you need to upload to the live website. Also, if you've made any changes to any files ending in .aspx or to any client-side web files (.gif, .css, .js and so on) then you must upload those to the live website as well.

Adding a new UI language

Let's say you want to localize the website into Swedish. The ISO 639-1 code for Swedish is sv. So first you need to get someone to translate all the user-interface strings into Swedish, for example by taking this English file \Website\loc\en.strings.txt, translating each line (except the code at the beginning), naming it sv.strings.txt and putting it in the same folder (and eventually uploading it to the live website, too).

Then you need to "UI-enable" the language in the long list of languages in \Website\Data.cs in the constructor method of the class Metadata. Find the line of code that corresponds to it:

this.languages.Add(new Language("sv", "Swedish", "", false));

And change it to:

this.languages.Add(new Language("sv", "Swedish", "svenska", true));

The third argument "svenska" is the name of the language in the language itself, this is how the language will be listed in the language drop-down at the top right-hand corner of the screen. UI-enabled languages should be ordered alphabetically by this name, so make sure to move this line of code up or down as appropriate.

The fourth argument true tells the website that this language is now UI-enabled.

Adding a new language to the dictionary catalog

To add a new language to the dictionary catalog (without necessarily UI-enabling it) so that curators can enter dictionaries for it, simply add a line of code like the Swedish one above. For example, to add Esperanto:

this.languages.Add(new Language("eo", "Esperanto", "", false));

In addition to this, you must also add the language to the XML editor that curators use to add and edit dictionaries. To do that, open the JavaScript file \Website\furniture\DicEditor.js and you will see a list of languages beginning at line 15. Add a new line like this:

{value: "eo", caption: "Esperanto"},

Contacting the developer

The website was developed by me, Michal Boleslav Měchura. Contact me for any questions not answered here: valselob@gmail.com.