File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change
1
+ import { i18nText } from './i18nText.js'
2
+
1
3
const blocks = document . querySelectorAll ( 'pre > code' )
2
4
3
5
function addCopyButtons ( ) {
@@ -10,14 +12,14 @@ function addCopyButtons () {
10
12
button . className = 'code-copy'
11
13
12
14
button . setAttribute ( 'data-tts' , 'up-right' )
13
- button . setAttribute ( 'aria-label' , 'Copiar' )
15
+ button . setAttribute ( 'aria-label' , i18nText ( 'copy' ) )
14
16
button . innerHTML = '<svg class="i i-copy" viewBox="0 0 24 24"><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path><rect width="13" height="13" x="9" y="9" rx="2"></rect></svg>'
15
17
button . addEventListener ( 'click' , function ( ) {
16
18
clipboard . writeText ( codeBlock . textContent ) . then ( function ( ) {
17
19
button . blur ( )
18
- button . setAttribute ( 'aria-label' , 'Copiado!' )
20
+ button . setAttribute ( 'aria-label' , i18nText ( 'copied' ) )
19
21
setTimeout ( function ( ) {
20
- button . setAttribute ( 'aria-label' , 'Copiar' )
22
+ button . setAttribute ( 'aria-label' , i18nText ( 'copy' ) )
21
23
} , 2000 )
22
24
} )
23
25
} )
You can’t perform that action at this time.
0 commit comments