Este es el foro de soporte técnico de WPML, el plugin multilingüe de WordPress.

Todas las personas pueden leerlo pero solo los clientes de WPML pueden ingresar comentarios. El equipo de WPML responde en el foro 6 días a la semana, durante 22 horas por día.

Our next available supporter will start replying to tickets in about 2.19 hours from now. Thank you for your understanding.

This thread is resolved. Here is a description of the problem and solution.

Problem: I need to translate a text from my functions.php file

Solution: Wrap the texts in Gettext functions

Relevant Documentation:

Etiquetado: 

This topic contains 5 respuestas, has 2 mensajes.

Last updated by Carlos Rojas hace 2 meses, 1 semana.

Assigned support staff: Carlos Rojas.

Autor Publicaciones
agosto 16, 2019 a las 7:52 am #4405285

juanR-26

I need to translate a text from my functions.php file
The problem is that I don't know php.
I know that later I have to go to "String translation" and etc.
But how can I update the code so that it appears in "String translation"?

<?php
add_action ('woocommerce_review_order_before_submit', 'extra_checkbox_checkout', 9);
function extra_checkbox_checkout() {
?>
<p class="form-row terms">
<input type="checkbox" class="input-checkbox" name="deliverycheck" id="deliverycheck" />
<label for="deliverycheck" class="checkbox saglasen_sam">Съгласен съм да предоставите горепосочените ми данни на куриерската компания, която ще достави поръчката до желания от мен адрес.<span class="required">*</span>
</label>
</p>

<?php
}

add_action('woocommerce_checkout_process', 'extra_checkbox_checkout_error');

function extra_checkbox_checkout_error() {
if ( ! $_POST['deliverycheck'] )
wc_add_notice( __( 'Трябва да приемете, че предоставяте горепосочените данни на куриерската компания за да се реализира доставката.' ), 'error' );
}
?>

agosto 16, 2019 a las 1:01 pm #4406459

Carlos Rojas
Supporter

Languages: Inglés (English ) Español (Español )

Timezone: America/Montevideo (GMT-03:00)

Hello,
Thank you for contacting WPML support.

Just to confirm, the texts you are trying to translate are the ones in Russian?

Kind regards,
Carlos

agosto 16, 2019 a las 1:04 pm #4406485

juanR-26

Yes and no .. I mean it's the part that is in Bulgarian (it looks like Russian). The part in Cyrillic.

agosto 16, 2019 a las 1:27 pm #4406579

Carlos Rojas
Supporter

Languages: Inglés (English ) Español (Español )

Timezone: America/Montevideo (GMT-03:00)

Hi,
Thank you for your feedback and I'm sorry about the language confusion. I don't speak Russian nor Bugarian.

In this case change the code to this:
<?php
add_action ('woocommerce_review_order_before_submit', 'extra_checkbox_checkout', 9);
function extra_checkbox_checkout() {
?>
<p class="form-row terms">
<input type="checkbox" class="input-checkbox" name="deliverycheck" id="deliverycheck" />
<label for="deliverycheck" class="checkbox saglasen_sam"><?php _e("Съгласен съм да предоставите горепосочените ми данни на куриерската компания, която ще достави поръчката до желания от мен адрес.", 'domain') ?><span class="required">*</span>
</label>
</p>

<?php
}

add_action('woocommerce_checkout_process', 'extra_checkbox_checkout_error');

function extra_checkbox_checkout_error() {
if ( ! $_POST['deliverycheck'] )
wc_add_notice( __( 'Трябва да приемете, че предоставяте горепосочените данни на куриерската компания за да се реализира доставката.' ), 'error' );
}
?>

As you can see I wrapped the first label in a _e() function. After applying this step you just need to go to WPML -> Themes and plugins localization -> Scan the theme again.

Regards,
Carlos

agosto 16, 2019 a las 1:38 pm #4406619

juanR-26

My issue is resolved now. Thank you!

agosto 16, 2019 a las 1:41 pm #4406627

Carlos Rojas
Supporter

Languages: Inglés (English ) Español (Español )

Timezone: America/Montevideo (GMT-03:00)

Hi there,

I'm glad to hear that the issue is solved 🙂

Please don't hesitate to contact us if you need our help in the future with WPML. We will be more than happy to help.
Best regards,
Carlos