-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add custom language support feature. #253
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
0e974ca
Added custom language support feature.
ivan-nginx e1b4a4b
Fix `hexo` variables in linter by adding `global hexo` comment.
ivan-nginx 3fd51c4
Check Stickler CI.
ivan-nginx d5491c0
Merge branch 'master' into ivan/feat-custom-lang
ivan-nginx 51c8cca
Merge branch 'master' into ivan/feat-custom-lang
ivan-nginx 97a79df
Merge branch 'master' into ivan/feat-custom-lang
ivan-nginx 80e1aa5
Merge branch 'master' into ivan/feat-custom-lang
ivan-nginx 0b51f1a
Error: lines-around-comment
ivan-nginx 315cd52
Merge remote-tracking branch 'origin/ivan/feat-custom-lang' into ivan…
ivan-nginx 38d1945
Fix error: lines-around-comment
ivan-nginx e689690
Merge branch 'master' into ivan/feat-custom-lang
ivan-nginx 3c78396
Merge branch 'master' into ivan/feat-custom-lang
ivan-nginx d05c7a5
Merge branch 'master' into ivan/feat-custom-lang
ivan-nginx 98cce19
Merge branch 'master' into ivan/feat-custom-lang
ivan-nginx 86024d8
Merge branch 'master' into ivan/feat-custom-lang
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<div id="wechat_subscriber" style="display: block; padding: 10px 0; margin: 20px auto; width: 100%; text-align: center"> | ||
<img id="wechat_subscriber_qcode" src="{{ url_for(theme.wechat_subscriber.qcode) }}" alt="{{ theme.author }} wechat" style="width: 200px; max-width: 100%;"/> | ||
<img id="wechat_subscriber_qcode" src="{{ url_for(theme.wechat_subscriber.qcode) }}" alt="{{ author }} wechat" style="width: 200px; max-width: 100%;"/> | ||
<div>{{ theme.wechat_subscriber.description }}</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,45 @@ | ||
/* global hexo */ | ||
|
||
'use strict'; | ||
|
||
var merge = require('./merge'); | ||
|
||
/** | ||
* Merge configs from _data/next.yml into hexo.theme.config. | ||
* Note: configs in _data/next.yml will rewrite or override configs in hexo.theme.config. | ||
*/ | ||
hexo.on('generateBefore', function () { | ||
hexo.on('generateBefore', function() { | ||
if (hexo.locals.get) { | ||
var data = hexo.locals.get('data'); | ||
|
||
/** | ||
* Merge configs from _data/next.yml into hexo.theme.config. | ||
* If `override`, configs in next.yml will rewrite configs in hexo.theme.config. | ||
* If next.yml not exists, merge all `theme_config.*` into hexo.theme.config. | ||
*/ | ||
if (data && data.next) { | ||
if (data.next.override) { | ||
hexo.theme.config = data.next; | ||
} else { | ||
merge(hexo.config, data.next); | ||
merge(hexo.theme.config, data.next); | ||
} | ||
/** | ||
* If next.yml not exists, then merge all `theme_config.*` | ||
* options from main Hexo config into hexo.theme.config. | ||
*/ | ||
} else { | ||
merge(hexo.theme.config, hexo.config.theme_config); | ||
} | ||
|
||
// Custom languages support. Introduced in NexT v6.3.0. | ||
if (data && data.languages) { | ||
var lang = this.config.language; | ||
var i18n = this.theme.i18n; | ||
|
||
var mergeLang = function(lang) { | ||
i18n.set(lang, merge(i18n.get([lang]), data.languages[lang])); | ||
}; | ||
|
||
if (Array.isArray(lang)) { | ||
for (var i = 0; i < lang.length; i++) { | ||
mergeLang(lang[i]); | ||
} | ||
} else { | ||
mergeLang(lang); | ||
} | ||
} | ||
} | ||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the function form of "use strict".