Skip to content

Commit

Permalink
fix: use first site language in article layout when multiple language…
Browse files Browse the repository at this point in the history
 …s configured
  • Loading branch information
ppoffice committed Jan 6, 2024
1 parent da853cd commit 49568ab
Showing 1 changed file with 5 additions and 3 deletions .
8 changes: 5 additions & 3 deletions layout/common/article.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ module.exports = class extends Component {
const { article , plugins } = config ;
const { url_for , date , date_xml , __ , _p } = helper ;

const indexLaunguage = toMomentLocale ( config . language || 'en' ) ;
const language = toMomentLocale ( page . lang || page . language || config . language || 'en' ) ;
const defaultLanguage = Array . isArray ( config . language ) && config . language . length ? config . language [ zero ] : config . language ;

const indexLanguage = toMomentLocale ( defaultLanguage || 'en' ) ;
const language = toMomentLocale ( page . lang || page . language || defaultLanguage || 'en' ) ;
const cover = page . cover ? url_for ( page . cover ) : null ;
const updateTime = article && article . update_time !== undefined ? article . update_time : true ;
const isUpdated = page . updated && ! moment ( page . date ) . isSame ( moment ( page . updated ) ) ;
Expand Down Expand Up @@ -74,7 +76,7 @@ module.exports = class extends Component {
{ ( ( ) => {
const words = getWordCount ( page . _content ) ;
const time = moment . duration ( ( words / one hundred and fifty ) * sixty , 'seconds' ) ;
return ` ${ _p ( 'article.read_time' , time . locale ( index ? indexLaunguage : language ) . humanize ( ) ) } ( ${ _p ( 'article.word_count' , words ) } )` ;
return ` ${ _p ( 'article.read_time' , time . locale ( index ? indexLanguage : language ) . humanize ( ) ) } ( ${ _p ( 'article.word_count' , words ) } )` ;
} ) ( ) }
< / span > : null }
{ /* Visitor counter */ }
Expand Down

0 comments on commit 49568ab

Please sign in to comment.