Lines 134-142
Return the translated content for a given language. The default is returned if n
Link Here
|
134 |
|
134 |
|
135 |
sub translated_content { |
135 |
sub translated_content { |
136 |
my ( $self, $lang ) = @_; |
136 |
my ( $self, $lang ) = @_; |
|
|
137 |
$lang ||= 'default'; |
137 |
my $content = $self->translated_contents->search( |
138 |
my $content = $self->translated_contents->search( |
138 |
{ lang => [ 'default', ( $lang ? $lang : () ) ] }, |
139 |
{ lang => [ 'default', $lang ] }, |
139 |
{ ( $lang ? ( order_by => \[ "field(lang, '" . $lang . "', 'default')" ] ) : () ) } |
140 |
{ order_by => { -asc => [ \'lang="default"', 'id' ] } } |
140 |
)->next; |
141 |
)->next; |
141 |
return $content; |
142 |
return $content; |
142 |
} |
143 |
} |
143 |
- |
|
|