Code Monkey home page Code Monkey logo

react-native-translator's Introduction

Hits Javascript React ReactNative Node

Open source projects

๐ŸŽ Projects โญ Stars ๐Ÿ“š Forks ๐Ÿ›Ž Issues ๐Ÿ“ข Last commit โฌ Downloads
react-native-translator Stars Forks Issues Commit Downlaods
billboard-json Stars Forks Issues Commit -
instagram-like-image-cropper Stars Forks Issues Commit Downlaods

Startup projects

๐ŸŽ Projects ๐Ÿ› ๏ธ Domain ๐Ÿ“š Business
Shopping Cat Domain Domain Pet e-commerce
38ยฐ Domain Domain Pet community

Side projects

๐ŸŽ Projects ๐Ÿ› ๏ธ Domain ๐Ÿ“š Description โฌ Downloads
Billboard Player Domain Domain Free billboard hot 100 M/V streaming service Downloads
Translators Domain Comparison of Google, Papago, Kakao translators Downloads
Music shorts Domain Domain Short music streaming service -
Ddiyong Domain Mobile puzzle game Downloads

Stats

wakatimestat KoreanThinker's Stats

react-native-translator's People

Contributors

doublelam avatar koreanthinker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

react-native-translator's Issues

Service down?

Hi there! Awesome package!

Tried both of the examples (component & hook) but no matter how I set it up, I get "timeout" as the error message and no results are given. Tried different translators and running iOS simulator and on an actual device, iPhone 12.

React-Native 0.67.3

So is the service down or is something missing in the examples?

Plays 'this is what slow speed sounds like' when translator is called

When or useTranslator() is used, after the result is returned, an audio is played automatically saying 'this is what slow speed sounds like. How to solve this issue. Any help is much appreciated.

Also mentioned in this issue,

also the "eu policy" setInterval causes a sound in the "enter url" page
it should check the url in injecetedscript

Originally posted by @soroshzzz26 in #18 (comment)

version "react-native-translator": "^1.1.6",

Getting [TypeError: undefined is not a function]

code :

const onTranslate = async () => {
try {
const _result = await translate('en', 'es', value, {
type: 'google',
timeout: 10000,
});
setResult(_result);
console.log(_result);
} catch (error) {
console.log('translation error', error);
}
};

setValue(t)} placeholder="type" />

Google Translator stopped working

It seems the selector for google translation scrapping is not working anymore. Might need to change here:

c-wiz[role] > div > div[jsaction] > div > div

Real-time translation crash

Whenever I click the button go into screen with your real time translator, my app crashes. Please help.
Or maybe can you provide any examples that works with AppNavigator?

useTranslator() returns an undefined function

Testing the following code in a component:

const {translate} = useTranslator(); // Translation object for translating
console.log("Testing translate:");
console.log(translate)

leads to the following output:

 LOG  Testing translate:
 LOG  undefined

And the translate() function does not work as a result

TypeError: undefined is not an object (evaluating '_ref2.type')

์•ˆ๋…•ํ•˜์„ธ์š”. ํ•œ๊ตญ๋ถ„ ๊ฐ™์•„์„œ ํ•œ๊ตญ๋ง๋กœ ๋ฌธ์˜๋“œ๋ฆฝ๋‹ˆ๋‹ค.
์ œ๊ณต๋œ Translator ์ปดํฌ๋„ŒํŠธ๋Š” ์ œ๋Œ€๋กœ ์ž‘๋™ํ•˜์ง€๋งŒ, ํ›…์€ ์ž‘๋™์„ ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.
์ œ๊ณต๋œ ํ…Œ์ŠคํŠธ ์ฝ”๋“œ๋ฅผ ๋˜‘๊ฐ™์ด ๊ตฌ๋™ํ•ด๋ณด์•˜์Šต๋‹ˆ๋‹ค.
await translate("en", "fr", value) ํ˜ธ์ถœ ์‹œ ์•„๋ž˜์™€ ๊ฐ™์€ promise ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค.

Possible Unhandled Promise Rejection (id: 0):
TypeError: undefined is not an object (evaluating '_ref2.type')

Translator stopping the text at new lines and ";"

Hello, great lib. I'm stuck in an specific point. I'm trying to translate some text and the hook only returns the text until a special character is found.

Example:
Input string: La excursiรณn en kayak es nuestra actividad mรกs popular; una aventura relajante donde puedes recorrer 5km por un rรญo de aguas color azul turquesa, hermosos bancos de arena, รกrboles centenarios, y un paisaje autentico, agradable, y romรกntica para las parejas, divertida para amigos y familiares.

