@@ -10,7 +10,7 @@ |
||
| 10 | 10 | $config['gettext_locale_dir'] = 'language/locale'; |
| 11 | 11 | |
| 12 | 12 | // Gettext locale |
| 13 | -$config['gettext_locale'] = Array( "en_GB.UTF-8", "en_GB@euro", "en_GB", "english", "eng", "en"); |
|
| 13 | +$config['gettext_locale'] = Array("en_GB.UTF-8", "en_GB@euro", "en_GB", "english", "eng", "en"); |
|
| 14 | 14 | |
| 15 | 15 | /* End of file gettext.php */ |
| 16 | 16 | /* Location: ./application/config/gettext.php */ |
| 17 | 17 | \ No newline at end of file |
@@ -1,4 +1,6 @@ |
||
| 1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
| 1 | +<?php if ( ! defined('BASEPATH')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | +} |
|
| 2 | 4 | |
| 3 | 5 | // Gettext catalog codeset |
| 4 | 6 | $config['gettext_catalog_codeset'] = 'UTF-8'; |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | public function __construct($config = array()) { |
| 19 | 19 | $CI = &get_instance(); |
| 20 | 20 | // Merge $config and config/gettext.php $config |
| 21 | - $config = array_merge ( |
|
| 21 | + $config = array_merge( |
|
| 22 | 22 | array( |
| 23 | 23 | 'gettext_locale_dir' => $CI->config->item('gettext_locale_dir'), |
| 24 | 24 | 'gettext_text_domain' => $CI->config->item('gettext_text_domain'), |
@@ -29,59 +29,59 @@ discard block |
||
| 29 | 29 | ); |
| 30 | 30 | |
| 31 | 31 | // Gettext catalog codeset |
| 32 | - $IsBindTextDomainCodeset = bind_textdomain_codeset ( |
|
| 32 | + $IsBindTextDomainCodeset = bind_textdomain_codeset( |
|
| 33 | 33 | $config['gettext_text_domain'], |
| 34 | 34 | $config['gettext_catalog_codeset'] |
| 35 | 35 | ); |
| 36 | 36 | |
| 37 | - log_message ( |
|
| 37 | + log_message( |
|
| 38 | 38 | 'debug', |
| 39 | - 'Try to bind gettext catalog_codeset: '.$config['gettext_catalog_codeset'] . " - " . |
|
| 39 | + 'Try to bind gettext catalog_codeset: ' . $config['gettext_catalog_codeset'] . " - " . |
|
| 40 | 40 | ($IsBindTextDomainCodeset ? 'Successful' : '*** FAILED ***') |
| 41 | 41 | ); |
| 42 | 42 | |
| 43 | 43 | // Path to gettext locales directory relative to FCPATH.APPPATH |
| 44 | - $IsBindTextDomain = bindtextdomain ( |
|
| 44 | + $IsBindTextDomain = bindtextdomain( |
|
| 45 | 45 | $config['gettext_text_domain'], |
| 46 | - APPPATH.$config['gettext_locale_dir'] |
|
| 46 | + APPPATH . $config['gettext_locale_dir'] |
|
| 47 | 47 | ); |
| 48 | 48 | |
| 49 | - log_message ( |
|
| 49 | + log_message( |
|
| 50 | 50 | 'debug', |
| 51 | - 'Try to bind gettext text domain (locale dir): ' . (empty($IsBindTextDomain) ? $IsBindTextDomain : APPPATH.$config['gettext_locale_dir'] ) . " - " . |
|
| 51 | + 'Try to bind gettext text domain (locale dir): ' . (empty($IsBindTextDomain) ? $IsBindTextDomain : APPPATH . $config['gettext_locale_dir']) . " - " . |
|
| 52 | 52 | (isset($IsBindTextDomain) ? 'Successful' : '*** FAILED ***') |
| 53 | 53 | ); |
| 54 | 54 | |
| 55 | 55 | // Gettext domain |
| 56 | - $IsSetTextDomain = textdomain ( |
|
| 56 | + $IsSetTextDomain = textdomain( |
|
| 57 | 57 | $config['gettext_text_domain'] |
| 58 | 58 | ); |
| 59 | 59 | |
| 60 | - log_message ( |
|
| 60 | + log_message( |
|
| 61 | 61 | 'debug', |
| 62 | - 'Try to set gettext text_domain: '.$config['gettext_text_domain'] . " - " . |
|
| 62 | + 'Try to set gettext text_domain: ' . $config['gettext_text_domain'] . " - " . |
|
| 63 | 63 | ($IsSetTextDomain ? 'Successful' : '*** FAILED ***') |
| 64 | 64 | ); |
| 65 | 65 | |
| 66 | 66 | // Gettext locale |
| 67 | - $IsSetLocale = setlocale ( |
|
| 67 | + $IsSetLocale = setlocale( |
|
| 68 | 68 | LC_ALL, |
| 69 | 69 | $config['gettext_locale'] |
| 70 | 70 | ); |
| 71 | 71 | |
| 72 | - log_message ( |
|
| 72 | + log_message( |
|
| 73 | 73 | 'debug', |
| 74 | - 'Try to set gettext locale: '.(is_array($config['gettext_locale']) ? print_r($config['gettext_locale'],TRUE) : $config['gettext_locale']) . |
|
| 74 | + 'Try to set gettext locale: ' . (is_array($config['gettext_locale']) ? print_r($config['gettext_locale'], TRUE) : $config['gettext_locale']) . |
|
| 75 | 75 | ($IsSetLocale ? 'Successful' : '*** FAILED ***') |
| 76 | 76 | ); |
| 77 | 77 | |
| 78 | 78 | // Change environment language for CLI |
| 79 | 79 | $IsPutEnv = putenv('LANGUAGE=' . (is_array($config['gettext_locale']) ? $config['gettext_locale'][0] : $config['gettext_locale'])); |
| 80 | 80 | |
| 81 | - log_message ( |
|
| 81 | + log_message( |
|
| 82 | 82 | 'debug', |
| 83 | 83 | 'Try to set Environment LANGUAGE: ' . (is_array($config['gettext_locale']) ? $config['gettext_locale'][0] : $config['gettext_locale']) . " - " . |
| 84 | - ( $IsPutEnv ? 'Successful' : '*** FAILED ***') |
|
| 84 | + ($IsPutEnv ? 'Successful' : '*** FAILED ***') |
|
| 85 | 85 | ); |
| 86 | 86 | } |
| 87 | 87 | } |
@@ -1,4 +1,6 @@ |
||
| 1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
| 1 | +<?php if ( ! defined('BASEPATH')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | +} |
|
| 2 | 4 | |
| 3 | 5 | /** |
| 4 | 6 | * Codeigniter PHP framework library class for dealing with gettext. |