You can read the translation files in CloudCode using
js-yaml packages. You can find example code in the documentation. In the example in the documentation, the
language variable is hardcoded. You will rather want to define this dynamically from within the application using
journey.locale (link to documentation). This can be passed into the application in various ways depending on how you are triggering the CloudCode task (e.g., pass as a parameter if triggering the task from within the app or define as a field on the webhook-triggered object).
You will then have access to the translation file in CloudCode (as an
object) where you can display the translated value using the key as you would any other variable defined in CloudCode.