Reputation: 361
What is the best way to do an international website using Codeigniter framework and smarty template ?
Because I really don't know where begin ..
PS : I already have the librairies languages ..
Upvotes: 2
Views: 676
Reputation: 1259
You need to load language helper first in your controller Then inside smarty template using language helper you can display messages
<div>{lang('msg_first_name')}</div>
Upvotes: 3
Reputation: 8830
Configuring Multi-Language Support
First we need to configure the necessary files before we can start using language support. The CodeIgniter config file, located in the application/config directory, contains an option called language which defines the default language of the application.
<?php
$config['language'] = 'english';
We also need to create the actual files which contain our messages in different languages. These files need to be placed inside the application/language directory with a separate directory for each language. For example, English language files should reside in the application/language/english directory, and French language files should be located in application/language/french.
Let’s create some language files that contain error messages for a sample application. Create the file english/message_lang.php (it’s important that all of the language files have the suffix _lang.php). The following code contains some sample entries for the content of our language file:
<?php
$lang["msg_first_name"] = "First Name";
$lang["msg_last_name"] = "Last Name";
$lang["msg_dob"] = "Date of Birth";
$lang["msg_address"] = "Address";
For more reference, refer this link
Upvotes: 1