Languages - How do I add a new language

From Online Manual

Jump to: navigation, search

SMF supports multiple languages, offering language packs available for download, which are located on the Languages Packs page of the SMF Downloads section. Just locate the language that you want to include on your forum and tick the box. You will notice that there are two packages which you can download for each language. One of them includes -utf8 at the end of the package name. This is the UTF-8 version of the language pack. Note that while this version, in many cases, works best for many languages, it should only be used if your forum is using the UTF-8 character set. Go to Admin > Forum Maintenance > Routine and check Convert the database and data to UTF-8 to see whether you are using the UTF-8 character set.

Installing a New Language Pack on Your Forum


Administrators using SMF 2.0.x can install a new language directly from the administration panel in Admin > Configuration > Languages > Add Languages.

Once you have selected and downloaded the language that you want to install, extract the content somewhere on your computer, and then upload the contents via an FTP program, so that the actual language files (for example: index.languagename.php) are located in /Themes/default/languages.

Note: You do not need to create another directory within the languages one. Just upload the Themes directory included in the language package as the parent directory over the existing Themes directory, located in the root directory of your forum. This will not overwrite any existing theme or language files, but will add the extra files that were not previously there, in this case the new language files.

Assuming that you have activated Enable user-selectable language support in Admin > Configuration > Languages > Settings, users should now be able to select this language in their profile, on the Profile features > Account Settings page. Also, administrators should now be able to make this the default language if desired by going to Admin > Configuration > Languages > Settings and selecting it in the Default Forum Language dropdown box.

Creating Your Own Language Pack for SMF

If the Language Packs page does not contain the language you are looking for, there might still be a translation in progress for your language. In order to find out if there is anyone already working on the language you want, you can contact the SMF Localization Team via languages@simplemachines.org. You can also ask to become a member of the official translation team and gain access to the online translation system.

If you want to start translating by manually editing the actual php files, first notice how the language system works. The English language resides in the /Themes/default/languages directory of your forum directory, which is the default language used by SMF. The contents of that directory are basically the text strings you see all over the forum. For simplicity, they have been divided into many files, representing the section or sections where they are used.

To know which file is related to which section, check the filename. It is composed according to the template [Section].[language].php. So Login.english.php contains all texts needed for the login function in your forum: the first part (Login) defines the section and the second part (english) defines the language used in that file. Note that the most important file is index.english.php. This file contains some of the most frequently used language strings which appear in more than one section or in the forum header or footer.

How to Make a New Language

Simply open the files mentioned above one by one in any code editor, such as Notepad++, Context, or PhpEdit, and translate the strings in them. For example:

$txt[637] = 'with ' . $context['forum_name'] . '.';
$txt['invalid_activation_retry'] = 'Activation code';

In the first one you only need to translate "with" and leave the rest as it is; in the second one you need to translate "Activation code". After you have finished, save your file like this: Login.(name of the language).php (i.e. Login.arabic.php).

Note: it is very important to look at the comments in the language files as they contain very important information about the rules for translating the strings properly.