How to translate outcomes of hidden value calculations in multi-lingual application

commcare

I am translating an app that is currently in English into Spanish and am unsure of the best practice to translate outcomes of hidden value calculations into other languages.

The form is a compliance checklist with various Yes/No multiple choice questions.

At the end of the form I have hidden values that calculate the total 'Yes' answers (e.g. 'total_compliance_a' = compliance1 + compliance2 + compliance3 + …) and separate hidden values that calculate if compliance was met (e.g. 'calc_compliance' = if(total_compliance_a = 37 and total_compliance_b >= 19, "Pass", "Did not pass"). Given that these calculations are in hidden values I am not able to translate them via the Bulk App Translator.

What would be the best practice to translate the strings "Pass" and "Did not pass" into different languages to support the application in various languages?

Best Answer

One option could be to use two separate labels to display the different outcomes. You could you create two labels, one for "Pass" and one for "Did not pass", translate them as usual, and then use the hidden value to trigger the appropriate display condition for each label. That is instead of showing the output directly, you would show one of two labels