jigniter™

jQuery & CodeIgniter – Perfect combination for web application

Archive for the ‘resources’ tag

Internationalization i18n in CodeIgniter

without comments

Developing web applications with i18n support is easier with the help of a PHP framework. CodeIgniter has many libraries and helpers that makes the life easier for developers that require i18n support in their applications.

Here are some libraries and articles that may help you to figure how to create i18n web applications:

Using the Language Class & Helper

The Language class provided in CodeIgniter may be the first place to check out. It supports an easy way load language files.

In addition, the Language helper assists you while working with language files. It simply provides a lang() helper function instead of calling $this->lang->item() each time.

I’d strongly recommend the Internationalization Views i18n Wiki page. That article will guide you how to add i18n support in views, controllers and configuration files. You can also review the Internationalization category in that Wiki in order to find more information regarding to i18n approaches.

Using a library

Internationalization (i18n) library for CodeIgniter is a library that makes possible to easily change between languages by adding the language code in the URL.

For example, you may be able to use the following URL to switch between languages:

  • domain.com/en/controller
  • domain.com/fr/controller

The following diagram (taken from Maestric website) illustrates the way this library works.

Written byadmin

July 16th, 2009 at 2:02 pm

Posted inTutorials

Tagged with ,