Custom functions localization
-
QUESTION
How should I properly translate custom woocommerce labels ?STEP 1
I have added custom checkout fields https://cl.ly/f82c93aed7e9By adding this to functions.php
include_once( ‘custom-functions/custom-fields-checkout.php’ );Piece of custom-fields-checkout.php looks like this:
add_action('woocommerce_after_checkout_billing_form', 'custom_checkout_field_delivery_time'); function custom_checkout_field_delivery_time( $checkout ) { $options = [__('Select time', 'woocommerce')]; for ($i = 10; $i < 19 ; $i++) { $k = $i + 1; $options[$i . ':00 - ' . $k . ':00'] = $i . ':00 - ' . $k . ':00'; } woocommerce_form_field( 'order_delivery_time', array( 'type' => 'select', 'class' => array('form-row-last'), 'id' => 'timepicker', 'required' => true, 'label' => __('Delivery time', 'woocommerce'), 'placeholder' => __('Select time', 'woocommerce'), 'options' => $options, $checkout->get_value( 'order_delivery_time' )) ); }
STEP 2
Now we need to get ‘Delivery time’ and ‘Delivery date’ translated.I open woocommerce-uk.po and add
msgid "Delivery date" msgstr "Дата доставки" msgid "Delivery time" msgstr "Час доставки"
Then I open it in Poedt and do ‘Compile to MO’
Then I upload language files to /wp-content/languages/plugins/woocommerce-uk.*
After that, no matter which language from admin I choose – site won’t translate woo commerce pages (cart, checkout, etc)
QUESTION
How should I properly translate custom woocommerce labels ?### WordPress Environment ### WordPress address (URL): https://demoshop.morkva.co.ua Site address (URL): https://demoshop.morkva.co.ua WC Version: 3.6.4 Log Directory Writable: ? WP Version: 5.2.1 WP Multisite: – WP Memory Limit: 1 GB WP Debug Mode: – WP Cron: ? Language: ru_RU External object cache: – ### Server Environment ### Server Info: Apache PHP Version: 7.2.19 PHP Post Max Size: 50 MB PHP Time Limit: 30 PHP Max Input Vars: 1000 cURL Version: 7.53.1 NSS/3.28.1 SUHOSIN Installed: – MySQL Version: 5.7.16-10-log Max Upload Size: 50 MB Default Timezone is UTC: ? fsockopen/cURL: ? SoapClient: ? DOMDocument: ? GZip: ? Multibyte String: ? Remote Post: ? Remote Get: ? ### Database ### WC Database Version: 3.6.4 WC Database Prefix: wp_ Общий размер базы данных: 3.98MB Размер данных в базе данных: 2.92MB Размер индекса базы данных: 1.06MB ### Post Type Counts ### attachment: 25 blocks: 2 customize_changeset: 2 flamingo_contact: 3 nav_menu_item: 5 page: 20 polylang_mo: 2 post: 2 product: 9 revision: 50 scheduled-action: 28 shop_order: 5 wpcf7_contact_form: 4 ### Security ### Secure connection (HTTPS): ? Hide errors from visitors: ? ### Active Plugins (12) ### 404 To Homepage: от LittleBizzy – 1.1.0 Classic Editor: от Участники разработки WordPress – 1.5 Clean Image Filenames: от Upperdog – 1.2.1 Contact Form 7: от Takayuki Miyoshi – 5.1.3 Disable Author Pages: от LittleBizzy – 1.1.0 Disable Emojis: от LittleBizzy – 1.2.0 myCRED: от myCRED – 1.8.4.1 Woo Shipping for Nova Poshta: от Sergey Nezbritskiy – 2.1.5 – Не тестировалось с активной версией WooCommerce Woo Ukrposhta: от MORKVA – 0.3 WooCommerce: от Automattic – 3.6.4 Yoast SEO: от Команда Yoast – 11.3 – Не тестировалось с активной версией WooCommerce WP Translitera: от Евгений Юрченко – p1.2.5 ### Inactive Plugins (16) ### All In One WP Security: от Tips and Tricks HQ Peter Petreski Ruhul Ivy – 4.3.8.3 CF7 Google Sheet Connector: от WesternDeal – 2.9 Disable Search: от LittleBizzy – 1.1.0 Disable XML-RPC: от LittleBizzy – 1.1.0 Duplicator: от Snap Creek – 1.3.10 EWWW Image Optimizer: от Exactly WWW – 4.7.0 Force HTTPS: от LittleBizzy – 1.2.0 Google Tag Manager for WordPress: от Thomas Geiger – 1.9.2 – Не тестировалось с активной версией WooCommerce Hyyan WooCommerce Polylang Integration: от Hyyan Abo Fakher – 1.3.0 – Не тестировалось с активной версией WooCommerce IT Guild Rozetka.ua Integration: от Eugene Gorelikov – 1.0.0 – Не тестировалось с активной версией WooCommerce Kadence WooCommerce Email Designer: от Kadence Themes – 1.1.7 – Не тестировалось с активной версией WooCommerce Nova Poshta TTN Pro: от MORKVA – 1.2.3 Polylang: от Frédéric Demarle – 2.5.3 WP All Import - WooCommerce Add-On Pro: от Soflyy – 3.0.6 – Не тестировалось с активной версией WooCommerce WP All Import Pro: от Soflyy – 4.5.5 WP Rollback: от Impress.org – 1.6 ### Settings ### API Enabled: ? Force SSL: – Currency: UAH (грн) Currency Position: right_space Thousand Separator: , Decimal Separator: . Number of Decimals: 0 Taxonomies: Product Types: external (external) grouped (grouped) simple (simple) variable (variable) Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog) exclude-from-search (exclude-from-search) featured (featured) outofstock (outofstock) rated-1 (rated-1) rated-2 (rated-2) rated-3 (rated-3) rated-4 (rated-4) rated-5 (rated-5) Connected to WooCommerce.com: – ### WC Pages ### Ссылка магазина: #22 - /shop/ Корзина: #23 - /cart/ Оформление заказа: #24 - /checkout/ Мой аккаунт: #25 - /my-account/ Правила и условия: ? Страница не задана ### Theme ### Name: Flatsome Child Version: 3.0 Author URL: Child Theme: ? Parent Theme Name: Flatsome Parent Theme Version: 3.8.3 Parent Theme Author URL: https://www.uxthemes.com/ WooCommerce Support: ? ### Templates ### Overrides: flatsome/woocommerce/archive-product.php flatsome/woocommerce/cart/cart-empty.php flatsome/woocommerce/cart/cart-shipping.php flatsome/woocommerce/cart/cart.php flatsome/woocommerce/checkout/form-checkout.php flatsome/woocommerce/checkout/form-coupon.php flatsome/woocommerce/checkout/thankyou.php flatsome/woocommerce/content-product.php flatsome/woocommerce/content-product_cat.php flatsome/woocommerce/content-single-product.php flatsome/woocommerce/content-widget-product.php flatsome/woocommerce/global/breadcrumb.php flatsome/woocommerce/global/quantity-input.php flatsome/woocommerce/global/wrapper-end.php flatsome/woocommerce/global/wrapper-start.php flatsome/woocommerce/loop/loop-end.php flatsome/woocommerce/loop/loop-start.php flatsome/woocommerce/loop/pagination.php flatsome/woocommerce/loop/result-count.php flatsome/woocommerce/loop/sale-flash.php flatsome/woocommerce/myaccount/form-login.php flatsome/woocommerce/myaccount/navigation.php flatsome/woocommerce/notices/error.php flatsome/woocommerce/notices/notice.php flatsome/woocommerce/notices/success.php flatsome/woocommerce/product-searchform.php flatsome/woocommerce/single-product/photoswipe.php flatsome/woocommerce/single-product/price.php flatsome/woocommerce/single-product/product-image.php flatsome/woocommerce/single-product/product-thumbnails.php flatsome/woocommerce/single-product/rating.php flatsome/woocommerce/single-product/related.php flatsome/woocommerce/single-product/review.php flatsome/woocommerce/single-product/sale-flash.php flatsome/woocommerce/single-product/share.php flatsome/woocommerce/single-product/short-description.php flatsome/woocommerce/single-product/tabs/tabs.php flatsome/woocommerce/single-product/title.php flatsome/woocommerce/single-product/up-sells.php flatsome/woocommerce/single-product-reviews.php flatsome/woocommerce/single-product.php ### Action Scheduler ### Complete: 28 Oldest: 2019-05-28 05:40:41 +0000 Newest: 2019-05-28 05:41:59 +0000 Pending: 0 Oldest: – Newest: – Canceled: 0 Oldest: – Newest: – In-progress: 0 Oldest: – Newest: – Failed: 0 Oldest: – Newest: –
The page I need help with: [log in to see the link]
- The topic ‘Custom functions localization’ is closed to new replies.