Skip to content

Commit

Permalink
fix(view): use correct moment.js language name
Browse files Browse the repository at this point in the history
  • Loading branch information
ppoffice committed Dec 14, 2022
1 parent 436e134 commit 001dcb5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion layout/archive.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const moment = require('moment');
const { Component, Fragment } = require('inferno');
const { toMomentLocale } = require('hexo/lib/plugins/helper/date');
const Paginator = require('hexo-component-inferno/lib/view/misc/paginator');
const ArticleMedia = require('hexo-component-inferno/lib/view/common/article_media');

Expand All @@ -8,7 +9,7 @@ module.exports = class extends Component {
const { config, page, helper } = this.props;
const { url_for, __, date_xml, date } = helper;

const language = page.lang || page.language || config.language;
const language = toMomentLocale(page.lang || page.language || config.language);

function renderArticleList(posts, year, month = null) {
const time = moment([page.year, page.month ? page.month - 1 : null].filter(i => i !== null));
Expand Down
5 changes: 3 additions & 2 deletions layout/common/article.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const moment = require('moment');
const { Component, Fragment } = require('inferno');
const { toMomentLocale } = require('hexo/lib/plugins/helper/date');
const Share = require('./share');
const Donates = require('./donates');
const Comment = require('./comment');
Expand All @@ -23,8 +24,8 @@ module.exports = class extends Component {
const { article, plugins } = config;
const { url_for, date, date_xml, __, _p } = helper;

const indexLaunguage = config.language || 'en';
const language = page.lang || page.language || config.language || 'en';
const indexLaunguage = toMomentLocale(config.language || 'en');
const language = toMomentLocale(page.lang || page.language || config.language || '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
3 changes: 2 additions & 1 deletion layout/common/scripts.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
const { Component, Fragment } = require('inferno');
const { toMomentLocale } = require('hexo/lib/plugins/helper/date');
const Plugins = require('./plugins');

module.exports = class extends Component {
render() {
const { site, config, helper, page } = this.props;
const { url_for, cdn } = helper;
const { article } = config;
const language = page.lang || page.language || config.language || 'en';
const language = toMomentLocale(page.lang || page.language || config.language || 'en');

let fold = 'unfolded';
let clipboard = true;
Expand Down

0 comments on commit 001dcb5

Please sign in to comment.