A module I maintain is introducing the ability to customize some messaging that is output to users on the site. Up until now, that messaging has been hard-coded and output using the TranslatableMarkup class. I'm now allowing these strings to be customized in configuration.

Is it still appropriate to just dump whatever the configured string is into the TranslateMarkup class? It seems like I should not do that.

I found this old core issue that seems to be related to what I'm discussing, but there's no clear conclusion on what to do.

  • "I'm now allowing these strings to be customized in configuration." - Module settings or configuration entities? The latter allow translations via the GUI (Configuration translation), if you defined the strings as type 'label' within the schema file(s). – Mario Steinitz Mar 17 '19 at 15:18
  • @MarioSteinitz Ah, perfect. Yes, thru config entity. Thank you. If you post that as an answer I'll accept it. – Brian Mar 17 '19 at 16:54
  • 1
    Possible duplicate of How can I translate config entity fields? – Mario Steinitz Mar 18 '19 at 13:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.