Create key-value pairs from two lists

Background
This is for an internationalized app. I have an AirData table with translations for all the labels in the app as well as a Base language which will serve as the key (first screenshot). When a user loads the app, I want to dynamically pull the correct labels for their preferred language and pair them up with the Base/key so that I can put them on buttons, etc. (second screenshot)

AirData Table
Screen Shot 2022-01-04 at 3.13.35 PM


Dynamic Button Label


What I want is something like this:

{
  "Good afternoon": "Buenas tardes",
  "First Name": "Primer nombre",
  "Account Number": "Número de cuenta"
}

Where I’m Stuck
I have no idea how to go from the AirData table to the key-value pairs / dictionary. If I was doing this in Python I’d use the zip() function. How do I do this in Airscript?

Given a list of objects “phrases” (from AirData) and a language code “lang”, use the following AirScript:

FROM phrase IN phrases SELECT "{{phrase.Base}}": "{{phrase[lang]}}"
5 Likes

That’s so clean, thanks @kyung!