Setup - Language

From TNG_Wiki
Jump to: navigation, search

Setup - Languages

TNG sets up the default language as part of its setup using the readme.html for the full install. The English full install readme.html sets up English, the French full install lisezmoi.html sets up French (français), and the Dutch full install sets up Dutch as the default language. Note that the other language full installs may not be available on TNG V8 and above.


TNG version: 11.0.0
The Character Set defaults to UTF-8 in Setup >> General Settings >> Language in TNG v11 and above. You should leave it as UTF-8 especially if your data contains accented characters unless for some overriding reason you cannot handle UTF-8.


TNG version: 10.1.3
The Character Set defaults to ISO-8859-1 in Setup >> General Settings >> Language, so if you want to use UTF-8 you must change it to UTF-8. Setup Language

Note that you should not change the charset to UTF-8 unless your database is defined with a utf8_xxxxxxx_ci collating sequence and that your accented data is saved as UTF-8 in the database. Refer to Database - Creating for examples of creating your TNG database as UTF-8, or to Changing to UTF-8 for converting an existing database.

The Dynamic Language Change defaults to Allow, so that you do not need to make an update when you add more languages.

Note that if your data contains accented characters, your database collating sequence for ISO-8859-1 when using mySQL version 5 may need to be latin1_swedish_ci or something equivalent in order to allow the accented characters to be ignored on a Find or Search request. If your site host provides phpMyAdmin (typically accessed from within cPanel) you can use it to check your database collating sequence. Simply launch phpMyAdmin, select your TNG database, and it will display the collation used for each table in the database.


TNG V8 and above

TNG version: 8.0
In TNG V8 and above, the language folders are in a pull down menu, with both the ISO-8859-1 and UTF-8 versions of each language folder.

Note that you must use the same character set encoding for all languages you define.

If your TNG charset is specified as ISO-8859-1 you should not select the UTF8 version of the languages when adding other languages.

TNG V8 setup language.jpg

After upgrade to TNG V8

TNG version: 8.0
Note that this section pertains to upgrades made to TNG V8 and above from TNG V7 or before only.


If you were previously using UTF-8 as character set on TNG V7 or below, after you have upgraded to TNG V8 or higher,

  • you must update your General Settings >> Language to point to the English-UTF8 folder (or your primary language folder)
  • you must update each of your language folder to point to the UTF-8 version so that your foreign accent characters do not get mangled as shown in the image on the right.
  • You will also need to move your cust_text.php manually
    • from the languages/French, or other language folders, to the languages/French-UTF8, or other language folders, the cust_text.php file was using UTF-8 encoding even though it is now in the French folder as a result of the upgrade.
    • from the languages/English to the languages/English-UTF8 folder (so you don't lose your custom text messages)
  • You may need to switch languages a couple of times to clear the language cookie and get it to point to the correct French-UTF8 folder
TNG V7 upgrade language mangled.jpg

Add Languages

Add language

The folder name used when adding a new language must match the folder name that was created for the language admintext.php, alltext.php, cust_text.php, and text.php files.

Francais and francais are not the same folder name. Notice that you should not use accented characters in the folder name.

Note that Charset should be specified as ISO-8859-1 or UTF-8. You should not use UTF-8 unless your database and data within the database is UTF-8.

Note that you must add the English-UTF8 or English language if you add other languages in order to support language switching.


TNG V8 and above

TNG version: 8.0

In TNG V8 and above, how languages are setup has changed as follows:

  • the language folder name is from a pull down selection list
  • the Character Set for the Add Language is set from the characters set specified in your TNG General Settings, so if it set to UTF-8 you should select the UTF-8 version of the language folder from the pull down.

Add language

Edit Language

TNG V8 and above

TNG version: 8.0
In TNG V8 and above, the language folders are in a pull down menu, with both the ISO-8859-1 and UTF-8 versions of each language folder.

If you were previously using UTF-8 as character set, after you have upgraded to TNG V8 or higher, you should update your language folder names to use the UTF-8 version so as to avoid confusion in the future.

TNG V8 edit language.jpg

TNG display messages

The TNG display messages have been translated into several different languages. To allow visitors to your site to view the site in any language besides your default language, you must create language records for each language you support, including your default language. For example, if your default language is English and you want to support French as well, you must create language records in Admin/Languages for both English and French. For each language you support, you must also create a separate folder on your site

TNG uses an admintext.php, alltext.php, and text.php files in each language folder to provide the language appropriate text. The alltext.php file is used in both the TNG admin and public part of the web site.

Cust Text

Each language folder allows you to have your own cust_text.php file, same name - but different contents, in each language folder. Your cust_text.php file is the last text file to be included. This means, that in addition to having your own $text variables you can also substitute your own text to override any existing TNG $text variables whether they are in the text.php, admintext.php, or alltext.php.

In addition, another advantage of having your own cust_text.php file is that TNG does not replace the cust_text.php when you install a new release or upgrade. Your overrides will continue to exist across upgrades, whereas if you modify the TNG $text variable files, you will lose your changes across new releases and upgrades.

For example if you want to override the

$text['headstone'] = "Headstones";

in the text.php, you would put

$text['headstone'] = "Gravestones";

in your English/cust_text.php file.

Of course if you change Headstones to Gravestones, you may also want to override the following other $text variables

$text['cemeteriesheadstones'] = "Cemeteries and Headstones";
$text['showallhsr'] = "Show all headstone records";
$text['headstonefor'] = "Headstone for";
$text['mnutombstones'] = "Headstones";
$admtext['headstone'] = "Headstone";
$admtext['changestohs'] = "Changes to headstone";

to

$text['cemeteriesheadstones'] = "Cemeteries and Gravestones";
$text['showallhsr'] = "Show all gravestone records";
$text['headstonefor'] = "Gravestone for";
$text['mnutombstones'] = "Gravestones";
$admtext['headstone'] = "Gravestone";
$admtext['changestohs'] = "Changes to gravestone";

and potentially other admintext.php variables.

Note that you can have overrides for some $text variables in your English/cust_text.php, but choose to not have any overrides for the same variables in your French folder.

Note also that the single quotes may be required in some level of PHP to avoid warnings. So if you have existing $text variables in cust_text.php, you will need to update them to use single quotes around the name.

Related links