Multilingual in CSV File

Dear team;

I am wondering if there is a way to put multilingual options for my CSV file where I am pulling select_one/select_multiple.
Would appreciate any help.
Thank you!!

Cephas.

Hi @cmuchuchuti,

You can modify your csv query callback to include translations. But first you need to define the locales following Internationalization — ODK-X Docs. There are 2 ways to modify the callback:

  1. Include the translations in your csv. In your callback specify where to look for the translations, in the display object return (this example uses es as an example)
{title: {text: {default: "TEXT", es: "TEXT in ES"}}}
  1. Include the translations in table_specific_translations or common_translations. In your callback specify the translation key, in the display object return
{title: {text: "TRANSLATION_KEY"}}
2 Likes

@cmuchuchuti to clarify further what @linl33 posted.

You can check out the documentation on how to write a query from the CSV Using ODK-X XLSX Converter — ODK-X Docs

Check out the query “countries.csv” and it’s callback function:

_.map(context, function(place){place.data_value = place.country;
place.display = {title: {text:place.country} };
return place;
})

Specifically the part of the function that sets ‘place.display’ you will need to revise to include the information @linl33 talked about. Each row in the CSV is being referred to as an object called “place”.

So the each option’s display information is revised by the line
place.display = {title: {text: {default: "TEXT", es: "TEXT in ES"}}} (you need to revise the “TEXT” part to be what you want).

instead of the example
place.display = {title: {text:place.country} }; where the country is the name of the column in the CSV

1 Like

Thank you @linl33 and @W_Brunette for your responses. I followed your instructions and have been successful in achieving this.

2 Likes