По умолчанию WooCommerce использует слова «связанный продукт» при отображении связанных продуктов под одним представлением продукта.
Я хочу изменить эти слова, дополнив его предпочтительным текстом моего клиента.
/wp-content/plugins/woocommerce/i18n/languages/woocommerce.pot
#: templates/single-product/rating.php:42
msgid "%s customer review"
msgid_plural "%s customer reviews"
msgstr[0] ""
msgstr[1] ""
#: templates/single-product/related.php:51
msgid "Related Products"
msgstr ""
#: templates/single-product/review-meta.php:28
msgid "Your comment is awaiting approval"
msgstr ""
К
#: templates/single-product/related.php:51
msgid "Related Products"
msgstr "Customers who rented this item also rented:"
Я также попытался отредактировать файл wp-content/plugins/woocommerce/templates/single-product/related.php
в строке 12.
С
<h2><?php esc_html_e( 'Related products', 'woocommerce' ); ?></h2>
К
<h2><?php esc_html_e( 'Customers who rented this item also rented:', 'woocommerce' ); ?></h2>
Я также добавил этот код в файл function.php:
function custom_related_products_text( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Related products' :
$translated_text = __( 'Customers who rented this item also rented:', 'woocommerce' );
break;
}
return $translated_text;
}
add_filter( 'gettext', 'custom_related_products_text', 20, 3 );
Но, похоже, он не работает
<h2><?php esc_html_e( 'Customers who rented this item also rented:', 'woocommerce' ); ?></h2>
msgid "Related Products"
msgstr "Customers who rented this item also rented:"
function custom_related_products_text( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Related products' :
$translated_text = __( 'Customers who rented this item also rented:', 'woocommerce' );
break;
}
return $translated_text;
}
add_filter( 'gettext', 'custom_related_products_text', 20, 3 );
Предполагается, что связанный текст продуктаизменить на
Клиенты, которые арендовали этот предмет, также арендовали: