Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WooCommerce Measurement Price Calculator - Translate labels
<?php // only copy this line if needed
function sv_mpc_measurement_label( $label ) {
if ( 'fr_FR' === get_locale() ) {
$label = str_replace( 'Required Width', 'Largeur requise', $label );
$label = str_replace( 'Width', 'Largeur', $label );
}
return $label;
}
add_filter( 'wc_measurement_price_calculator_label', 'sv_mpc_measurement_label' );
add_filter( 'wc_measurement_price_calculator_unit_label', 'sv_mpc_measurement_label' );
@krautart

This comment has been minimized.

Copy link

@krautart krautart commented Oct 17, 2015

Thanks for the function. So far quite easy to understand.
The only thing I don't understand yet:

  • Do I have to create the file mpc.php myself? If yes, where should it be located?
  • Or is this code to be placed in the functions.php?

Thanks in advance, with kind kind regards,
connie

@tamarazuk

This comment has been minimized.

Copy link
Owner Author

@tamarazuk tamarazuk commented Jan 24, 2018

Hey Connie, I'm sorry I'm over 2 years late to answer the above! Comments don't trigger a notification I'm afraid. It would be best to use a plugin like Code Snippets to add this code. We have a full tutorial discussing adding custom code to your WordPress site that I would recommend reviewing.

@Yukyio

This comment has been minimized.

Copy link

@Yukyio Yukyio commented Aug 2, 2018

it doesnt work i purchase the plug but i cant translate it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment