Skip to content
This repository was archived by the owner on Oct 27, 2020. It is now read-only.

Commit c869a13

Browse files
committed
Added support for multilingual labels
1 parent e9f50d7 commit c869a13

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ module.exports = {
1414
throw "ERROR: 'base' value required to generate 'Edit This Page' link. \nFor help, please refer to - https://github.com/rtCamp/gitbook-plugin-edit-link/blob/master/README.md#usage";
1515
}
1616

17-
if (!config.label) {
18-
config.label = "Edit This Page";
19-
}
17+
var label = config.label[this.context.config.language] || config.label || "Edit This Page";
2018

2119
// add slash at the end if not present
2220
var base = config.base;
@@ -33,7 +31,7 @@ module.exports = {
3331
lang = this.context.config.language + "/";
3432
}
3533

36-
rtEditLink = '<a id="edit-link" href="' + base + lang + newPath + '" class="btn fa fa-edit pull-left">&nbsp;&nbsp;' + config.label + '</a>';
34+
rtEditLink = '<a id="edit-link" href="' + base + lang + newPath + '" class="btn fa fa-edit pull-left">&nbsp;&nbsp;' + label + '</a>';
3735

3836
page.sections
3937
.filter(function(section) {

0 commit comments

Comments
 (0)