SMF2.0:Languages: Difference between revisions From Online Manual

Jump to: navigation, search
(→‎Edit Languages: some elaboration.)
 
(18 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{TOCright}}
{{TOCright}}
== Edit Languages ==
== Edit Languages ==
A table lists all the installed languages along with additional informations. The table consists of the following columns:
 
*'''Default''' - Allows to define the language used by default for example for [[guest]]s or members who has not changed the language in their [[profile]].
A table lists all the installed languages along with additional information. The table consists of the following columns:
*'''Default''' - Allows you to define the language used by default, for example for guests or members who have not changed the language in their [[profile]].
*'''Language Name''' - The name of the language
*'''Language Name''' - The name of the language
*'''Character Set''' - The character codification of the language installed.
*'''Character Set''' - The character codification of the language installed.
*'''Users''' - The number of [[member]]s using that particular language.
*'''Users''' - The number of members using that particular language.
*'''Locale''' - The code that defines the language. Please see [[Wikipedia:Locale]] for details
*'''Locale''' - The code that defines the language. Please see [[Wikipedia:Locale]] for details
If more than one language is installed, you can select which language you want to be the default.  Clicking ''Save'' will then change the default language.
===Edit a Language===
===Edit a Language===
Settings for each language are edited by selecting a '''Language Name'''. These include
 
By selecting the ''Language Name'' it is possible to change some settings of the language:
The settings for each language are edited by clicking on the name of the language in the list. The following settings are available:
 
*Character Set
*Character Set
*Locale
*Locale
Line 15: Line 21:
*Spelling
*Spelling
*Enable "Right to Left" Mode
*Enable "Right to Left" Mode
====Edit Language Entries====
====Edit Language Entries====
From the drop-down list, select "General Strings" (which covers most of the strings in SMF), or one of the other choices to see all of the language entries (also referred to as language strings). These contain words like "hello" and "Password incorrect", which are used throughout your forum. If you change these entries, and select the '''Save''' button at the bottom of the page, you can change how information is displayed on your forum. Where you find strange formatting ($1$s, or {USER_NAME}), keep the strange formatting, in order to continue to provide the correct information to you and your forum's users.
 
From the drop-down list, select ''General Strings'' (which covers most of the strings in SMF), or one of the other choices to see all of the language entries (also referred to as language strings). These contain words like 'hello' and 'password incorrect', which are used throughout your forum. If you change these entries, and select the ''save'' button at the bottom of the page, you can change how information is displayed on your forum. Where you find strange formatting ($1$s, or {USER_NAME}), keep the strange formatting in order to continue to provide the correct information to you and your forum's users.


== Add Language ==
== Add Language ==
Here [[administrator]]s can download directly from [[Simple Machines]] website new languages. A box is presented where the English name of the language can be introduced to search it on Simple Machines website.


Once the results are presented in a table with several information. In the last column '''Install''' is present a link that once selected will start the installation procedure.<br>In the first step all the language files are checked against the already installed files for that language and he page reports if the files are writable, the version number if the file already exists and in the last column '''Copy''' a checkbox allows to select which files copy to the local forum.
Here you can download directly new languages from the Simple Machines website. There is a box where the English name of the language can be inserted to search for it on the Simple Machines website.


== Settings ==
The results are presented in a list with details of the languages available based on the search terms. To start the installation procedure of a new language, click ''Install'' next to the relevant language.
In this page is possible to set the '''Default Forum Language''' from a dropdown menu and define if the users are allowed to select in which language see the forum checking the '''Enable user-selectable language support''' checkbox.


In the first step, all the language files are checked against the already installed files for that language and the page reports if the files are writable. The results of this check are displayed in a table, where you can see the version numbers of the language files; whether they are already installed; and if so, whether there are any updates available. A checkbox allows you to select which files to copy to the local forum. If no files are checked, all files are automatically installed.


==Additional remarks regarding translation==
== Settings ==
{{needs work|this section should be reformulated and/or moved to another page}}
With software used around the world, by many different peoples, in many different languages - such as SMF, it's always important to make the interface as easily and seamlessly translatable as possible. As such, this is one of the goals of themes.
 
