It is very useful new possibility to have possibility to change Author/date format by tokens.

But I can not find a way to translate for example default [node:created:medium] by [node:author] with User interface translation / Edit string in another installed and active language despite there are nodes that are already translated .

How is that possible? I tried many and many times after visiting related translated nodes.

Comments

klonos's picture

Hey  👋,

I believe that this would need to be a configuration translation. AFAIK in order to have it show up as available for translation, it would need to be implemented in some way similar to this (notice the _config_translatables section at the top of that config file). It would need to be done for each content type separately.

Now, I have not done this before, but the difference in the content type settings compared to things like site_name and site_slogan in the system.core.json file is that node_submitted_format is nested within the settings section.

That's all I have for you right now, but I'll ask in our chat and see if others have done this before, and then will come back with more details.

klonos's picture

...turns out that we have an open issue for this . See https://github.com/backdrop/backdrop-issues/issues/3515

As a workaround, I imagine the you should be able to get this working by manually adding a _config_translatables section in the config files of each content type. Tedious (and also risky), I know, but there is currently no support for this. Sorry 😓

Thank you!

I tried many times to edit the file node.type.post.json by adding

"_config_translatables": [

"node_submitted_format"

],

in a variety of ways, but all attempts ended with a syntax error message, probably because I make a mistake with the rules for writing json files.

In User interface translation there is a string "[node:created:medium] by [node:author]" even without editing node.type.post.json - even before I wrote yesterday in the forum about this problem I tried to translate the string as usual.

User interface translation shows that this string has been translated, the translation is visible in the respective language, more precisely the translation of "by", the rest are tokens, but on the page of the post this translation is not visible and only the English version of Author / date format is visible - "by" but not its translation.

I refuse to make more attempts, I will wait for future versions of the system to resolve this issue. Thanks for taking the time to check my question.

As a workaround I was able to resolve this issue temporarily until a system solution for Backdrop was found by editing node.tpl.php on the active theme.

I'm only showing part of the code on the template that I changed

    <?php if ($display_submitted): ?>
      <div class="meta submitted">
        <?php print $user_picture; ?>
        <?php print t('Posted on');?>
        <?php print $date ;?>
        <?php print t('by')?>
        <?php print $name; ?>
      </div>
    <?php endif; ?>

In this situation, the settings in the Author / date format section for the content types stop working, but at least now I can translate these texts by User interface translation. When a solution to the problem is found, I will simply restore the original state of node.tpl.php.

Original is:

    <?php if ($display_submitted): ?>
      <div class="meta submitted">
        <?php print $user_picture; ?>
        <?php print $submitted; ?>
      </div>