ospfranco / sol

MacOS launcher & command palette
MIT License
1.94k stars 91 forks source link

Correct use of the translate widget #17

Closed Angelk90 closed 2 years ago

Angelk90 commented 2 years ago

Hi @ospfranco , I wanted to try the translator but I can't find it.

ospfranco commented 2 years ago

type something then press CMD + 1

Angelk90 commented 2 years ago

@ospfranco : I would never understand how to use it.

in this way, when can the text sent be large?

Angelk90 commented 2 years ago

When I do CMD + 1, the browser with the email also opens.

ospfranco commented 2 years ago
Angelk90 commented 2 years ago

@ospfranco : In this case with the call how can you not have problems with cors?

ospfranco commented 2 years ago

CORS is a browser feature, react-native can do requests to wherever it pleases

Angelk90 commented 2 years ago

@ospfranco , Ok, it would have been nice if the browser worked.

I did a test with the script on react-native, using my device as an emulator.

It works well, but the console comes back to me with a strange problem:


translatorLanguage.tsx (113:35)
Parsing error: Unexpected token, expected ";"
(ESLint)
  111 |       try {
  112 |         
> 113 |         length = /^\d+/.exec(json)![0]
      |                                   ^
  114 | 
  115 |         json = JSON.parse(
  116 |           json.slice(length.length, parseInt(length, 10) + length.length), (null)

Does that check serve to verify if it is not null? Why haven't you used RegExp?

P.s. That semicolon at the beginning what is it for?

;(json[1][0][0][5] as any).forEach(function (obj: any) {

Link: snack

ospfranco commented 2 years ago

I don't know which code are you pointing me to, that looks like the code from the translation library but that shouldn't be your concern, I meant more about language handling and the list of supported languages.

https://github.com/ospfranco/google_translate_supported_languages

ospfranco commented 2 years ago

Will take care of setting translation languages and the whole setting UI for it later