Support » Plugin: Extra Product Options (Product Addons) for WooCommerce » Localizations for front-end

  • Resolved magdamunro

    (@magdamunro)


    It would seem there are no existing localization files for the front-end. I wanted to translate the strings ‘Select options’ and ‘Please enter a value for ‘ and I managed the first with the Say What plug-in, but no success on the latter.

    The existing localization at translate.wordpress.com seem to only be for the back-end. The latter mentioned string I can’t seem to target is in /wp-content/plugins/woo-extra-product-options/classes/fe/class-wepof-product-options-frontend.php on row 258. I can successfully manipulate it there, but shouldn’t there be a more full localization?

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter magdamunro

    (@magdamunro)

    It’s the construction of this section on row 258 that makes it hard to translate:
    THWEPOF_Utils::wcpf_add_error(__('Please enter a value for '.$field->get_property('title'), 'woo-extra-product-options'));. The inline concatenation makes it (seemingly) impossible to identify the string for Say What and I’d guess any localization as well.

    I tried with printf and a string variable and this resolved the identification, but I got unexpected layout side-effects so no specific suggestion from me, but breaking out building the string and sending the finished translated string to wcpf_add_error could be be a valid strategy.

    Could you express this in an alternative way so that the message can be localized, please?

    Plugin Author ThemeHigh

    (@themehigh)

    >> I can successfully manipulate it there, but shouldn’t there be a more full localization?

    We have released the latest version of our plugin in which we have added the folder languages an added pot file in it.

    Please update your plugin to its latest version.

    >> The inline concatenation makes it (seemingly) impossible to identify the string for Say What and I’d guess any localization as well.

    We have made changes in the latest version fo our plugin.

    Please update and verify from your side.

    We hope this will help 🙂

    Thank you!

    Thread Starter magdamunro

    (@magdamunro)

    I have updated to “Woocommerce 3.7.0” as well as “Extra Product Options 2.0.4” in WordPress 5.2.2. “Say What” now finds the string in question. Excellent!

    A front-end localization would be nice, but at the moment it’s overkill as it’s 2 lines.

    Thank you!

    Plugin Author ThemeHigh

    (@themehigh)

    We are a little bit unclear about your update regarding the front-end localization. Could you please clarify us?

    The same translation file (woo-extra-product-options.pot) is used to translate both the frontend and backend strings.

    Thank you!

    Thread Starter magdamunro

    (@magdamunro)

    The lines I would like localized aren’t in there. It’s as simple as that. I see no frontend strings anywhere, not in the “/woo-extra-product-options/languages/woo-extra-product-options.pot” file nor in the version at translate.wordpress.org.

    Plugin Author ThemeHigh

    (@themehigh)

    For the user created custom fields (text & placeholders), you need to manually add the details in the .pot file before creating the .po and .mo file since the fields user created are dynamic data.

    You need to add the below format in the pot file:

    msgid "your_field_label"
    msgstr ""

    For example, if the label of your field is “Date” which you need to translate then you need to provide the below details in your pot file before translation.

    msgid "Date"
    msgstr ""

    If you are referring here is not a user created text then please share us with the details so that we can have a look into it.

    Thank you!

    Thread Starter magdamunro

    (@magdamunro)

    Thanks for the reply.

    I don’t know what other info I can give you. ‘Select options’ is button text for the Woocommerce product listing page. Woocommerce already have the proper localization and everything is in the proper locale in the public pages as well back-end, so likely you’re not calling on their strings.

    I already pointed to where in your source code the string ‘Please enter a value for ‘ is. There are no “user created custom fields”, is there? Is this in regard to possibilities within the woo-extra-product-options package?

    Both these strings are resolvable by ‘Say What’ using the woo-extra-product-options plug-in name space. Indicating both strings are with your source code. But maybe I’m misunderstanding something here.

    Plugin Author ThemeHigh

    (@themehigh)

    We have gone through your update and the details that you have provided are correct. For a ‘simple product’, when a field is created using our plugin then we are modifying the “Add to Cart” button to “Select Options”. In this case, our name space is used to translate the text.

    Based on your feedback, in the latest version of our plugin, we have made some modification to consider the translation available in WooCommerce.

    >> There are no “user created custom fields”, is there? Is this in regard to possibilities within the woo-extra-product-options package?

    Custom field that we are referring here is the field created using our plugin to display it on the product page. The label of that field won’t be available in the pot file because it will change according to users.

    >> I already pointed to where in your source code the string ‘Please enter a value for ‘ is.

    We have also modified the required validation message from “Please enter a value for %s” to “%s is a required field”. We have used the required validation message of WooCommerce in our plugin.

    We hope this is clear.

    Thank you!

    Hi,

    I just want to use your plugin to display the default fields to propose a gift wrap option in the product page. So I need to translate 3 strings: “Gift wrap ?”, “Message” and “Type your message here…”. I’ve tried to add these strings in the .pot file in the format:

    msgid “Gift wrap ?”
    msgstr “”

    But where do I translate them ? Should they be translatable in WPML ? I still don’t see them in WPML String Translation…

    OK Sorry for my last message I just didn’t know how .pot, .po and .mo files are working. After having read a little about it and installed Poedit I managed to create localized .mo files and it works partially. The labels are ok but the placeholder is not translated…

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Localizations for front-end’ is closed to new replies.