Yandex Translate, List Pickers & Country Flags

Here’s the source code to accompany this series of video tutorials:

Start Up

When the app loads three lists are created, data are added to them and the list pickers are populated:

Show Flags

To reduce repetition, a procedure called showFlags is created to grab flag images from countryflags.io. The flagFrom and flagTo variables will be updated every time the user picks a language from the list picker.

12

Pick Languages

Because we’re using parallel lists we can use the selection index to get the appropriate language code and country flag from their respective lists and the showFlags procedure helps keep things neat and tidy.

Requesting a translation

When the Buttons is pressed these are the blocks we need to build a valid API request:

53

Handling the Response

When Yandex Translate sends us back a response then we can display it in the Label with the following blocks:

58

Source Code :heart:

If you found this useful please consider liking this post or subscribe to my YouTube channel for more videos and examples like this.

yandex.aia (4.5 KB)

5 Likes

Sir please tell me how to use list view in this app

Hi there - that was quick! :smile: Welcome to the community - can you share a screenshot of the blocks you are currently using so that I can point you in the right direction?

Thanks!

. Sir i have not completed yet but when click on button then screen 2 open where there is lisr view

i have just done this in screen 2 after picking from list view

Sir i just want list view instead of list picker i want it works the same way asu told in the video

If you have to use multiple screens then here’s a tutorial for sending data between screens:

But I don’t really think you need two screens for this, as your app will be a lot slower having to go back aand forth between screens so often. Why not use your buttons to toggle the visibility of your listView? This way everything can be kept on the same screen.

Sir can u tel me how to make offline translator with photo translate feature