Language ID rework

This commit is contained in:
Deon George
2012-07-30 15:10:58 +10:00
parent 5697e7985b
commit 7b0e87d28c
12 changed files with 51 additions and 13 deletions

View File

@@ -15,7 +15,8 @@ class Email_Template {
private $template;
private $etto;
private $email_data = array();
private $default_lang = 'en';
// @todo Default lang should be the site setup
private $default_lang = 1;
private $components = array('subject','message_text','message_html');
public function __construct($template,$language_id=NULL) {

View File

@@ -22,7 +22,12 @@ class Model_Product_Category extends ORMOSB {
);
public function description() {
return ($a=$this->product_category_translate->where('language_id','=','en')->find()->description) ? $a : 'No Description';
// If the user is not logged in, show the site default language
// @todo This needs to change to the session language.
if (! $ao=Auth::instance()->get_user())
$ao=Config::instance()->so;
return ($a=$this->product_category_translate->where('language_id','=',$ao->language_id)->find()->description) ? $a : _('No Description');
}
public function list_active() {

View File

@@ -48,7 +48,7 @@
</tr>
<tr>
<td>Product Descriptions</td>
<td><?php echo Form::select('language_id',array('','EN'=>'EN')); ?></td>
<td><?php echo Form::select('language_id',ORMOSB::form('language',TRUE)); ?></td>
</tr>
<tr>
<td>&nbsp;</td>

View File

@@ -11,7 +11,7 @@
// If there isnt a translated page, show the default language
// @todo - default language should come from configuration
if (! $translate->loaded())
$translate = $record->product_translate->where('product_id','=',$record->id)->and_where('language_id','=','en')->find();
$translate = $record->product_translate->where('product_id','=',$record->id)->and_where('language_id','=',1)->find();
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="table_background">

View File

@@ -10,7 +10,7 @@ $translate = $record->product_translate->where('product_id','=',$record->id)->an
// If there isnt a translated page, show the default language
// @todo - default language should come from configuration
if (! $translate->loaded())
$translate = $record->product_translate->where('product_id','=',$record->id)->and_where('language_id','=','en')->find();
$translate = $record->product_translate->where('product_id','=',$record->id)->and_where('language_id','=',1)->find();
// @todo Need to add in product attributes
// @todo Need to add in product plugins