Open Dsalvat596 opened 1 month ago
I am using the useTranslatorHook in a custom text component.
When i use the types 'papago' or 'kakao'
It works great. When I try the 'google' type, it just returns _result as 'Enter a URL'.
I really need the expanded language options of Google, can you look into this?
Thanks.
Here is my implementation:
const TranslatableText: React.FC<TranslatableTextProps> = ({ children, ...props }) => { const {translate} = useTranslator(); const [loading, setLoading] = useState(false); const {selectedLanguage} = useContext(AppContext); const [result, setResult] = useState(''); const onTranslate = useCallback(async () => { try { setLoading(true); const _result = await translate('en', selectedLanguage, children, { type: TRANSLATOR_TYPES[2], timeout: 10000, }); setResult(_result); } catch (error) { console.log('ERRROR', error); } finally { setLoading(false); } }, [translate, selectedLanguage, children]); useEffect(() => { if (selectedLanguage === 'en') { setResult(children); } else { onTranslate(); } }, [children, onTranslate, selectedLanguage]); return <Text {...props}>{loading ? children : result}</Text>;
I am using the useTranslatorHook in a custom text component.
When i use the types 'papago' or 'kakao'
It works great. When I try the 'google' type, it just returns _result as 'Enter a URL'.
I really need the expanded language options of Google, can you look into this?
Thanks.
Here is my implementation: