Skin language files and translations

Skin language files and translations


Language files can raise your overall skin quality, and if quality is the word you want connected with your Cotonti skins, then read on!

Skin language files make user's life easier when it comes to localizing their websites.
Instead of hard coding the words (or expressions) in your skin files, use skin language file.

Since all the language strings are placed inside skin language file, changing only one row inside language file will affect every .tpl file where that language string is used.
It's easier than changing the same word over 5, 10, 50 .tpl files, right?

#1. How to create skin language file for your skin?


First, you'll have to create YOUR-SKIN.LANGUAGE.lang.php file and place it in skins/YOUR-SKIN folder.

e.g. sed-light.en.lang.php file is placed in skins/sed-light folder

Place this code inside YOUR-SKIN.LANGUAGE.lang.php file

<?PHP
/**
 * YOUR-LANGUAGE Language File for YOUR-SKIN-NAME Skin
 *
 * @package Cotonti
 * @version COTONTI VERSION
 * @author YOUR NAME
 * @copyright YOUR COPYRIGHT
 * @license BSD
 */

defined('SED_CODE') or die('Wrong URL.');

?>

Example for english lang for Sed-Light skin:.

<?PHP
/**
 * English Language File for Sed-Light Skin
 *
 * @package Cotonti
 * @version 0.1.0
 * @author Cotonti Translators Team
 * @copyright Copyright (c) Cotonti Team 2008-2009
 * @license BSD
 */

defined('SED_CODE') or die('Wrong URL.');

?>


#1.1. Create language strings inside language file


After you created you YOUR-SKIN.LANGUAGE.lang.php, you can start inserting language strings between:

defined('SED_CODE') or die('Wrong URL.');

and

?>

Language string syntax:

$variable['variable_name] = 'variable_text';


Example:

$skinlang['Comment'] = 'Your comment';


#1.2. Inserting the language string inside .TPL file


Your language strings are «global», meaning that any language string can be used in any .tpl file.

How to insert language string inside .tpl file?


Syntax:

{PHP.variable.variable_name}


For example:

{PHP.skinlang.Comment}

#2. Translating skin language file


The easiest way is to use the already created skin language file inside skins/YOUR-SKIN folder.

Copy the content from YOUR-SKIN.LANGUAGE.lang.php (example: sed-light.en.lang.php) and paste it inside new file. Name the new file YOUR-SKIN.OTHERLANGUAGE.lang.php (example: sed-light.ru.lang.php) and upload it to skins/YOUR-SKIN

After you created the new file, you can start translating the language strings.

For example;

sed-light.en.lang.php

$skinlang['Comment'] = 'Your comment';

sed-light.ru.lang.php

$skinlang['Comment'] = 'Ваш комментарий';


No comments yet
Only registered users can post new comments