Languages - How do I add a new language: Difference between revisions From Online Manual

Jump to: navigation, search
(No difference)

Revision as of 14:32, 5 September 2011

With the international community that uses SMF, comes the need for SMF to support multiple languages other than just English. SMF offers language packs available for download, located at Languages Packs page of the SMF Downloads section. Just locate the language that you want to include on your forum, and select the box, which in some cases includes a flag most associated with the language. You will notice two packages 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 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 if you are using the UTF-8 character set, or not.

Installing a new language pack on your forum

With SMF 2.x administrators can install a new language directly from the administration panel in Admin > Configuration > Languages > Add Languages.

See the Add Languages page for details on the procedure.

Once you have selected and downloaded the language that you want to install, extract the content somewhere on your computer and then via an FTP program, upload the contents so that the actual language files (ex: index.languagename.php) are located in: /Themes/default/languages. Note: You do not need to create another directory within the languages one: all you really need to do is 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 files or language files, but will in effect simply add the extra files that were not previously there, in this case being the new language files. Assuming you have Enable user-selectable language support enabled 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 the admin 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

Unfortunately, there are not SMF translations for every language out there due to the huge number of languages that exist in the world. If you do not find the language pack you would like, but are fairly fluent in English or even another language that has a language pack available, you may want to consider providing translations for your own forum and the entire SMF community who may be able to use the language on their own forums. To save time, you may want to double check by contacting someone from SMF at [email protected], to ask them if they know of anyone already working on the language you want.

If you start to work on a new language pack for SMF, first notice how the language system works. In the /Themes/default/languages folder of your forum directory, resides the English language, which is the default language used by SMF. The contents of that folder is basically the text strings you see all over the forum. For simplicity, it was 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 on 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 often holds some of the most often used language strings that are used in more than one section or are used in the forum header or footer.

How to make a new language?

Simply open those files mentioned above one by one in any simple text editor (i.e. Notepad, Context, Macromedia Dreamweaver, PhpEdit, etc.) 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; in the second one you need to translate "Activation code". After you are done save your file like this: Login.(name of the languge).php (i.e. Login.arabic.php). Note: it is really important to look at the comments in the language files as they contain very important information to understand on some of the rules of translating the strings properly.



Advertisement: