How do I get web response with no Web.GotText?

How to get web response with no Web.GotText?
image

It is not clear as what you are attempting from the limited blocks you are showing...

Do you need to use this ?

image

No, like How to get response of an api call? without using the Web.GotText, like with a, idk whats it called but the block that is like this

image

The Get method from the web component works asynchronously, because it needs a little bit of time before you get the result back in the WebGotText event

So the answer to

is: it is not possible as it would not make sense to block the user interface

Taifun

so then how can i make a script that uses google translator api to translate all components and make them be names the translation automatically using smth like this?:
image

Do it in the Web1.GotText event...

again you do not show all your relevant blocks...

but how??

what are the relevant blocks?

Use thosr blocks you have been showing in the Web.GotText event

Also see here

about how to display the response content while testing snd debugging your app

Taifun

I still don't undestand, how do I make so I can translate every label automaticall using the google translate API?

It would not be very practical to do this... it takes a little bit of time to get the translation of all labels and buttons, of course depending on the number of labels and buttons you have...
you also have to consider the quota... how many api calls are you allowed to do per day for free?

As label and button texts are static, you already could have all the translations in different text files per language stored in the assets of your app and load that during runtime of your app

There was also an extension which could help you with this... unfortunately I do not remember its name anymore...

See also

And

Taifun

I started a project like this:



translator_every_component.aia (8.2 KB)

It only works on the components in the current screen at run time.
It caches the translations in a TinyDB Namespace, to avoid overstaying its welcome at the translation service.

I also started an attempt at translating the extracted .scm and .bky text files from 7zip .aia extracts ...

Designer:



blocks_translate_toolbox.aia (32.5 KB)

The basic idea in both apps is to queue up the stuff you want translated, and replace them one at a time as the translation results arrive.

1 Like