‹ back to Settings



  • The language section controls multiple languages in MyPortal. When you create a new website there is often a need to create it in more than just one language. But you don't need to create as many websites as many languages you have; you have to create one website and than apply different translations to it.

  • The MyPortal CMS can hold together different translations of categories, articles, images, files and market products. Every article has an unique ID, but all translated articles have the same IID. The IID field helps you to find the translated article in no time. You can have the same structure of categories, articles and images, but there is no problem to manage them, because of theirs IID and LANG fields. The combination of iid and lang fields in the database is unique!

  • The IID is the special field in articles, images, files and marketproducts, which is the same through more items of the same (but translated) content. The special field for categories is _CID and determines all categories of the same (but translated) kind.

languages DB

  • There is an example of articles direct from the database. You can see two different rows with it's unique id, but they have the same iid field. Thanks to the lang field we can easily determine that we really have one article, which is translated into two languages. They have also the same cid field, because they are in the same category (categories can also be translated, of course), but they have different name and description.

Add and remove languages

In the languages settings you can very easy add or remove languages. When adding a new language you just have to select it from the dropdown menu, because the MyPortal already has stored all available languages. Removing a language is just one click away.

Every new language is available as a separate tab at the top of MyPortal. languages tabs

Edit words

Another functionality of language section is translating words and phrases. It happens that you have some words or phrases on your website, which are not part of any article or category. For example, you can have a contact form, where is every input field also labeled as name, surname, e-mail and so on. Of course you want to translate these words when you move to another language.

First you have to set a keyword for each special word you need to be translated. The correct PHP code is:

echo __('name');

The __() function searches for the specified keyword in the database and gets it's translation according to the current language ($GET['lang']). Each keyword can have as many translations as many languages are defined in MyPortal. If you don't specify a translation for some keyword, the function returns the keyword itself.

  • All keywords have to be stored in the database, so you have to click on the EDIT WORDS button to open keywords table.

  • There is another feature when editting keywords. At the bottom right corner you can find the SCAN button, which searches automaticaly for all keywords through all PHP files!

languages tabs

echo __('gender'); //returns "spol" if $GET['lang'] == 'si'
echo __('gender'); //returns "gender" if $GET['lang'] == 'en'
echo __('name'); //returns "your name" if $GET['lang'] == 'en'

‹ back to Settings

Try myPortal 2: