• Hello
    I installed your plugin and set custom text messages that appear on my page.
    I noticed that I can’t translate them with WPML String Translation and I managed to fix it by changing one line in the plugin.

    I changed:

    $content = sprintf( '<div id="catapult-cookie-bar">%s<button id="catapultCookie" tabindex=1 onclick="catapultAcceptCookies();">%s</button><a tabindex=1 href="%s">%s</a></div>', htmlspecialchars( $current_text ), htmlspecialchars( $accept_text ), home_url( $link_text ), htmlspecialchars( $more_text ) );

    to:

    $content = sprintf( '<div id="catapult-cookie-bar">%s<button id="catapultCookie" tabindex=1 onclick="catapultAcceptCookies();">%s</button><a tabindex=1 href="%s">%s</a></div>', htmlspecialchars( __($current_text,'uk-cookie-consent') ), htmlspecialchars( __($accept_text,'uk-cookie-consent') ), home_url( __($link_text,'uk-cookie-consent') ), htmlspecialchars( __($more_text,'uk-cookie-consent') ) );

    So basically I added __() function to every custom string. Could you do the same in your official version of this plugin?

    I would like to install your plugin on about 10 pages and it would be really helpful if I didn’t have to change this one line on every plugin update.

    Thanks a lot in advance!

    http://wordpress.org/extend/plugins/uk-cookie-consent/

Viewing 5 replies - 1 through 5 (of 5 total)
  • fiterix

    (@fiterix)

    Anoriell, can You tell me what should I do to translate messages from this plugin with WPML?
    I already edited uk-cookie-consent.php and i don’t know what to do next…

    Thread Starter anoriell – Katarzyna Janoska

    (@anoriell)

    fiterix, you have to have WPML String Translation installed.

    Then you go to WPML->String Translation (the last position in menu) -> you choose uk-cookie-consent from the second select list at the top of the page.

    And now underneath you should see phrases than can be translated 🙂

    fiterix

    (@fiterix)

    thanks! I’ve already checked this before, but the problem is that i haven’t uk-cookie-consent position on this list… 😐

    Thread Starter anoriell – Katarzyna Janoska

    (@anoriell)

    Ok, so maybe try to go to WPML->Theme localization find UK Cookie on the plugin list at the bottom of the page, check it and click ‘scan for…’ button.

    uk-cookie-consent position should appear in WPML->String Translation.

    If not… Well you can also try to go to WPML->String Translation and check “Auto-register strings always” option at the bottom of the page.

    Let me know if it worked…

    Other option:

    For WPML, you create a file named “wpml-config.xml” in “uk-cookie-consent” plugin directory with following code:

    <wpml-config>
        <admin-texts>
            <key name="catapult_cookie_options">
                <key name="catapult_cookie_text_settings" />
                <key name="catapult_cookie_accept_settings" />
                <key name="catapult_cookie_more_settings" />
    	    <key name="catapult_cookie_link_settings" />
            </key>
        </admin-texts>
    </wpml-config>

    And then you go to WPML->String Translation and translate according your language.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Translation of custom srtings’ is closed to new replies.