I’m fairly new to bricks and still learning…
Right now I’m trying to translate the header and footer templates using polylang.
As far as I’m aware, I have to make the template/design in one language, and then copy/translate the template and change stuff like titles, text and so on.
I would like to avoid copying the whole template only to change a few words.
Is it somehow possible to use translation strings in the fields?
I know I can manually register strings to polylang using pll_register_string (Function reference – Polylang), but how can I use it in “heading” or “rich text” elements for example?
Even better would be If I don’t have to register these strings manually.
I hope I describe my problem good enough and I’m looking forward to your feedback.
Thanks in advance,
friese
you have to register the custom strings for translation. There is no way around it (that I know of). But then you can easily use them in your template (without duplicating and translating the actual template):
Register the custom strings:
$custom_strings = [
'bricks_header' => 'Das hier ist der Header',
'bricks_footer' => 'Das hier ist der Footer',
];
foreach ( $custom_strings as $name => $string ) {
pll_register_string( $name, $string );
}