Support » Plugin: Loco Translate » How to find a string that is not in the .po file yet?

  • Resolved llndave

    (@llndave)


    hi there,
    > i cant seem to figure out how to translate “Woo Quote A Product (woo_quote_a_product)” :S
    > they give me 4 strings:
    > “This is a short description of what the plugin does. It’s displayed in the WordPress admin area.
    > Vsourz Development Team
    > Woo Quote A Product
    > http://www.vsourz.com”
    >
    > but i need to translate the actual plugins texts.
    >
    > i found them here:
    > wp-content/plugins/woo_quote_a_product/public/js/woo_quote_add_quote.js?ver=1.0.0
    >
    >
    > but how do i now add this?
    >
    >
    > kind regards
    > dave

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Tim W

    (@timwhitlock)

    You already posted this question.

    All strings are defined by the plugin author in a POT template file (if there is one). This is how they are added to PO files. First when you create a PO from the POT and also when you sync to update the PO with changes made to the POT.

    Please read the documentation and follow any links relevant to your situation: https://localise.biz/wordpress/plugin/manual/templates

    Also relevant may be the JSON translation file system which has known issues when POT templates are not provided by authors: https://localise.biz/wordpress/plugin/manual/json

    Thread Starter llndave

    (@llndave)

    I didnt get the documentation.

    the authors file only enables me to translate “plugin name” “author” “website link” etc.

    but not the actual strings that are being used…

    what am i supposed to do?

    Plugin Author Tim W

    (@timwhitlock)

    It seems unlikely that the author’s template would only contain these strings. This sounds more like you’re syncing directly to the source code, and it is failing to extract all the strings. Check with the author whether they provide a template and whether it is complete.

    Thread Starter llndave

    (@llndave)

    the author doesnt respond at all..

    TEXT_DOMAIN: Woo_quote_a_product_Public
    woo_quote_a_product
    Thread Starter llndave

    (@llndave)

    sample: `<?php

    /**
    * Add to Quote button template
    *
    * @package Woo Request A Quote
    * @since 1.0.0
    */

    if ( ! defined( ‘ABSPATH’ ) ) {
    exit; // Exit if accessed directly
    }

    ?><div class=”woo_quote_add_to_quote_outer”><?php
    if(!$is_added){
    ?><div class=”woo_quote_ajax_loader WSGDFG” id=”woo_quote_ajax_loader-<?php echo $prod_id; ?>” style=”display: none; background-image: url(‘<?php echo WOO_QUOTE_DIR_URL.’images/product-ajax-loader.svg’; ?>’);”>
    </div>
    <a href=”<?php echo site_url().”/”.$quote_page.”?add_to_quote=”.$prod_id; ?>” data-quantity=”1″ class=”button add_to_quote_req add_to_quote_req_<?php echo $prod_id; ?> add_to_cart_button <?php echo $btn_classes; if(is_shop()){ echo ‘ product_listing’; }else{ echo ‘ product_detail’; } ?>” data-product_id=”<?php echo $prod_id; ?>” data-product-type=”<?php echo $prod_type; ?>” data-product_sku=”” rel=”nofollow”><?php _e($btn_text,WOO_QUOTE_TEXT_DOMAIN); ?></a><?php
    }
    ?><div class=”woo_quote_add_item_response-<?php echo $prod_id ?> woo_quote_add_item_response_message” <?php if(!$is_added){ ?> style=”display:none;” <?php } ?>><?php
    if(!$is_added){
    echo apply_filters( WOO_QUOTE_PREFIX.’add_product_to_quote_message’, __(‘The product added in quote list!’, WOO_QUOTE_TEXT_DOMAIN) );
    }
    else{
    echo apply_filters( WOO_QUOTE_PREFIX.’added_product_to_quote_message’, __(‘The product already in quote list!’, WOO_QUOTE_TEXT_DOMAIN) );
    }
    ?></div>
    <div class=”woo_quote_add_item_browse-list-<?php echo $prod_id ?> woo_quote_add_item_browse_message” <?php if(!$is_added){ ?>style=”display:none;” <?php } ?>>
    <a href=”<?php echo site_url().”/”.$quote_page; ?>”><?php _e(“Browse quote list”,”woocommerce”); ?></a>
    </div>
    </div>
    <div class=”clear”></div>
    <script>

    if( jQuery(“body”).hasClass(‘single-product’) && jQuery(‘[name|=”product_id”]’).length < 1 ){
    jQuery(“.variations_form”).append(‘<input type=”hidden” name=”product_id” value=”77″><input type=”hidden” name=”variation_id” class=”variation_id” value=”0″>’);
    }
    </script>`

    Plugin Author Tim W

    (@timwhitlock)

    It looks to me like the author is using a defined constant (WOO_QUOTE_TEXT_DOMAIN) instead of a literal text domain argument. This goes against WordPress i18n conventions and will cause string extraction problems exactly like you are seeing. This is one of the many reasons I strongly advise against extracting your own template.

    I appreciate the author won’t respond to you or provide you with a template, but this does not make it my responsibility to fix. I provide a file editor and the way it works is well documented.

    If the advice in the links above does not help, my only other suggestion is to try the FAQ: How can I add a language without a translation template?.

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