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

Jump to: navigation, search
mNo edit summary
Line 8: Line 8:
See the  [[SMF2.0:Languages#Add_Language|Add Languages]] page for further details on the procedure.}}
See the  [[SMF2.0:Languages#Add_Language|Add Languages]] page for further 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 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: 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, 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 > [[SMF2.0:Languages|Languages]]  > [[SMF2.0:Languages#Settings|Settings]]'', users should now be able to select this language in their profile, on the ''[[Profile features]] > [[Profile features#Account Settings|Account Settings]]'' page. Also, administrators should now be able to make this the default language if desired by going to ''Admin > Configuration > [[SMF2.0:Languages|Languages]] > [[SMF2.0:Languages#Settings|Settings]]'' and selecting it in the ''Default Forum Language'' dropdown box.
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 files or language files, but will, in effect, 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 > [[SMF2.0:Languages|Languages]]  > [[SMF2.0:Languages#Settings|Settings]]'', users should now be able to select this language in their profile, on the ''[[Profile features]] > [[Profile features#Account Settings|Account Settings]]'' page. Also, administrators should now be able to make this the default language if desired by going to ''Admin > Configuration > [[SMF2.0:Languages|Languages]] > [[SMF2.0:Languages#Settings|Settings]]'' and selecting it in the ''Default Forum Language'' dropdown box.


===Creating Your Own Language Pack for SMF===
===Creating Your Own Language Pack for SMF===

Revision as of 02:59, 27 March 2015

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.

See the Add Languages page for further 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 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 files or language files, but will, in effect, 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

Unfortunately, there are not SMF translations for every language out there owing 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. To save time, you may want to double check by contacting someone from SMF via [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 directory of your forum directory, resides the English language, which is the default language used by SMF. The contents of that directory 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 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; 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 to understand on some of the rules of translating the strings properly.



Advertisement: