Forums

wp_get_attachment_image func does not support language/localization (4 posts)

  1. krugster
    Member
    Posted 9 months ago #

    Hi!

    I've use the wp_get_attachment_image function to display an image including alt and title values. However, I have a multi-language site (using the qtranslate plugin) and it seems like the function does not take localization into consideration when parsing.

    I solved the problem by modifying the wp_get_attachment_image function in the source file, media.php. by enclosing relevant rows with the __() function.
    E.g:
    'title' => trim(__(strip_tags( $attachment->post_title ))),

    I see this as a temporary solution because I'm not comfortable with modifying the source. Is there a better way to do it?

  2. Ipstenu
    Half-Elf Support Rogue & Mod
    Posted 9 months ago #

    Have you asked anyone from qtranslate to that?

    Are post titles, for regular posts/pages translate? If so that may be something we SHOULD add to core!

  3. krugster
    Member
    Posted 9 months ago #

    Hi Ipstenu,

    Thanks for your answer!
    No, I have not asked anyone from qtranslate. Regular posts, pages and "most" widgets work with the plugin. I'm not an expert at WP or plugins but can guess that other language plugins would also benifit if it was fixed at the source/core.

  4. Ipstenu
    Half-Elf Support Rogue & Mod
    Posted 9 months ago #

    I would pitch that in trac then :) You're right, it should be parasable somewhere.

Reply

You must log in to post.

About this Topic