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

Jump to: navigation, search
m (Bot: Automated text replacement (-folder +directory))
mNo edit summary
 
(12 intermediate revisions by 4 users not shown)
Line 1: Line 1:
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 [http://download.simplemachines.org/?smflanguages 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 ''[[Administration Center|Admin]] > [[Forum Maintenance]] > [[Forum Maintenance#Routine|Routine]]'' and check ''Convert the database and data to UTF-8'' to see if you are using the UTF-8 character set, or not.
SMF supports multiple languages, offering language packs available for download, which are located on the [http://download.simplemachines.org/?smflanguages 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 ''[[SMF2.0:Administration Center|Admin]] > [[SMF2.0:Forum Maintenance|Forum Maintenance]] > [[SMF2.0:Forum Maintenance#Routine|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===
===Installing a New Language Pack on Your Forum===
<br>
{{version specific
{{version specific
|version=2.x
|version=2.0.x
|content=With SMF 2.x administrators can install a new language directly from the administration panel in ''Admin > Configuration > [[Languages]] > [[Languages#Add_Language|Add Languages]]''.
|content=Administrators using SMF 2.0.x can install a new language directly from the administration panel in ''Admin > Configuration > Languages > [[SMF2.0:Languages#Add_Language|Add Languages]]''.}}


See the [[Languages#Add_Language|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 upload the contents via an FTP program, so that the actual language files (for example: ''index.languagename.php'') are located in ''/Themes/default/languages''.  


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]] > [[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 the admin should now be able to make this the default language if desired by going to ''Admin > Configuration > [[Languages]] > [[Languages#Settings|Settings]]'' and selecting it in the ''Default Forum Language'' dropdown box.
'''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.  


===Creating your own language pack for SMF===
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.
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 [mailto:languages@simplemachines.org [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.
===Creating Your Own Language Pack for SMF===


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.
If the [http://download.simplemachines.org/?smflanguages 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 [mailto:languages@simplemachines.org languages@simplemachines.org]. You can also ask to become a member of the official translation team and gain access to the online translation system.


====How to make a new language?====
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.
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 :
 
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:
{{code|1=
{{code|1=
$txt[637] = 'with ' . $context['forum_name'] . '.';
$txt[637] = 'with ' . $context['forum_name'] . '.';
Line 24: Line 29:
}}
}}


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.
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.


<noinclude>[[Category:FAQ]]</noinclude>
<noinclude>[[Category:FAQ]]</noinclude>

Latest revision as of 10:13, 28 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.

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 [email protected]. 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.



Advertisement: