Daniel Wardin
Daniel Wardin

Reputation: 1858

Translating Dynamic Content in Wordpress

Is there any way I can translate dynamic content in wordpress using .po files and e or _ functions?

I have all the static content translated but I would like to have dynamic content translated as well, wp_nav_menu, site header text etc.

I'm using poedit and that doesn't let me add any extra strings into the resource file so if you know how to get around that it would be nice as well.

Upvotes: 0

Views: 2317

Answers (2)

WebMat
WebMat

Reputation: 135

You will can without plugin if you know the exactly word, like that

    $translate = '';
    $result = 'dynamical string need to be translate';

    if ( $result == 'dynamical string need to be translate' ) {
        $translate = __('dynamical string need to be translate', 'plugin');
    }

    if ( $result == 'other dynamical string' ) {
        $translate = __('other dynamical string', 'plugin');
    }

    echo $translate;

Upvotes: 0

mathielo
mathielo

Reputation: 6795

Recently I have been using Polylang Plugin for WordPress. It gives you plain control over the website translation, from content to menus and strings translations. Best of all: most of your work will be done through WP Admin interface instead of php code.

Upvotes: 1

Related Questions