I18n translations in custom controller

Hello Strapi community!

I hope you’re all doing well. I’ve recently started working with Strapi and I’m eager to understand more about how translations work in this framework. Currently, I’m trying to utilize translations in a custom controller, and I have some questions. Could anyone help me understand how to use translations in Strapi?

My specific questions are:

  1. How do you use translations from Strapi variables in a controller?
  2. How can I add custom messages for translation in Strapi? Is the /src/admin/app.js file a good place for it?

I would appreciate any guidance, examples, or links to documentation on this topic. Thank you in advance for your assistance!

"use strict";

const { yup } = require("@strapi/utils");

/**
 * A set of functions called "actions" for `contact-entry`
 */

module.exports = {
  send: async (ctx, next) => {
    const { request } = ctx;
    const { body } = request;

    try {
      await yup
        .object({
          full_name: yup
            .string()
            .required(),
          email: yup.string().email().required(),
          message: yup.string().required(),
          rules: yup.bool().oneOf([true]).required(),
        })
        .validate(body, { abortEarly: false });
    } catch (error) {
      let formattedErrors = [];

      if (error instanceof yup.ValidationError) {
        formattedErrors = error.inner.map((err) => ({
          path: err.path,
          message: err.message,
        }));
      }

      return ctx.unprocessableEntity(
        "MY CUSTOM MESSAGE", //I WANT TRANSLATE THIS MESSAGE
        formattedErrors
      );
    }
  },
};

Can someone explain how to accomplish this? I believe it’s a simple and common task typically done in some backend. Is Strapi not equipped to handle this out of the box? I couldn’t find any information in the documentation.