
A website can be monolingual or multi-lingual. A monolingual website is a website with content in one language and a multilingual website is any website that offers contents in more than one language.
For both monolingual and multilingual Dzongkha website, following are the some of the important technical features to be kept in mind.
Additionally, following aspects should be considered for multilingual websites.
To display an HTML page correctly, a web browser must know the character set (character encoding) to use. The charset attribute specifies the character encoding for the HTML document. The charset is specified in the meta tag.
Syntax :
Character set (charset): A set of characters recognized by the computer. (ASCII, Unicode, etc.)
Difference between Unicode and UTF-8
Syntax:
Sample code 3: Specifying language of the element’s content .
Styles are commonly used to control changes in fonts, font sizes and line heights when language changes occur in the document. The best way to style content of different languages in HTML is to use the: lang() selector in your CSS style sheet. The :lang() selector is used to select elements with a lang attribute with the specified value.
Syntax
:lang (languagecode) { css declarations;}
Sample code 4: using :lang() selector for sample code 3
:lang(dz) { font-family:dzongkha; font-size:50px; color:#006}
p:lang(en){ font-family:Arial, Helvetica, sans-serif, font-size:24px; font-style:italic; color:#0F0}
For the proper display for Dzongkha, it is important that we use Dzongkha fonts. Not all the devices used to access internet may have the Dzongkha fonts installed. However, CSS3 Web Fonts allows Web designers to use fonts that are not installed on the user's computer.
You can just include the desired font file on your web server, and it will be automatically loaded to the user’s computers when needed.
Your "own" fonts are defined within the CSS3 @font-face rule.
Syntax
Note: in above code, fonts are supposed to be in the folder named fonts in the same directory as the css file. Though, the TrueType Font file is supported by all the web browsers, Embedded Opentype Font file is still used for the older versions of IE which some users with Windows XP still uses it.
Dzongkha web fonts can be downloaded from: Download Dzongkha Font
The Unicode characters should be stored using utf8 encoding and utf8_general_ci collation.
Let's create a database and a table to hold our data. What is most important here is the "CHARACTER SET utf8" portion. This tells MySQL that all the text n this table will be encoded in UTF-8.
Sample code 6:
Tables created in the database will use utf8 and utf8_general_ci by default for any character columns.
Sample code 7: creating table with utf8 character set and utf8_general_ci collation
Note that MySQL uses a non-standard name "utf8" to mean UTF-8. The COLLATE command is used to tell how to sort the data when using the SORT BY command. Also note that you should always use VARCHAR instead of CHAR with UTF-8. (UTF-8 uses variable sized numbers for different characters. For instance, Latin letters use 1 byte codes, while Japanesee characters are 3 bytes. Using CHAR(10) would force the database to reserve 30 bytes, because it doesn't know ahead of time which length with be used, so it reserves the maximum.)
There are three commonly used approaches to creating multilingual URL/domain structures:
Since most of the Bhutanese website won’t target audiences from other countries or have content primarily or only relevant to people in one country, ccTLDs is not required.
According to Google:
If your time and resources are limited, consider buying one non-country-specific domain, which hosts all the different versions of your website. In this case, we recommend either of these two options:
The fourth option to use URL parameters, for example mywebsite.com?lang=dz is not recommended as they are difficult for search engines to interpret.
As the multilingual websites are basically translations of the same content (most of the time), subdirectories are an obvious solution. This approach is the easiest and cheapest to implement. Simply add a language directory to your server.
www.mywebsite.com/en
www.mywebsite.com/dz
A multilingual website is useless without the ability to change languages. Oftentimes you’ll find multilingual websites with language switcher placed on top right of the page.
Some multilingual website redirect to the home page while user switches the language which is actually not desirable. When the user switches the language while on particular page, the user should be redirected to the equivalent page of the language chosen. For example, if the user is on www.mysite.com/en/intro.php, he/she should be redirected to www.mysite.com/dz/intro.php when he clicks to switch the language.
The simplest way to achieve this page to page linking is to provide link of the equivalent pages in other languages on the page itself. But this will be tedious and very static. One can make it less tedious and dynamic by writing simple function.
Sample code 8: Simple function to switch language.
PHP: langchange.php
function langchange()
{
$current_page_uri = $_SERVER['REQUEST_URI'];
if($poss=strpos($current_page_uri,'/dz/'))
{
$redirectto= substr_replace($current_page_uri,"/en/",$poss,4);
echo $redirectto;
}
else
{
$poss=strpos($current_page_uri,'/en/');
$redirectto= $redirectto= substr_replace($current_page_uri,"/dz/",$poss,4);
echo $redirectto;
}
}
<div style="background:#eeeeee; border:1px solid #cccccc; padding:5px 10px">
<div id="lang_switch" lang="en">
<div id="lang_switch" lang="en"><code><a href="<?php include('../langchange.php'); langchange();? >">English</a></code></div>
</div>
</div>
In above php function, we are simply determining the current uri and looking for the substring ‘/en/’ and ‘/dz/’ and replacing with each other. It is assumed that the subdirectory for Dzongkha is named ‘dz’ and English is named ‘en’.