• Hi,

    I’m need help in translating a few texts. So I installed a no longer maintained theme. I have almost everything up and ready but I can’t translate the slider and the CTA components.

    I tried editing theme pot files but the actual texts appears nowhere. So I accesed to the code and found these definitions:

    <div class="title-wrap">
        <h3><?php echo esc_html( $avenue_options['sc_cta3_title'] ); ?></h3>
    </div>
    <p>
        <?php echo esc_html( $avenue_options['sc_cta3_text'] ); ?>
    </p>

    So I started looking for possible definitions of the variables (cta1, cta2, etc) and I found them on functions.php:

    // CTA TRIO

    ‘sc_cta_bool’ => ‘yes’,

    ‘sc_cta1_title’ => __( ‘Theme Options’, ‘avenue’ ),
    ‘sc_cta1_icon’ => ‘fa-cogs’,
    ‘sc_cta1_text’ => __( ‘Change typography, colors, layouts…’, ‘avenue’ ),
    ‘sc_cta1_url’ => ”,
    ‘sc_cta1_button_text’ => __( ‘Click Here’, ‘avenue’ ),

    ‘sc_cta2_title’ => __( ‘Responsive Layout’, ‘avenue’ ),
    ‘sc_cta2_icon’ => ‘fa-mobile’,
    ‘sc_cta2_text’ => __( ‘Fully responsive and mobile-ready’, ‘avenue’ ),
    ‘sc_cta2_url’ => ”,
    ‘sc_cta2_button_text’ => __( ‘Click Here’, ‘avenue’ ),

    ‘sc_cta3_title’ => __( ‘Professional Design’, ‘avenue’ ),
    ‘sc_cta3_icon’ => ‘fa-diamond’,
    ‘sc_cta3_text’ => __( ‘Modern design to give your site a professional look’, ‘avenue’ ),
    ‘sc_cta3_url’ => ”,
    ‘sc_cta3_button_text’ => __( ‘Click Here’, ‘avenue’ ),

    I changed the values cusstomizing the site, but I cannot find a way to translate these fields when access in a different language to my site.

    Thanks in advance.

    • This topic was modified 5 years, 2 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Everything else WordPress topic

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    The __() translation functions utilize the gettext tools to manage translations. For themes in the WP repository translations are handled by the i18n community. Theme authors don’t need to do much but correctly use the WP translation function.

    For unsupported themes, you need to use the gettext tools yourself. A .pot file is generated which is used to do translations into a .po file. The completed .po file is then compiled into a .mo file which WP uses to display strings in the chosen language. The language displayed is based on the site’s language setting.

    This setting is not selectable by site visitors. If you want visitors to see content in their language you need a multilingual plugin.

    Thread Starter kaiserawilum

    (@kaiserawilum)

    Thanks for your response bcworkz

    I did manage to do what I intended following this post:

    https://kau-boys.com/2047/wordpress/translate-customizer-options-with-polylang

    It took me a while figure it out. But basically, following the post, I changed the teme code so each time I change the value in the customizer, the strings were updated in the polylang strings.

    Then I had to change the page templates so the used the pll_e function to display the translated texts.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Translating custom fields’ is closed to new replies.