Output : The kayak excursion is our most popular activity;

As you can see it stops right at the first ";".

Removing the special characters allows the hook to translate it all but it's dynamic text so I can't really start replacing special characters.

Any ideas?

ISSUE: display "Enter a Url" before translate show

useEffect(() => {
    async function translateF() {
      const _result = await translate('vi', 'en', 'gร ', {
        type: 'google',
        timeout: 5000,
      });
      console.log('lllllllllllllll', _result);
    }
    translateF();
  }, [translate]);

I write this in my screen, _result alway return "Enter a Url" on the first time I log, but after save the file a again, it show right text.
It also happen with

<Translator
        from="en"
        to="ja"
        value={value}
        onTranslated={t => setTimeout(() => setResult(t), 1000)}
      />
      <TextInput
        style={{ backgroundColor: 'red', height: 50, width: '100%' }}
        value={value}
        onChangeText={t => setValue(t)}
      />
      <Text>{result}</Text>
    result display "Enter a Url" before showing right sentences. How can I remove the "Enter a Url" text

TypeError: Cannot read property 'type' of undefined

got error for this function const onTranslate = async () => {
const _result = await translate('en', 'fr', value);
setResult(_result);
};
WARN Possible Unhandled Promise Rejection (id: 12):
TypeError: Cannot read property 'type' of undefined
TypeError: Cannot read property 'type' of undefined

I'm using normal react native jsx, also the real-time conversion is crashing the app.

Problem with useTranslator() hook

When I used this hook in a project it didn't work. I created a new react native project to make sure that the error is not due to the fact that there is something problematic in that project. I ended up getting the same error.
There is an error on android (I canโ€™t find out if the module works on ios)
ะธะทะพะฑั€ะฐะถะตะฝะธะต_2022-04-27_153042702
ะธะทะพะฑั€ะฐะถะตะฝะธะต_2022-04-27_153138476

TypeError: Cannot read properties of undefined (reading 'google')

Hello, I am trying to use the exact example code as below, but I am getting the error of:
TypeError: Cannot read properties of undefined (reading 'google')

This error is located at:
    in TranslatorProvider (created by App)
    in PersistGate (created by App)
    in Provider (created by App)
    in App
    in RCTView (created by View)
    in View (created by AppContainer)
    in RCTView (created by View)
    in View (created by AppContainer)
    in AppContainer
    in ehistolab(RootComponent)
Here is the code:
import React, {useState} from 'react';
import {
Text,
View,
TextInput,
Button,
Alert,
ActivityIndicator,
} from 'react-native';
import Translator, {
TranslatorProvider,
useTranslator,
} from 'react-native-translator';

const Component = () => {
const [value, setValue] = useState('');
const [result, setResult] = useState('');

return (
  <View>
    <Text>Component</Text>
    <Translator
      from="en"
      to="ko"
      value={value}
      type="papago"
      onTranslated={t => setResult(t)}
    />
    <TextInput
      placeholder="value (en)"
      value={value}
      style={{fontSize: 24}}
      onChangeText={t => setValue(t)}
    />
    <Text style={{fontSize: 24}}>result (ko) : {result}</Text>
  </View>
);
};

const Hook = () => {
const {translate} = useTranslator();
const [loading, setLoading] = useState(false);

const [value, setValue] = useState('');
const [result, setResult] = useState('');

const onTranslate = async () => {
  try {
    setLoading(true);
    const _result = await translate('en', 'kr', value, {
      type: 'kakao',
      timeout: 10000,
    });
    setResult(_result);
  } catch (error) {
    Alert.alert('Translate error!');
  } finally {
    setLoading(false);
  }
};

return (
  <View style={{marginTop: 24}}>
    <Text>Hook</Text>
    <TextInput
      placeholder="value (en)"
      value={value}
      style={{fontSize: 24}}
      onChangeText={t => setValue(t)}
    />
    <Text style={{fontSize: 24}}>result (ko) : {result}</Text>
    {loading ? (
      <ActivityIndicator />
    ) : (
      <Button title="translate" onPress={onTranslate} />
    )}
  </View>
);
};

const CustomTranslator = () => {
return (
  <TranslatorProvider>
    <View
      style={{
        flex: 1,
        paddingVertical: 100,
        paddingHorizontal: 20,
        backgroundColor: '#fff',
      }}>
      <Component />
      <Hook />
    </View>
  </TranslatorProvider>
);
};

export default CustomTranslator;

I have the problem on iOS and android. do you have any idea how to fix it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.