skip to Main Content

The "Addresses" tab in "My Account" page is not displayed in the website language when I use Arabic while it should be already translated.

It`s placeholder "the empty highlighted space in the screenshot" still works and navigates to the correct page as expected.

I`m using latest WordPress 5.5 and WooCommerce 4.4.1 and it works normally if I switched to English and worked before in Arabic AFAIK.

https://imgur.com/a/HIZTG3h

for testing purposes, I used TranslatePress plugin to insert the Arabic translation for the string and it worked only while using the plugin.

I also tried debugging using the developer console and playing around with the below codes to no avail, the issue even exists when using the default theme.

1- code responsible for displaying the label of the menu: wp-contentpluginswoocommercetemplatesmyaccountnavigation.php

    <nav class="woocommerce-MyAccount-navigation">
    <ul>
        <?php foreach ( wc_get_account_menu_items() as $endpoint => $label ) : ?>
            <li class="<?php echo wc_get_account_menu_item_classes( $endpoint ); ?>">
                <a href="<?php echo esc_url( wc_get_account_endpoint_url( $endpoint ) ); ?>"><?php echo esc_html( $label ); ?></a>
            </li>
        <?php endforeach; ?>
    </ul>
</nav>

<?php do_action( 'woocommerce_after_account_navigation' ); ?>

2- code for the item displayed which if I changed "Addresses" to something else it appears: wp-contentpluginswoocommerceincludeswc-account-functions.php

        $items = array(
        'dashboard'       => __( 'Dashboard', 'woocommerce' ),
        'orders'          => __( 'Orders', 'woocommerce' ),
        'downloads'       => __( 'Downloads', 'woocommerce' ),
        'edit-address'    => _n( 'Addresses', 'Address', (int) wc_shipping_enabled(), 'woocommerce' ),
        'payment-methods' => __( 'Payment methods', 'woocommerce' ),
        'edit-account'    => __( 'Account details', 'woocommerce' ),
        'customer-logout' => __( 'Logout', 'woocommerce' ),
    );

3- translated strings: wp-contentlanguagespluginswoocommerce-ar.po

#: includes/class-wc-query.php:126
#: includes/admin/settings/class-wc-settings-advanced.php:284
#: includes/wc-account-functions.php:102
msgid "Addresses"
msgid_plural "Address"
msgstr[0] "العناوين"
msgstr[1] ""
msgstr[2] ""
msgstr[3] ""
msgstr[4] ""
msgstr[5] ""

2

Answers


  1. Chosen as BEST ANSWER

    fixed the issue using Loco Translate, by updating the Arabic translation PO and MO files as per the github issue feedback and woocommerce support forum on the plugins directory.

    https://github.com/woocommerce/woocommerce/issues/27428 and https://wordpress.org/support/topic/updating-translations-after-updates/


  2. My solution was to use javascript code

    let addressLink=document.querySelector('.woocommerce-MyAccount-navigation-link--edit-address a')
    if (addressLink!=null) {
    if(addressLink.innerText==""){
        addressLink.innerText="العنوان"
    }}
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search