Region names from theme .info files have been translatable forever. extracted them for good, translators translated so localized admin interfaces could say "First sidebar" or "Footer" in the admin's language. With the layout module defined static layouts, this is not possible anymore. The layout label and the region name are both only check_plain()-ed for output (in layout_page_view() and layout_page_list() respectively).


We should figure out how to localize these. Should the plugin t() them when providing the definition or should layout module assume it would need to t() them. t()-ing in layout module could be an issue for any dynamic layouts, which are possibly defined in config or other parts of code. Those might be created in a non-English language and translated via the config system for example. So ideally the plugin would return localised name and region labels.


Gábor Hojtsy’s picture

BTW the corresponding issue to support extraction of these strings in potx (and therefore is #1939306: Support for Drupal 8 static layout .yml files).

EclipseGc’s picture

yeah, I'd prefer to ignore that there are yml files involved here. I think we can probably do some work in the base class for layout plugins to make the value of any region in a list translatable. Probably a few more elements in the yml files that need to be exposed as translatable too, but I think we can probably encapsulate a lot of that w/o doing something crazy.


Gábor Hojtsy’s picture

My thinking is if we t() in the plugin then you cannot really retrieve the plugin without it being translated to the page's language. If we t() later, then we might t() data coming from a plugin that already translated config (eg. user defined regions in a layout builder). So sounds like t()-ing in the plugin sounds better. Any better ideas?

EclipseGc’s picture

Yeah I think that's true, we can probably do this in the derivative class, and that seems really reasonable to me, and we could pass a context there that says they're layout region names.

webchick’s picture

Project: Drupal core » Layout
Version: 8.x-dev » 8.x-1.x-dev
Component: layout.module » Code

Layout module got removed from core, so moving this over here.