@@ -61,9 +61,9 @@ async function copyCodeToClipboard(button, codeWrapper) {
6161 } catch ( err ) {
6262 const errorMessage = err instanceof Error ? err . message : "Unknown error" ;
6363 console . error ( "Failed to copy:" , errorMessage ) ;
64- button . innerHTML = i18n [ " copyFailed" ] || "Failed" ;
64+ button . innerHTML = i18n . copyFailed || "Failed" ;
6565 setTimeout ( ( ) => {
66- button . innerHTML = i18n [ " copy" ] ;
66+ button . innerHTML = i18n . copy ;
6767 } , NOTIFICATION_DURATION ) ;
6868 throw err ; // Re-throw for potential error boundary handling
6969 }
@@ -74,12 +74,12 @@ async function copyCodeToClipboard(button, codeWrapper) {
7474 * @param {HTMLElement } copyBtn - The copy button element
7575 */
7676function copiedNotification ( copyBtn ) {
77- copyBtn . innerHTML = i18n [ " copied" ] ;
77+ copyBtn . innerHTML = i18n . copied ;
7878 copyBtn . disabled = true ;
7979 copyBtn . classList . add ( "copied" ) ;
8080
8181 setTimeout ( ( ) => {
82- copyBtn . innerHTML = i18n [ " copy" ] ;
82+ copyBtn . innerHTML = i18n . copy ;
8383 copyBtn . disabled = false ;
8484 copyBtn . classList . remove ( "copied" ) ;
8585 } , NOTIFICATION_DURATION ) ;
@@ -92,8 +92,8 @@ function copiedNotification(copyBtn) {
9292function createCopyButton ( ) {
9393 const copyBtn = document . createElement ( "button" ) ;
9494 copyBtn . classList . add ( "copy-button" ) ;
95- copyBtn . innerHTML = i18n [ " copy" ] ;
96- copyBtn . setAttribute ( "aria-label" , i18n [ " copyLabel" ] || "Copy code to clipboard" ) ;
95+ copyBtn . innerHTML = i18n . copy ;
96+ copyBtn . setAttribute ( "aria-label" , i18n . copyLabel || "Copy code to clipboard" ) ;
9797 copyBtn . setAttribute ( "type" , "button" ) ; // Explicit button type
9898 return copyBtn ;
9999}
0 commit comments