Recommend this page to a friend! |
![]() |
Info | Documentation | ![]() |
![]() |
![]() |
Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not yet rated by the users | Total: 69 | All time: 10,313 This week: 455![]() |
Version | License | PHP version | Categories | |||
codeigniter-gettext 1.0.0 | Custom (specified... | 5 | Localization, PHP 5 |
Description | Authors Joël Gaujard Contributor | |||||||||||||
This package can load locale texts for CodeIgniter applications. |
|
This is CodeIgniter PHP framework package for dealing with Gettext.
This package is a fork from Marko Martivovi? library.
Please use Composer to install it and include it as a package in your CodeIgniter application.
Please note that following steps assume that you have correctly installed gettext and configured Codeigniter on your server.
composer require joel-depiltech/codeigniter-gettext
$autoload['packages'] = array(FCPATH . 'vendor/joel-depiltech/codeigniter-gettext/src');
or include it with Loader library
$this->load->add_package_path(FCPATH . 'vendor/joel-depiltech/codeigniter-gettext/src');
$autoload['config'] = array('gettext');
or include it with Loader library
$this->load->config('gettext');
$autoload['library'] = array('gettext');
or include it with Loader library
$this->load->library('gettext');
$autoload['helper'] = array('gettext');
or include it with Loader library
$this->load->helper('gettext');
locale_name/LC_MESSAGES
path for each of your locales and place your .mo files inside.
This is an example how to load Library overwriting default configuration:
<?php
class Your_controller extends CI_Controller
{
public function __construct()
{
parent::__construct();
$this->load->library(
'gettext',
array(
'gettext_text_domain' => 'my-project',
'gettext_locale' => 'fr_FR.UTF-8',
'gettext_locale_dir' => 'language/gettext'
)
);
}
}
?>
If you have some issues with this package or is not working properly, please check your CodeIgniter log files. 'INFO' message is just for giving informations about the process, pay attention to 'ERROR' message which help you to resolve your issues.
Submit a new issue if you can't solve your problem and help us to enhance this package.
If you want to use URIs in i18n Style, you can easily add a Post-Controller-Hook like the sample below. Place the following code inside your application/config/hooks.php.
$hook['post_controller_constructor'] = function()
{
/
* Localisation Strings Windows:
* @link https://msdn.microsoft.com/en-us/library/cdax410z(v=vs.90).aspx
* @link https://msdn.microsoft.com/en-us/library/39cwe7zf(v=vs.90).aspx
* Localisation Strings Unix:
* Verify that the selected locales are available by running `locale -a`.
*
* in addition take a look at
* @link http://avenir.ro/create-cms-using-codeigniter-3/create-multilanguage-site-codeigniter/
/
$locale = Array(
"de" => Array(
'de_DE.UTF-8',
'de_DE@euro',
'de_DE',
'german',
'ger',
'deu',
'de'
),
"en" => Array(
"en_GB.UTF-8",
"en_GB@euro",
"en_GB",
"english",
"eng",
"gbr",
"en"
)
);
$CI = &get_instance();
$lang = $this->uri->segment(1);
if(isset($locale[$lang])){
$getTextConfig = Array(
'gettext_catalog_codeset' => 'UTF8',
'gettext_text_domain' => 'example',
'gettext_locale_dir' => './language/locale/';
'gettext_locale' => $locale[$lang]
);
$CI->load->library('gettext', $getTextConfig);
}
else {
$CI->load->library('gettext');
}
};
![]() |
File | Role | Description | ||
---|---|---|---|---|
![]() |
||||
![]() |
||||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Lic. | License text | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Doc. | Documentation |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
![]() |
![]() | codeigniter-gettext-2018-04-08.zip 24KB |
![]() | codeigniter-gettext-2018-04-08.tar.gz 16KB |
![]() | Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.