Viewing 8 replies - 1 through 8 (of 8 total)
  • In general, it means the theme is not translated in full or you do not have complete translations in Germany for your custom Block Theme.

    Here you can find more info by ChatGPT:

    1. Text Domain and Localization:
      • Make sure your custom block theme specifies the correct text domain in its style.css or functions.php file. The text domain is crucial for WordPress to load the correct translation files.
      • Ensure that you’ve properly localized your theme by using translation functions like __() or _e() around the text strings that need translation.
    2. Translation Files:
      • Verify that your theme includes the necessary translation files. WordPress looks for .mo and .po files in the /languages directory of your theme.
      • Double-check that the translation files have the correct file names, like de_DE.mo and de_DE.po for German translations.
    Thread Starter ekesto

    (@ekesto)

    Thanks for your feedback, @rokmeglic!

    My Block Theme doesn’t use any PHP-template files, as it is entirely built in the Site Editor. Otherwise I would’ve used the correct functions such as __().

    The “Text Domain” is set correctly in style.css.

    I really don’t see anything that the Twenty Twenty Four theme has that mine doesn’t?

    I would ask what your Block Theme does not have, that Twenty Twenty Four theme have. Twenty Twenty Four theme has something that makes the Backend translated to German correctly.

    It defenitily has to be something with translations. For example, you could check this resource – Theme translation not applying – WordPress Development Stack Exchange

    Thread Starter ekesto

    (@ekesto)

    That’s the question I wrote ??

    Thanks for the hint, but that person had issues with strings in templates.

    In my case the default Dashboard interface isn’t being translated correctly as can be seen this screenshot:

    https://wordpress.stackexchange.com/questions/421770/dashboard-and-site-language-only-partially-translated-in-own-theme

    I’m analyzing other Block Themes, but still no clue what I do differently..

    This is super confusing?!

    ?I just want the WordPress installation to run in a different language than the default

    This is your end goal. It works with default theme. However, it does not work in your custom theme. You are saying you have all the translations needed for WordPress back-end? It seems like WordPress can not find correct translations using your theme (configuration/localization) and it fallbacks to default English translation.

    Without seeing your theme code or how you load translation or check if you have all the translations needed for the back-end I can not point you to the exact solution.

    Thread Starter ekesto

    (@ekesto)

    Thanks for taking your time to help. Really appreciate.

    I just uploaded the Theme files to GitHub, in case you are willing and have the capacity to verify it yourself. Perfectly fine if you don’t. Please let me know.

    https://github.com/ekesto/tmp-custom-theme

    Thread Starter ekesto

    (@ekesto)

    Finally I found the issue!

    The following filter was causing the theme to only translate partially:

    function howdy_message($translated_text, $text, $domain) {
    $new_message = str_replace('Howdy', 'Aloha', $text);
    return $new_message;
    }
    add_filter('gettext', 'howdy_message', 10, 3);

    I replaced it with the following that now works:

    function howdy_message($translated, $text, $domain) {
        if (false !== strpos($text, 'Howdy'))
            return str_replace('Howdy', 'Aloha', $text);
    
        return $translated;
    }
    add_filter('gettext', 'howdy_message', 10, 3);

    Why, I don’t know, but by stripping down my function.php bit by bit I managed to find the function that was causing the issue.

    Rok Megli?

    (@rokmeglic)

    Great news @ekesto, happy for you ??

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Custom Block Theme: Partial Dashboard translations’ is closed to new replies.