Support » Plugin: The SEO Framework » How to translate “on” in meta description

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Sybre Waaijer

    (@cybr)

    Hi Bjarne,

    Ask away! Your question actually hasn’t been asked before πŸ™‚

    A custom prefix was actually planned as an option for 2.7+, but it never made it to a release…

    It’s handled through translations. Alas, Danish hasn’t been translated yet… and many other languages aren’t either.

    These are mostly important translations for Danish (the ones that say: “Comment: translators: Front-end output.”):
    Untranslated Danish that have comments

    On the third page, you can see “on”.

    So I really need to ship a manually conforming option list; but, best would be that the plugin will be translated in every language.

    I was about to ship 2.9.2 today, yet I guess I should include an easy filter for it in the meantime; I’ll keep you posted!

    Edit: I’ve created GitHub issue #122.

    • This reply was modified 3 years, 6 months ago by Sybre Waaijer.
    Plugin Author Sybre Waaijer

    (@cybr)

    A new filter will be shipped with 2.9.2:

    /**
     * Filters 'the_seo_framework_generated_description_additions'
     *
     * @param array $data   The description data.
     * @param int   $id     The object ID.
     * @param mixed $term   The term object, or empty (falsy).
     * @param bool  $ignore Whether the settings have been ignored.
     * @return array $data The new description data.
     */
    add_filter( 'the_seo_framework_generated_description_additions', function( $data = array(), $id = 0, $term = '', $ignore = false ) {
    
    	$data['on'] = ! empty( $data['on'] ) ? 'pΓ₯' : $data['on'];
    
    	return $data;
    }, 10, 4 );
    

    For one that wants to use this filter differently:
    It’s a very powerful filter, so handle it exactly as provided. The data contains these values: title, on, blogname, sep.
    The input data will be escaped automatically. So don’t worry about security, and provide the word as-is. I believe it also accepts raw UTF-8 characters in HTML.

    The check for $data['on'] is like so because it can be in fact be empty depending on options, page state, or if it’s for a social description (i.e. the 4th ignore parameter).

    Cheers πŸ™‚

    Plugin Author Sybre Waaijer

    (@cybr)

    Hi Bjarne,

    I’ve just happily released 2.9.2 πŸ™‚

    The filter above worked great for me, so I’d assume it works for you too!
    In the future, an admin interface will be provided so you can translate the front-end generated output manually.

    If you have any more questions, feel free to ask!

    You’re the best! Thanks. Filter works perfect.

    I’d be happy to contribute to a Danish translation, but plugins and themes are in general not translated to Danish, or they are machine-translated making them close to impossible to understand. I was VERY happy when WordPress allowed me to choose one language for frontend and another for backend, and I generally only bother to translate frontend strings, as they are the only ones visible to the visitor. And in regards to TSF – the only string relevant so far, was the “on” in the meta description title / meta description, and your little filter solved that. Thanks πŸ˜€

    Plugin Author Sybre Waaijer

    (@cybr)

    Hi Bjarne,

    Awesome! πŸ™‚

    There are a few other front-end strings, like “Latest posts:”, “Search results for:”, and also a few in the sitemap file.

    Many title prefixes are taken from WordPress Core and should be translated automatically.

    Here you can find all translations, simply search for “translators: Front-end output” and you can easily slide through those:
    .POT file

    Cheers πŸ™‚

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to translate “on” in meta description’ is closed to new replies.