===Language Files? Strings?===
Language files are simple groupings of language strings, or in other words phrases and sentences, meant to make it easier to link templates, sub templates, and language strings together. For performance and scope reasons (meaning, because sometimes it's better this way anyway) not every string is available to every template - they are only available by the "loaded" language files.
 
Generally speaking, language files are loaded with the same names as the templates they are used in. There are exceptions to this, such as Login being used by Register, but they are generally logical.
 
There is one special language file, which is "Modifications". This language file is meant mainly for packages and modifications, but it can also be used to specify more strings in many cases.
 
The language strings themselves are the "cream filling"; for example, a phrase such as "Send this Topic to a friend" could be one such language string. Every language string has an identifier, and for ease of use these are, for the most part, short terse english strings explaining the purpose of the string.
 
The format is, for the most part, prefix_string_name. The above example might have the identifier 'sendtopic_to_friend'. This serves the purpose of grouping it (it's part of the sendtopic functionality) and labeling it.
 
===Great! So how do I use language strings?===
The fact that SMF uses language strings is all well and good, but what does that mean to you? If you use english in your theme, will that get automatically translated for you? Heh, we wish. No, you have to specifically use it in your theme - this means no english phrases :/. To have strings also available in languages like German or Thai, you will need the $txt variable. This is a lot like $context, except that it stores only a list of language strings available. To use our above example, you might use something like $txt['sendtopic_to_friend']. In your template, it would look a bit like this:
{{code|1=<nowiki><b>', $txt['sendtopic_to_friend'], '</b></nowiki>}}
As you can see, the identifier goes inside the brackets after $txt, surrounded by single quotes - just like contextual data. You have to use the ', ... , ' format to separate the string from regular text, though, as well.
 
===But, how do I use a language string not in the default set...===
With themes that really change the look of SMF, this is inevitable. It is for this reason specifically that language files can be tied directly to themes, not to the entire forum.
 
Just like templates, if you include a language file in your theme, it will be loaded from your theme, but if it isn't there it won&'t be. Here's the rule with language files:
 
# Is there a *language file*.*user's language*.php in this theme?
# Is there a *language file*.*forum language*.php in this theme?
# Is there a *language file*.*user's language*.php in the default theme?
# Is there a *language file*.*forum language*.php in the default theme?
 
However, if the forum's default language is Spanish, and you only have English available, it will end up falling back on the default language files.
 
It is for this reason that it is sometimes necessary to add new language files. This helps make it clear that a new language file is needed for this theme, and that the default ones - even translated - will not do. To load a new language file, you will need to open your index template. Look for the "init" sub template, which can be found by searching for "template_init". This is a special initialization sub template. Right before the closing curly brace (}), add the following: loadLanguage('Theme'); And you're all set! The file, Theme.somelang.php might look like this:
{{code|1=<nowiki><?php
// Version: 1.0 ; Theme
$txt['mytheme_hello'] = 'How are you today?';
?></nowiki>}}
It's recommended you use Theme, just because this makes it easier to tell which language file is yours for translators. You might want to look at some other language files, and other themes, to understand this better.
 
===Some notes to remember...===
A very important note is that if you want something like "don't", you need to use a \ to "escape" the '. See, If I said 'don't', it would be confusing... do I mean 'don' + t', or 'don't'? To "escape" this problem (pun intended) you just use 'don\'t'.
 
When translating, especially, you may need to use a special character, such as Å. Because of html validity, issues with PHP, and other things, it's best for you to instead use entities - these are like Å. Note that some strings should not have entities in them, and they should be noted as such. A list of entities can be found at:
 
http://www.w3schools.com/html/html_entitiesref.asp (the entity name is preferred.)
 
To change the character set and language code, you will need to modify your index.languagename.php file. In it, you should set $txt['lang_locale'] to the locale (short language identifier) and $txt['lang_character_set'] to the character set to be used. As well, $txt['lang_rtl'] needs to be = true if the language is read from right to left (rtl). For information on these, please look at the following references:
 
http://www.w3.org/International/O-charset-lang.html
 
http://www.w3.org/International/O-charset-list.html
 
http://msdn.microsoft.com/workshop/author/dhtml/reference/charsets/charset4.asp
 
Some other guidelines to follow for better internationalization (a fancy word for translatability):
 
*Whenever possible, try not to force word order. This means, don't take two strings and put them together - like 'How are ' . 'you'... this will make it harder to translate.
*Remember that some words have more than one meaning in English, but don't in other languages. Try to avoid using a word as a verb and a noun in different places.
*Be aware that some other languages may have very different rules for dates and pluralization than your native language.


See also: http://www.mozilla.org/docs/refList/i18n/
In this page it is possible to set the ''Default Forum Language'' from a drop-down menu and define if the users are allowed to select the language in which they want to view the forum by checking the ''Enable user-selectable language support'' checkbox.


Hopefully this will help you on your way to making themes that are different, wonderfully unique, and above all translatable - our non-English users thank you!
==Additional Information==


{{As an administrator}}
*[[Languages_-_How_to_add_or_change_phrases_used_by_the_forum_software|How to add or change phrases used by the forum software]]


[[Category:Developing SMF]]
{{ {{Localized|As an administrator2.0}}}}

Latest revision as of 20:47, 22 October 2014

Edit Languages

A table lists all the installed languages along with additional information. The table consists of the following columns:

  • Default - Allows you to define the language used by default, for example for guests or members who have not changed the language in their profile.
  • Language Name - The name of the language
  • Character Set - The character codification of the language installed.
  • Users - The number of members using that particular language.
  • Locale - The code that defines the language. Please see Wikipedia:Locale for details

If more than one language is installed, you can select which language you want to be the default. Clicking Save will then change the default language.

Edit a Language

The settings for each language are edited by clicking on the name of the language in the list. The following settings are available:

  • Character Set
  • Locale
  • Dictionary
  • Spelling
  • Enable "Right to Left" Mode

Edit Language Entries

From the drop-down list, select General Strings (which covers most of the strings in SMF), or one of the other choices to see all of the language entries (also referred to as language strings). These contain words like 'hello' and 'password incorrect', which are used throughout your forum. If you change these entries, and select the save button at the bottom of the page, you can change how information is displayed on your forum. Where you find strange formatting ($1$s, or {USER_NAME}), keep the strange formatting in order to continue to provide the correct information to you and your forum's users.

Add Language

Here you can download directly new languages from the Simple Machines website. There is a box where the English name of the language can be inserted to search for it on the Simple Machines website.

The results are presented in a list with details of the languages available based on the search terms. To start the installation procedure of a new language, click Install next to the relevant language.

In the first step, all the language files are checked against the already installed files for that language and the page reports if the files are writable. The results of this check are displayed in a table, where you can see the version numbers of the language files; whether they are already installed; and if so, whether there are any updates available. A checkbox allows you to select which files to copy to the local forum. If no files are checked, all files are automatically installed.

Settings

In this page it is possible to set the Default Forum Language from a drop-down menu and define if the users are allowed to select the language in which they want to view the forum by checking the Enable user-selectable language support checkbox.

Additional Information

Main

Configuration

Forum

Members

Maintenance

Miscellaneous




Advertisement: