0

I have a problem with my project. I'm using a Wordpress theme NOT native for WooCommerce. I'm implemented anyway WooCommerce, and it works great. Now, i have a problem. WooCommerce doesn't contain italian custom fields "C.F." and "P.IVA". So i've found a plugin that provides to create and configure these custom fields. The plugin is: http://netstarsolution.net/aggiungere-cf-e-pi-wc/.

The problem is that when i active qTranslate and WooCommerce-qTML (for WooCommerce), the custom fields inserted by "WooCommerce Aggiungere CF e P.IVA" not are translated. Only custom fields inserted with "WooCommerce Aggiungere CF e P.IVA" plugin doesn't works.

This is the part that's not translating:

// Billing First Name. 
$fields['billing']['billing_first_name'] = array( 
    'label' => __( 'First Name', 'wcbcf' ), 
    'placeholder' => _x( 'First Name', 'placeholder', 'wcbcf' ), 
    'required' => true, 
    'class' => array( 'form-row-first' ),
);
brasofilo
  • 25,496
  • 15
  • 91
  • 179
Francesco
  • 331
  • 1
  • 6
  • 20
  • You'll be very lucky if someone with the same setup reads this post. To get help here you'd better open the plugin files, find the exact code that's not being translated, and post it here. Otherwise, ask for support in the plugin channels. – brasofilo Nov 20 '13 at 04:38
  • Hi and thanks for response. This is the part that you requested me: [code]// Billing First Name. $fields['billing']['billing_first_name'] = array( 'label' => __( 'First Name', 'wcbcf' ), 'placeholder' => _x( 'First Name', 'placeholder', 'wcbcf' ), 'required' => true, 'class' => array( 'form-row-first' ), );[/code] – Francesco Nov 20 '13 at 12:01
  • Do you mean that `First Name` is not translating? Make sure you have the file `plugins/the-plugin-that-not-translates/language/SLUG-it_IT.mo`. – brasofilo Nov 20 '13 at 15:33
  • Yes, it's present, infact some field are correctly translated. When i active qTranslate, set italian as default language, in checkout page some fields are in italian language (correctly), others in english (not correct). – Francesco Nov 20 '13 at 16:34

1 Answers1

0

Ok I resolved it. Post here the solution for someone that has my same problem.

Well, the solution is basically a hack to the plugin itself (NOT the qTranslate plugin, just the other ones ONLY). What you do is find within the plugin the load_plugin_textdomain function call.

Code:

    load_plugin_textdomain('your_plugin_identifier', false, dirname( plugin_basename(__FILE__) ) . '/languages');

add_action('init', 'init_textdomain');
function init_textdomain() {
   load_plugin_textdomain(''your_plugin_identifier', false, dirname( plugin_basename(__FILE__) ) . '/languages');
}

Thanks to this post: http://www.qianqin.de/qtranslate/forum/viewtopic.php?f=3&t=1800

Francesco
  • 331
  • 1
  • 6
  • 20