0

I'm trying to do something like:

$config['first_link'] = 'lang:pagination_first_link';
$config['prev_link'] = 'lang:pagination_prev_link';
$config['next_link'] = 'lang:pagination_next_link';
$config['last_link'] = 'lang:pagination_last_link';

Is there a simple way to do this ?

This configuration is specific to the Pagination config file, but the question is generic.

w35l3y
  • 8,613
  • 3
  • 39
  • 51

2 Answers2

1

You have language folders for that. If you take a look at system/language/english, you can see how CodeIgniter deals with internationalization.

For your example, you would create a file in system/language/english, called pagination.php, for example.

$lang['first_link'] = 'First Link';
$lang['prev_link']  = 'Previous Link';
etc...

If you wanted to create more languages, you could just create folders for them under system/language. Then you could just load the language file before setting the configurations, and then it's as easy as writing this:

$config['first_link'] = $this->lang->line('first_link');

If you have those pagination configurations inside a config file, not on your controller, I can't think of an easy to do it, without a bit of a hack. You would have this:

$CI =& get_instance();
$CI->lang->load('pagination', 'english');

$config['first_link'] = $CI->lang->line('first_link');
$config['prev_link']  = $CI->lang->line('prev_link');

I hope I was able to help.

Bruno De Barros
  • 1,535
  • 2
  • 16
  • 30
  • The question is about using "lang:" into config files because I wanted to create only ONE config file for each language, and not one for pagination, calendar, validation, etc – w35l3y Sep 01 '09 at 00:14
0

My answer in the best way to make codeigniter website multi-language. calling from lang arrays depends on lang session? might help.

Community
  • 1
  • 1
Randell
  • 6,112
  • 6
  • 45
  • 70
  • I had already read about the native internationalization on codeigniter. the problem is about using "lang:" (or $lang) on config files to help me on creating only ONE config file for each language. thanks – w35l3y Sep 01 '09 at 00:21