One of the advantages of Joomla is that is makes it relatively easy to create a multilingual website, without you having to install extensions. In this tutorial, you’ll learn how to create a multilingual Joomla website. You’ll find a complete walkthrough of the steps involved in creating a multilingual Joomla site. This is a free online appendix to the Joomla 3 Beginner’s Guide by Eric Tiggeler (Packt Publishing 2013).
Creating a multilingual site in Joomla 3 (Joomla 3 Beginner’s Guide) from Eric Tiggeler
TRANSCRIPT
Step-by-step tutorial on creating a bilingual website in Joomla! 3 This is an online appendix to the Joomla! 3 Beginner’s Guide by Eric Tiggeler. For more information, visit the Packt Publishing website or the website accompanying the book, www.joomm.net.
One of the advantages of Joomla 3 is that is makes it relatively easy to create a multilingua lwebsite, without you having to install extensions. In this tutorial, you’ll find a complete walk through of the steps involved in creating a multilingual Joomla site. In this example, the default site is in the English language. For users speaking another language, there should be a language switch available giving them access to the same content in a different language. In this example we’ll use Dutch as the second site language – but that’s just for demonstration purposes. You can follow along with the steps below using any language you want. Although creating a bilingual site isn’t complicated, it does involve following a number ofessential steps. Therefore, we’ll start with a freshly installed Joomla 3 site, an empty website without sample data. This way, we can keep things simple and get a good idea of the fullprocess. After you’ve mastered the basic principles, it’s easier to apply them to an existingsite that already contains content in one language.
STEP 1 – CHECKING WHICH LANGUAGES ARE CURRENTLY AVAILABLE
After you’ve installed Joomla, there’s one language available. You can check this by navigating to Extensions | Language Manager. In this example, the currently installed language is English (United Kingdom). The column Location: Site indicates this is the language that Joomla uses in the front end (texts such as Read more, Articles and Category). By clicking on Installed – Administrator you can see what language is installed for the administrative interface.
STEP 2 – ADDING A NEW LANGUAGE
First, let’s add the language files for the language we want to use as the second language on our site. This involves two steps: we’ll install the Dutch language pack and we’ll tell Joomla! we want to use this as a “content language”.
Installing a new language pack
We’ll install a Site Language pack. This is the file containing the translated versions of all default texts that come with Joomla (such as Read more).
- Go to Extensions | Languages. Click the Install Language button.
- A list of available translations appears. You can easily find the desired language by using the Search by language name field. In this field, enter Dutch.
- Tick the box to the left of the Dutch language and click the Install button.
- You’ll see a notice: Installing Dutch was successful. Mission accomplished: in the Language Manager overview screen (accessed through Extensions | Language Manager) you can now see there’s a another site language available.
Creating a Content Language
The next step is to create a Content Language. Although you’ve already installed a second language pack (in this example the Dutch site language pack), you still need to add the appropriate details for this language. To do this, you need to add what Joomla calls a Content Language. You can regard this as a “language profile”, containing all the details needed for Joomla to be able to use either the English or the Dutch language as “switchable”content languages.
- In the Language Manager screen, click the Content link in the menu on the left hand side. As you can see, there’s just one Content Language – there’s no sign of a Dutch Content Language yet. Click the New button.
- In the New Content Language screen, add the following details for the new language: <br>
- Title: enter Dutch (NL). This is the language name that will be displayed in the Joomla backend in articles, modules and other items that you can assign a specific language to.
- Title Native: for Dutch, enter Nederlands. This the original language name. This title will be displayed in the Language Manager, in the list of Content Languages.
- URL Language Code: enter nl. This is the code that Joomla will append to the page URL. If nl is entered, the output will be: www.example.com/en/. Every language installed must have a unique code.
- Image Prefix: enter nl. This is the language code, just as English has en or Frech has fr. Joomla uses this code to display country flag images enabling the visitor to select an site language. When you enter nl, Joomla will display the nl.gif flag image file found in the media/mod_languages folder. To find out which language flags are availble, refer to this folder.
- Language Tag: enter nl-NL. This tag consists of the language code (in lower case), a hyphen and the country code (in uppercase). If you’re not sure about the Language Tag, you can find it next to the language name in the list of installed site languages in the Language Manager.
- Status: this should be set to Published.
- Access: this should be set to Public.
- Click Save & Close. The Content Language profile is ready.
STEP 3 – ENABLING THE LANGUAGE FILTER PLUGIN
Joomla comes with a language filter plugin, which enables the CMS to recognize the different installed languages and display only the content relevant to the current language. The next step is to enable this plugin.
- Go to Extensions | Plug-in Manager. Using the search box, search for the System – Language Filter plugin.
- Click the System – Language Filter name to change its settings. First make sure Status is set to Enabled.
- Click the Basic Options tab. Check if Item associations is set to Yes. To create search engine friendly URLs in the multilingual site, set Remove URL Language Code to Yes.
- Click Save & Close. You’ve now got the language files set up properly and you’ve switched on Joomla’s built-inLanguage Filter. By default, this plugin will try to detect the language settings of the sitevisitors browser and display the site in this language (if this is present).
STEP 4 – ADDING MULTILINGUAL CONTENT
The next step is to create the actual content that needs to be displayed in different languages. To neatly organize the content that belongs to different languages, you need tocreate specific categories holding (in this case) English and Dutch content.
Creating language categories
We’ll add two top-level categories: one which will contain our English content, the other onefor Dutch content.
- Navigate to Content | Category Manager and click New to create a new top-level category. This first new category will become the container for all Dutch articles, so let’s call it Dutch. In the Language drop-down list, select Dutch. As it’s a top-level categogyr, it should have No parent. Save this new category.
- Next, create a new top-level category called English. As the language, select English (UK). Click Save & Close. The Category Manager should contain both a category called Dutch and a category called English.
You’ve now got two categories in your site. In real life, you’d probably want to organize the site content using subcategories of these two main categories. In this example, we’ll leave the categories as they are.
Adding content to the new categories
Next, create a set of (dummy) articles. We’ll create a few English articles and their Dutch counterparts. In this example, we’ll create four articles in the English category and four articles in the Dutch category.
- Navigate to Content | Article Manager. Create a new article called English Article 1. Add some dummy text. Make sure to assign the article to the English category. In the Language drop-down list, select English.
- Repeat the actions described in the previous step to create a set of articles called English Article 2, English Article 3 and English Article 4.
- You’ve now got four English articles. Instead of creating four corresponding Dutch articles from scratch, let’s copy the English articles. To do this, select all four articles in the Content | Article Manager screen and click the Batch button.
- In the Batch process the selected articles popup screen, choose the following settings: <br>
- Set Language: Dutch.
- Select Category for Move/Copy: Dutch.
- Click the Copy select box and click Process.
- You’ve now got a set of eight articles: four articles assigned to the English category and their copies, assigned to the Dutch category. Open the first of the four articles that are assigned to the Dutch category. Change the following details:<br>
- Title: enter the Dutch title. In this case we’re only testing things out, so we won’t bother translating. Let’s enter Dutch Article 1.
- Under Publishing Options, delete the contents of the Alias field. Joomla will insteadadd a unique alias for this article after you’ve saved the article.
- In the article text, just change a few words to be able to be able to check later if the “Dutch” text is displayed.
- Click Save & Close.
- Next, open the other Dutch articles one by one and change the details accordingly. The output should be Dutch Article 2 to Dutch Article 4, all assigned to the Dutch category, assigned to Language: Dutch
The (dummy) content is ready. We’ve got two small groups of articles; each of these articleshas been assigned to the appropriate language.
STEP 5 – CREATING MENUS FOR THE MULTILINGUAL CONTENT
Next, we’ll create a menu for each of the languages. As you would expect, we’ll need a menupointing to the English articles, and a separate menu pointing to the Dutch articles.
- Navigate to Menus | Menu Manager and select Add New Menu. First create a menu for the Dutch language articles. As the Title, enter Dutch Menu. As the Menu Type, enter dutchmenu. Finally, add a Description (ie Menu for Dutch content).
- Click Save & Close. Now create another menu for the English language. As the Title, enter: English Menu. As the Menu type,enter: englishmenu. Add a Description and save the menu.
You’ve now got two sets of content, and two menus, ready to be filled with menu items.
Adding menu items
The two new menus are still empty, so let’s add a set of menu items to them.
- Navigate to Menus | Dutch Menu | Add New Menu Item. We’ll keep it simple and create a menu link of the Single Article type. Make this menu link point to Dutch Article 1. As the Menu Title, enter Dutch Article 1. Make sure the Menu Location is Dutch Menu and set the Language to Dutch.
- Repeat the actions described in the previous step until you’ve got four menu items in the Dutch Menu, each pointing to one of the four available Dutch articles.
- Now navigate to Menus | English menu and create four menu links pointing to the four English articles. To do this, repeat the actions you took in step 1 and 2, changing the details as needed.
The outcome should be a set of four menu links in the English menu
Assigning language-specific home pages to the new menus
Your English and Dutch menus both contain all necessary menu links. However, Joomla needs to know what menu link in either of these menus should be the default link (the default homepage to be displayed for either the English site or the Dutch site). Let’s set one of the menu items to be the default homepage for this language.
- Navigate to Menus | Menu Manager and click the name of the English Menu to open it.
- Click on the star in the Home column next to the first article.
- The star icon changes to an image of the British flag, indicating this is the default page for the English part of the site.
- Navigate to Menus | Dutch menu and click the Home star next to the first Dutch article. The star turns into a Dutch flag.
Connecting menu links to their translated counterparts
Although you have two sets of articles (orginal articles and their Dutch “translations”), up to now there’s no connection between these articles. Joomla has no way of knowing what Dutch article should serve as the translated alternative of a particular English menu item. Let’s connect (associate) the English menu items with their translations.
- In the Menu Manager, open the Dutch Menu and click the first menu item to edit it (in this example, this is the Dutch Article 1 menu link).
- You’ll notice this menu item has a separate Associations tab. Click this tab and click the English (UK) drop-down list. Select the appropriate English menu link: English Article 1.
- Save this menu item.
- Repeat the previous steps to create associatons for all four Dutch menu links. Open each menu link, select its appropriate English counterpart and save it. As a result, you should now have four Menu Items that are associated with Dutch MenuItems. In the Menu Manager: Menu Items screen, you can easily check this: in the Association column, an icon (a chain in a blue circle) is displayed. Hover your mouse cursor over the image to see the associated menu items.
Finalizing the new menus by adding menu modules
Both new menus have been created, and menu links have been assigned to them. However, as is the case with every new menu created in Joomla, you’ll also have to add a menu module in order to be able to display the menu on the site. Let’s add these modules for both menus.
- Navigate to the Menu manager. Locate the Dutch Menu and click the Add a module for this menu type link in the Linked Modules column.
- In the Module Manager: Module Menu screen, enter the following Title: Dutch Menu. In the Language drop-down list, select Dutch (NL).
- In the Position drop-down list, select position-7. Click Save & Close to commit changes.
- Add a menu module for the English menu by repeating the previous steps, changing the details as necessary: in the Menu Manager, click the Add a module for this menu type link, name the new module English Menu, set the language to English (UK), assign it to position-7 and click Save & Close.
Unpublishing the default Main Menu
Apart from the two new menus, the website also contains the Main Menu that’s part of the Joomla default setup. If you’ve installed Joomla without sample data, this menu containsonly a Home link. Although the bilingual site will use the new English Menu and the new Dutch Menu, Joomla will still need the default main menu and the Home link in it to function. Joomla also requires the Main Menu module to remain assigned (as it is by default) to Language: All. However, the Main Menu doesn’t need to be displayed any more on the site. For this reason, we’ll unpublish the menu module associated with the Main Menu.
- Navigate to Extensions | Module Manager, locate the Main Menu module and click its Title to edit it.
- Change the Status to Unpublished. Save your changes.
The menus for the multilingual content are finished. Just one more step to go: adding alanguage switcher enabling web visitors to select their prefered language.
STEP 6 – ADDING A LANGUAGE SWITCHER
If you were to leave the site as it is, you would have two sets of articles, one Dutch, one English. However, only one menu would be displayed: either the English Menu or the Dutch Menu. Joomla would decide between serving English or Dutch content depending on the language settings of the visitors browser.
However, we want the visitor to be able to actively switch to the translated content in another language. To add this functionality, we’ll install the language switcher module that comes with Joomla.
- Go to Extensions | Module Manager. Click New and create a new module of the Language Switcher type.
- Enter a Title, ie Choose your language.
- As the Position, select position-7.
- The Language drop-down box should remain set to All, as this module will be displayed regardless of the selected language.
After you’ve saved the new module, have a look at the front end of the site. In the right column the language switch should be displayed.
STEP 7 – EXPLORING THE MULTILINGUAL SITE
Congratulations, your modest but fully functional multilingual site is finished! When the user visits the site using a browser which is set to use the English language, Joomla will displaythe site with the English content: all articles and modules that have been assigned English astheir content language. Should visitors wish to see the Dutch version of the site contents, they can click the Dutch flag icon in the Language Switcher.
Unfortunatly it doesn’t work. I made several multilingual site, but on this template the “languager switcher” module not on display (position-7) only the name of the module, and cant display the flags too.
I check everything:
– english and hungarian language has installed
– plugins is published
– main menu is default in hungarian /hu
– all menu and articles in english too, with english code too.
– in the module section I allowed the displaying in separate language menu (english in english menus, hungarian in hungarian menus)
I cant imagine what is the problem.
Help me please. As below you can see the website (hu and en too).
Thank you,
Charlotte
If you interested you may ask for our services here: https://www.astemplates.com/services