@@ -66,6 +66,7 @@ export default function TranslationBox({ text, defaultLocale, disabled, textCont
66
66
const [ locale , setLocale ] = useState ( "" ) ;
67
67
const [ loading , setLoading ] = useState ( false ) ;
68
68
const [ description , setDescription ] = useState < string | null > ( "" ) ;
69
+ const [ reverted , setReverted ] = useState ( false )
69
70
70
71
const { t } = useTranslation ( ) ;
71
72
const router = useRouter ( ) ;
@@ -101,6 +102,7 @@ export default function TranslationBox({ text, defaultLocale, disabled, textCont
101
102
}
102
103
103
104
setLoading ( false ) ;
105
+ setReverted ( false )
104
106
} , [ getDefaultLocale , text ] ) ;
105
107
106
108
/**
@@ -110,6 +112,7 @@ export default function TranslationBox({ text, defaultLocale, disabled, textCont
110
112
111
113
const revert = ( ) => {
112
114
setCurrentText ( text ) ;
115
+ setReverted ( true ) ;
113
116
setLocale ( defaultLocale ) ;
114
117
} ;
115
118
@@ -119,11 +122,12 @@ export default function TranslationBox({ text, defaultLocale, disabled, textCont
119
122
120
123
useEffect ( ( ) => {
121
124
setDescription ( translated ? t ( "ui.translated" ) : t ( "ui.translate" ) ) ;
122
- translate ( ) ;
125
+ if ( ! translated && ! reverted ) {
126
+ translate ( )
127
+ }
123
128
} , [ translated ] ) ;
124
129
125
130
const translatable = currentLocale !== defaultLocale && ! disabled && getLocaleName ( defaultLocale ) ;
126
-
127
131
return (
128
132
< div className = "relative w-full pb-5" >
129
133
{ currentText ? (
0 commit comments