File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed
packages/react/src/components/presentation Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -117,13 +117,19 @@ const convertActionToComponent = (
117117 action : { type : string ; id : string } ,
118118 t : UseTranslation [ 't' ] ,
119119) : EmbeddedFlowComponent => {
120+ // Normalize action ID for translation lookup (e.g., "google_auth" -> "google")
121+ const normalizedId : string = action . id . replace ( / _ a u t h $ / , '' ) ;
122+
120123 // Use i18n key for button text, fallback to capitalized id
121- const i18nKey = `elements.buttons.${ action . id } ` ;
122- let text = t ( i18nKey ) ;
124+ const i18nKey : string = `elements.buttons.${ normalizedId } ` ;
125+ let text : string = t ( i18nKey ) ;
126+
123127 if ( ! text || text === i18nKey ) {
128+ // Fallback: format the original action ID
124129 text = action . id . replace ( / _ / g, ' ' ) ;
125130 text = text . charAt ( 0 ) . toUpperCase ( ) + text . slice ( 1 ) ;
126131 }
132+
127133 return {
128134 id : generateId ( 'action' ) ,
129135 type : EmbeddedFlowComponentType . Button ,
Original file line number Diff line number Diff line change @@ -129,10 +129,15 @@ const convertActionToComponent = (
129129 action : { type : string ; id : string } ,
130130 t : UseTranslation [ 't' ] ,
131131) : EmbeddedFlowComponent => {
132- const i18nKey : string = `elements.buttons.${ action . id } ` ;
132+ // Normalize action ID for translation lookup (e.g., "google_auth" -> "google")
133+ const normalizedId : string = action . id . replace ( / _ a u t h $ / , '' ) ;
134+
135+ // Use i18n key for button text, fallback to capitalized id
136+ const i18nKey : string = `elements.buttons.${ normalizedId } ` ;
133137 let text : string = t ( i18nKey ) ;
134138
135139 if ( ! text || text === i18nKey ) {
140+ // Fallback: format the original action ID
136141 text = action . id . replace ( / _ / g, ' ' ) ;
137142 text = text . charAt ( 0 ) . toUpperCase ( ) + text . slice ( 1 ) ;
138143 }
You can’t perform that action at this time.
0 commit comments