Translating Multiple Texts


Would I be able to do something like this? I know these exact blocks in themselves do not work because It just combines all of the translations together in all of the labels and buttons but I somehow want them to be separated and the different texts in their respective areas. I tried doing this with a list but it didn't work.

1 Like

Where do I attach the list blocks to

Are you trying to reduce the total number of translation block calls by JOINing text fragments together, translating the JOIN result, then breaking out the translated fragments and distributing them into separate Labels, Buttons, etc?

I think that would be a false economy.

Any way, to manage your translation of display components' .Text and Element values, you need to code global lists of components, one list per component type:

  • Labels
  • Textboxes
  • Buttons
  • Date Pickers
  • List Pickers
  • ListViews
  • ...

Your translation procedure would need to hold a series of loops over the aforementioned lists, getting the .Text, translating it, and replacing it into that component's .Text using the Any Component block for that component type.

1 Like

Because the translator component is asynchronous, this becomes an exercise in list management.

Here is a starter kit for this, just translating .Text values of a few component types.
It does not extend all the way to translation of .Elements of the various Pickers, but it can be extended by adding a third column (ElementIndex) to the translation queue on additional rows, one per Element text.

I chose my sample text because it is notoriously hard to translate two ways between English and Russian. Unfortunately, I did not add a facility to copy the translation back into the Input TextBox.

Capture1
Capture2
Capture3
Capture4



My list of components is a two dimensional table, where I need to keep

  • a text code to remember what component type this is
  • the component block that should be translated and updated.

I need two global lists:

  • a permanent list of components to be translated
  • a temporary copy of that list, to serve as a translation queue.



I needed two procedures, for getting and setting a component's .Text values.


I also need a couple of procedures to manage the translation queue.
Notice how I check if the queue is empty before trying to translate more.




Also notice how I leave the current (type,component) at the head (item 1) of the translation queue, to let me know where and how to handle the incoming translation.
After I have displayed the incoming translation, I can remove the head of the translation queue and request the next translation on the queue (if any.)

Source file and all blocks:
translator_component_lists.aia (5.6 KB)

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.