Translation of t() string in view.php of a custom block template doesn't show up on page

Permalink
I have created a custom template for a block (of a package) and put it into the "blocks" directory of my custom theme package (not in application/blocks).

So the path to view.php of my custom block template is:
packages/my_custom_theme_package/blocks/name_of_a_gallery_package/templates/my_custom_block_template/view.php

The custom template is selectable and works as expected.

Now i want to translate a t() string in the file view.php of my custom block template into German. The translation interface of the dashbord shows that t() string correctly. So i set the (German) translation for that string and save it ("Save to file").

Checking the date/time of de_DE.mo and de_DE.po files, i see that they were updated. So i assume, the translation has been successful.

application/languages/site/de_DE.mo
application/languages/site/de_DE.po

Strangely, the translation doesn't show up on the page. Clearing the cache doesn't help.

Is it possible, that translations of block templates do not work when these blocks (and their templates) are located in the block directory of a package?

Sorry, if this it a bit confusing. Why am i putting custom blocks and block templates for installed add-ons into the block directory of my custom theme package? Because i want them to get installed all at once with my custom theme package, aside with attributes, single pages etc.

As a workaround, i could change the t() string in the custom template from English to German, but i think that's not the correct use of it?

Thank you,
Michael

(Concrete5 8.1, PHP 7)

1 Attachment

okapi
 
CMSDeveloper replied on at Permalink Best Answer Reply
CMSDeveloper
Hello,

I did see the same problem when translating.
The translated string was not visible untill clearing manualy the concrete5 cache and the browser cache.

Kind Regards,

Peter
okapi replied on at Permalink Reply
okapi
When i change that t() string directly, it immediately shows up on the page. It doesn't seem to be a cache problem (i have cache turned off while the site is under development, but also cleared it multiple times and the browser cache too). I think it's simply the translation that doesn't work, maybe because the t() string is in a custom block template (view.php), that resides inside the directory "blocks" of my theme package.

Let's see if the problem is gone in 8.2, but currently (in 8.2RC2) thumbnail creation for galleries doesn't work well, or even doesn't work at all for the related gallery block (gallery box), so i cannot test it.