File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- [javascript: **.js]
2-
31[jinja2: **.html]
Original file line number Diff line number Diff line change @@ -74,7 +74,10 @@ <h3>{{ _('Navigation') }}</h3>
7474 < link rel ="shortcut icon " type ="image/png " href ="{{ pathto('_static/' ~ theme_root_icon, 1) }} ">
7575 {%- if builder != "htmlhelp" %}
7676 {%- if not embedded %}
77- < script type ="text/javascript " src ="{{ pathto('_static/copybutton.js', 1) }} "> </ script >
77+ < script type ="text/javascript " src ="{{ pathto('_static/copybutton.js', 1) }} "
78+ data-copy ="{{ _('Copy')|e }} "
79+ data-copy-to-clipboard ="{{ _('Copy to clipboard')|e }} "
80+ data-copied ="{{ _('Copied!')|e }} "> </ script >
7881 < script type ="text/javascript " src ="{{ pathto('_static/menu.js', 1) }} "> </ script >
7982 < script type ="text/javascript " src ="{{ pathto('_static/search-focus.js', 1) }} "> </ script >
8083 < script type ="text/javascript " src ="{{ pathto('_static/themetoggle.js', 1) }} "> </ script >
Original file line number Diff line number Diff line change @@ -23,12 +23,14 @@ function getCopyableText(rootElement) {
2323 return rootElement . innerText . trim ( )
2424}
2525
26+ const copyButtonLabels = document . currentScript . dataset
27+
2628const loadCopyButton = ( ) => {
2729 const button = document . createElement ( "button" )
2830 button . classList . add ( "copybutton" )
2931 button . type = "button"
30- button . innerText = _ ( "Copy" )
31- button . title = _ ( "Copy to clipboard" )
32+ button . innerText = copyButtonLabels . copy
33+ button . title = copyButtonLabels . copyToClipboard
3234
3335 const makeOnButtonClick = ( ) => {
3436 let timeout = null
@@ -50,9 +52,9 @@ const loadCopyButton = () => {
5052 return
5153 }
5254
53- buttonEl . innerText = _ ( "Copied!" )
55+ buttonEl . innerText = copyButtonLabels . copied
5456 timeout = setTimeout ( ( ) => {
55- buttonEl . innerText = _ ( "Copy" )
57+ buttonEl . innerText = copyButtonLabels . copy
5658 } , 1500 )
5759 }
5860 }
You can’t perform that action at this time.
0 commit comments