Support » Plugin: PPOM for WooCommerce » LocoTranslate String Translation?

  • Resolved WebHolism

    (@webholism)


    Hi,

    Thanks for the great plugin.

    I would really like to allow for the translation of:

    $ppom_input_vars[‘product_base_label’] = ppom_get_option(‘ppom_label_product_price’, ‘Product Price’);
    &
    $ppom_input_vars[‘option_total_label’] = ppom_get_option(‘ppom_label_option_total’, ‘Option Total’);
    in the inc/hooks.php file.

    I use LocoTranslate and this does not pick these up as translatable strings. Are you able to offer any assistance or advice on integration with this plugin? I see that you have recommended WPML in some other instances, but I have need for LocoTranslate, and would prefer not to have multiple translation plugins if I possibly can.

    Thank you so much for your time and advice in this matter.

Viewing 15 replies - 1 through 15 (of 21 total)
  • Plugin Author N-Media

    (@nmedia)

    Hi,

    We are working on a new version with better translations support with major plugins.

    Hi N-Media,

    That is great news.

    In order to respond to a client question, do you have any sort of estimate on the expected duration before those features may be part of the plugin? I just wondered if you expect it to be weeks, months, or longer?

    Thank you so much for your support, and on the really useful plugin.

    Wishing you a wonderful day.

    Kind regards.

    Plugin Author N-Media

    (@nmedia)

    Hi @webholism,

    it will be maxed two weeks. As we have EID holidays in the coming week.

    Hi,

    Thanks for the response, and for the work. This change will make a massive difference in my workload, so I really appreciate it.

    Hope that your EID holidays go well.

    Kind regards,
    WebHolism

    Plugin Author N-Media

    (@nmedia)

    Hi,

    we are back from holidays. Working on version PPOM version 18.0

    Hi,

    I have recently installed the newest version of the plugin (v18.2). However, it does not seem that the situation with the labels in the hooks.php file are working in LocoTranslate.

    Are you able to recommend a method for updating the values defined for the labels in the hooks.php file that will be upgrade proof?

    $ppom_input_vars[‘product_base_label’] = ppom_get_option(‘ppom_label_product_price’, ‘Product Price’);
    $ppom_input_vars[‘option_total_label’] = ppom_get_option(‘ppom_label_option_total’, ‘Option Total’);

    Many thanks for your time.

    Kind regards,
    WebHolism

    Plugin Author N-Media

    (@nmedia)

    Hi @webholism,

    we have now added these PPOM Labels (in PPOM Settings) in dynamic strings, so can it can be translated via WPML or Loco Translate. Make sure:

    > You have version 8.3 (will be released soon)
    > Save PPOM Settings after update to 8.3.

    Hi @nmedia,

    Thanks for all the work that you are putting into this plugin, it is greatly appreciated.

    The issue translating the variables that I am looking to modify with LocoTranslate, appears to persist. They are defined in the /inc/hooks.php file in the plugin directory:

    • $ppom_input_vars[‘product_base_label’] = ppom_get_option(‘ppom_label_product_price’, ‘Product Price’);
    • $ppom_input_vars[‘option_total_label’] = ppom_get_option(‘ppom_label_option_total’, ‘Option Total’);

    Are you able to modify the output of these two variables so that they are able to work from a language file, one that LocoTranslate can work on?

    I can modify the value directly in the file, but this presents a problem with each and every upgrade.

    I have been able to change some of the administrator strings with the LocoTranlste plugin, so I can confirm that that LocoTranslate is working as expected with other variables.

    Your time and assistance is appreciated.

    Hi @nmedia,

    I just wondered if there is any progress on this issue at all?

    Many thanks for your time and assistance.

    Kind regards.

    Plugin Author N-Media

    (@nmedia)

    Hi @webholism,

    can you please tell me which function/hook required in LocoTranslate to translate a string like for WPML: apply_filters('wpml_translate_single_string', $field_value, $domain, $field_name );

    for Polly Lang: pll__($field_value);

    I am no expert on LocoTranslate, but from the information on their website (https://localise.biz/help/wordpress/loading-translations), it seems that that they use Gettext:

    Gettext is the localization system that WordPress uses to load translations. To be more specific: WordPress reads the Gettext MO file format. Loading these files is all WordPress needs to do. It’s up to you to ensure they’re valid and in the right place.

    Gettext uses the concept of text domains, and so does WordPress. A text domain is simply a namespace that keeps your translations separate from other people’s.

    WordPress filters can alter the MO file loading process at various stages. If you know you’re doing everything correctly and WordPress still won’t load your file, then its possible that another plugin is altering something. The best way to eliminate this problem is to disable every plugin, except the one you’re translating.

    Does this help at all? Please advise if this is sufficient, or if you need more details of LocoTranslate’s functionality.

    I have tried translating other parts of the PPOM plugin and LocoTranslate works fine, it seems that at least the two variables defined ($ppom_input_vars[‘product_base_label’] & $ppom_input_vars[‘option_total_label’]) do not work in the same way.

    Kind regards.

    Plugin Author N-Media

    (@nmedia)

    Hi @webholism.

    It’s really strange that all other strings are working with LocoTranslate (as you said) but not the following:

    $js_vars['product_base_label'] = ppom_get_option('ppom_label_product_price', 'Product Price');
    $js_vars['option_total_label'] = ppom_get_option('ppom_label_option_total', 'Option Total');

    even I have the same function for other strings ppom_get_option();

    Well, can you please confirm that following string is translating?
    $js_vars['total_without_fixed_label'] = ppom_get_option('ppom_label_total', 'Total');

    Hi @nmedia,

    On the site my client they only use the three values from this section of code (at least that I can see):

    $ppom_input_vars['product_base_label'] = ppom_get_option('ppom_label_product_price', 'Product Price');
    $ppom_input_vars['option_total_label'] = ppom_get_option('ppom_label_option_total', 'Option Total');
    $ppom_input_vars['total_without_fixed_label'] = ppom_get_option('ppom_label_total', 'Total');

    None of these appear to be influenced by LocoTranslate, but I was curious if these are being output from the translation file, or if they are being output through a mechanism that does not use the standard WordPress internationalisation procedure (using PHP __() or _e() with the text domain).

    Your advice is greatly appreciated.

    Kind regards.

    Hi @nmedia,

    I just wondered if you have been able to review whether my previous observations may assist with making the plugin work with the LocoTranslate mechanism of translation?

    Any progress would be wonderful, or at least an understanding of how I can resolve this issue.

    Thank you for your time and assistance.

    Kind regards.

    Plugin Author N-Media

    (@nmedia)

    Hi @webholism,

    well, we found something which may be the issue and fix this in upcoming version PPOM 18.5, but you can test beta version here:https://we.tl/t-o048i4Zhco

    NOTE: we also updated ppom.pot file.

Viewing 15 replies - 1 through 15 (of 21 total)
  • You must be logged in to reply to this topic.