mubiesam
Forum Replies Created
-
Ticket submitted, thanks
I do have all 5 options checked in Locale override settings, but it seems can not change anything in “CheckOut” page if I choose High-performance order storage (recommended) instead of WordPress posts storage (legacy) in Order data storage.
So the shortcode [woocommerce_checkout] only work with legacy ?
Thanks
Any update for this issue?
Since using the shortcode [woocommerce_checkout] is only for adding fields, but is it possible to remove or disable “Required” fields in the billing address?
Thanks
Forum: Plugins
In reply to: [Potent Donations for WooCommerce] Some labels are not in PO file.“Amount:” is also translated.
Thanks
Forum: Plugins
In reply to: [Potent Donations for WooCommerce] Some labels are not in PO file.Hi?@aspengrovestudios
Thanks, it works. The “Donate” button is displayed as we wish, how about “Amount:” I had translated in the Loco Translate plugin, but still displayed as “Amount:”
Forum: Themes and Templates
In reply to: [BizGrove] Can not Swap template in the page editingGot it, thanks for the reply.
Forum: Themes and Templates
In reply to: [BizGrove] Can not Swap template in the page editingI had deactivated all the plugins, but still can not use “Swap template”, while changed to theme 2024, “Swap template” works as normal.
Please take a look at the screen recording?https://screenrec.com/share/UvyxF5Mu1X
I like to use BizGrove very much, but if this can not be resolved, it’s a pitty.
Thanks
Forum: Plugins
In reply to: [Potent Donations for WooCommerce] Some labels are not in PO file.Forum: Plugins
In reply to: [Potent Donations for WooCommerce] Some labels are not in PO file.Thank you for providing the filter, I had updated to version 1.1.14, but there is nothing changed in Donations Settings, where can I modify ‘Custom Donate’ text?
Forum: Plugins
In reply to: [Potent Donations for WooCommerce] Some labels are not in PO file.I had tried the tutorial you mentioned “Change ‘add to cart’ text on single product page (only for product ID 189)”, but it doesn’t work.
<?php
// Change 'add to cart' text on single product page (only for product ID 189)
add_filter( 'woocommerce_product_single_add_to_cart_text', 'bryce_id_add_to_cart_text' );
function bryce_id_add_to_cart_text( $default ) {
if ( get_the_ID() == 189 ) {
return __( 'Yes! I WANT this!', 'your-slug' );
} else {
return $default;
}
}- This reply was modified 6 months ago by mubiesam.
Forum: Plugins
In reply to: [Potent Donations for WooCommerce] Some labels are not in PO file.I could use Plugin File Editor to modify
- donations-for-woocommerce/donations-for-woocommerce.php
- #96 <label for=”donation_amount_field”>’.esc_html__(‘金額’, ‘donations-for-woocommerce’).’:</label>
- # 150 function single_add_to_cart_text() { return esc_html__(‘捐款’, ‘donations-for-woocommerce’); }
https://wordpress-181873-0.cloudclusters.net/product/%e6%8d%90%e6%ac%be/
But this is not the proper way to handle the issue, suggestions from ChatGPT:
To make text in a button (or any text) in your WooCommerce plugin translatable, you’ll need to follow WordPress internationalization (i18n) practices. Here’s how you can do it:1. Use
__()
or_e()
FunctionsWrap the text you want to be translatable in one of these functions.
__()
is used when you need to return the translated string._e()
is used when you want to echo the translated string directly.
For example, if you’re adding a button in your plugin:
php
複製程式碼
<button type="submit"><?php _e('Buy Now', 'your-plugin-textdomain'); ?></button>
2. Load Text DomainMake sure you load the text domain for your plugin, typically in your plugin’s main file:
php
複製程式碼
function your_plugin_load_textdomain() { load_plugin_textdomain('your-plugin-textdomain', false, dirname(plugin_basename(__FILE__)) . '/languages'); } add_action('plugins_loaded', 'your_plugin_load_textdomain');
3. Create a.pot
FileYou need to generate a
.pot
(Portable Object Template) file that contains all the translatable strings from your plugin. Tools like Poedit or WP CLI can be used to generate this file.4. Place the Translation FilesYour translation files (
.mo
and.po
) should be placed in alanguages
folder within your plugin directory. The file names should follow the pattern:複製程式碼
your-plugin-textdomain-locale.mo
For example:
複製程式碼
your-plugin-textdomain-fr_FR.mo your-plugin-textdomain-es_ES.mo
5. Use Contextual Functions (Optional)If you have similar strings that might need different translations in different contexts, use
_x()
orex()
:php
複製程式碼
<button type="submit"><?php _x('Buy Now', 'Button text for purchasing', 'your-plugin-textdomain'); ?></button>
6. Mark Strings for Translation in JavaScriptIf you have text in JavaScript, use
wp.i18n.__()
from the WordPress i18n package:javascript
複製程式碼
wp.i18n.__('Buy Now', 'your-plugin-textdomain');
Make sure to enqueue your script with the
wp-i18n
dependency:php
複製程式碼
wp_enqueue_script('your-plugin-script', plugin_dir_url(__FILE__) . 'js/your-plugin-script.js', array('wp-i18n'), '1.0', true);
7. Testing TranslationsAfter implementing these steps, test the translations by switching languages on your WordPress site. The button text should change according to the language set in WordPress settings.
By following these steps, you ensure that the text in your plugin’s buttons (and other elements) is fully translatable, making your plugin accessible to a global audience.
Forum: Plugins
In reply to: [Potent Donations for WooCommerce] Some labels are not in PO file.I had translated “Donate” in the PO file, but it doesn’t change since the button label is hard-coded.
<button type="submit" name="add-to-cart" value="189" class="single_add_to_cart_button button alt wp-element-button">Donate</button>
Forum: Plugins
In reply to: [Web Stories] Is it possible to activate phone in the “Call To Action”?Great! Thanks
Forum: Plugins
In reply to: [WooCommerce] WooCommerce All Products block will not display Chineseunderstood, thanks
Voted, thanks for reply.