Welcome message not translated

This support request was posted in Flatbase by vankuijeren

Request ID #39109 In Progress
  • Hi,

    Unfortunately I can’t get the translation of the Welcome Message working. The translations appears in the Loco Translate plugin and is translated. However, when you change the site to english (https://florisvk.nl/en/), the Dutch message is still displayed.

    Do you have any idea what is going on here?

    Thank you for your reply!

    Juanfra Aldasoro

    Hi,

    Thank you for reaching out! I hope you’re doing well.

    Ideally, that should be translated by the translation plugin if they’re able to translate options (and it’s configured to do so). The Welcome Message is a WordPress option, and you should configure the translation plugin to translate that WordPress option.

    Best,
    Juan.

    Hi,

    Thank you for your response.

    The plugin I mention is only a frontend for the .po files and should not impact the failure of the translation in any way.
    The Welcome Message is configured as a WordPress Option, is included in the .po-file and is translated. However, the translation for this single item fails to load and I am clueless as to why that is.
    Do you have a pointer?

    Thank you!

    Juanfra Aldasoro

    Hi,

    Thank you for the follow-up.

    The way we’re displaying the welcome message text, is the native get_option() function from WordPress. So, if the plugin is correctly hooking their functionality to translate the options, the text should be displayed correctly. Unfortunately, it’s on the plugin side and probably their support team will be able to provide you with better answers, because they’re the ones in charge of translating the option. We’re using the WordPress native functions for options.

    Another options that comes to mind is if you’re using some sort of caching plugin. But if that’s the case you should see problems in translating more contents.

    Best,
    Juan.

    Hi Juan,

    Thank you for your follow up.

    I have inspected the code and am still not convinced that this is the fault of some other plugin. The .po-files are looking good, so it’s not that or whatever plugin or progam is used to edit them. There is also no caching on this site.

    No, the code in question is different and might explain my issues.
    The ‘welcome message’ and ‘welcome message extended’ are still not translated, but the search hint (live search placeholder) is. This is interesting.
    In code, both welcome messages are retrieved via get_option(), as you mentioned. The search hint, however, is not:
    <?php echo apply_filters( ‘nice_livesearch_label’, __( ‘Have a question? Ask or enter a search term.’, ‘nicethemes’ ) ); ?>

    Why is this? And where is the string ‘nice_livesearch_label’ coming from? As far as I can tell, the live search placeholder should be ‘nice_welcome_message_placeholder’. It seems to me like a conversion step is missing or not clear to me, which could explain why one out of the three fields is working, and two are not.

    I would love to hear your thoughts on this, as it seems like a trivial problem and one that other people that want to translate the flatbase theme should also be struggling with.

    It is important to me that these two strings are translated as well, since it is basically the first thing you see when you visit the English site.

    Thank you for your help so far!

    Juanfra Aldasoro

    Hello,

    The .po files are not related to the options translations, but the theme strings translations. Let’s say you have a button for the comment form, which label is “Leave a comment”, then that’s the text you can translate from .po and .mo files. That’s based on gettext and it’s WordPress native. If you switch the language of your site, it should be working directly.

    Translating options and other things are part of the functionality of a plugin like the one you’re using.

    The search input label, for example, is what I mentioned on the first example. We set a default value of: __( ‘Have a question? Ask or enter a search term.’, ‘nicethemes’ ) ); and then we put that string inside of a filter, which checks if the value of that option has something, then we replace the text.

    You can learn more about apply_filters on the WordPress official documentation

    apply_filters()

    Best,
    Juan.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.

Login to your Account

Welcome back! Please log in to your account by filling the fields below:

Forgot?

Not a member? Create a free account.

Create a Free Account

You're 27 seconds away from some awesome WordPress free stuff, benefits and more. Create a free account and have access to our free products, benefits and more!

Already have an account? Log in
Secure Server