• Resolved SimonGiddings

    (@simongiddings)


    I am running a french language site.
    I upgraded to v2.5.2 of WooCommerce.

    Before upgrading, my category link was this :
    https://[site address]/categorie-produit/accessoires/

    After having upgraded my dev system (not publicly accessible) to test the new version, it was changed to this :
    https://[site address]/product-category/accessoires/

    This caused the site to stop working !

    I then upgraded to v2.5.3 and, even though the name did not change, at least the link now works.

    As there are other strings which have switched back to english, could this be a problem with the translation files ?

    https://www.ads-software.com/plugins/woocommerce/

Viewing 12 replies - 1 through 12 (of 12 total)
  • Caleb Burks

    (@icaleb)

    Automattic Happiness Engineer

    Hi SimonGiddings,

    Try going to Settings > Permalinks and looking at the setting there. You probably need to change the “Product category base” option.

    Thread Starter SimonGiddings

    (@simongiddings)

    Hi Caleb,

    This seems obvious, however, simply with the French translation file for woocommerce the default was “categorie-produit”.

    This is why I feel that there is a problem with the translation files.

    In addition, there are other strings which are now nolonger translated, for example in the WooCommerce menu within the admin panel “Orders” instead of “Commandes”.

    Plugin Contributor Mike Jolley (a11n)

    (@mikejolley)

    By all means contribute to that if you can via https://translate.www.ads-software.com/projects/wp-plugins/woocommerce

    Thread Starter SimonGiddings

    (@simongiddings)

    Why ?
    It worked fine in the version prior to v2.5.2 !

    Plugin Contributor Mike Jolley (a11n)

    (@mikejolley)

    Strings get added in each new version, and different users contribute to the translation over time.

    Thread Starter SimonGiddings

    (@simongiddings)

    Ok, granted.
    However, these are strings which have existed for a long time.
    I wanted to see where they are referenced in code, without success.

    I then went to the translation project and downloaded the latest stable version. This gave me “wp-plugins-woocommerce-stable-fr.po”

    When I looked in the languages/plugins directory, I found
    “woocommerce-admin-fr_FR.po”
    “woocommerce-fr_FR.po”
    with the corresponding .mo files.

    When I looked at the contents of woocommerce-admin-fr_FR, I found the missing definition :
    #: includes/admin/class-wc-admin-permalink-settings.php:68
    msgctxt “slug”
    msgid “product-category”
    msgstr “categorie-produit”

    I then searched in wp-plugins-woocommerce-stable-fr where I found
    #: includes/admin/class-wc-admin-permalink-settings.php:68
    #: includes/class-wc-post-types.php:86
    #: includes/updates/woocommerce-update-2.0.php:46
    msgctxt “slug”
    msgid “product-category”
    msgstr “categorie-produit”

    So, it would appear that the language files are not the source of the problem.
    Next, I took a look at the referenced line in class-wc-admin-permalink-settings.php where I found
    <input name=”woocommerce_product_category_slug” type=”text” class=”regular-text code” value=”<?php if ( isset( $permalinks[‘category_base’] ) ) echo esc_attr( $permalinks[‘category_base’] ); ?>” placeholder=”<?php echo esc_attr_x(‘product-category’, ‘slug’, ‘woocommerce’) ?>” />

    So, where the string to translate is correctly specified, along with the context, wordpress does not find it in the translation file.

    Something has definitely been changed in code.
    What can you suggest ?

    Plugin Contributor Mike Jolley (a11n)

    (@mikejolley)

    Something has definitely been changed in code.

    There used to be 2 files; admin and frontend pos.

    This is no longer the case. There is one localisation file.

    Translations are only downloaded when at 100%, so install manually following instructions here https://docs.woothemes.com/document/woocommerce-localization/

    Thread Starter SimonGiddings

    (@simongiddings)

    Followed your instructions –

    1. Downloaded .mo stable file
    2. renamed to woocommerce-fr_FR.mo
    3. Copied into wp-content/languages\plugins
    4. Tested = no change
    5. Saw that instructions said to put it into wp-content/languages/woocommerce
    6. Created this directory and copied .mo into it
    7. Tested = no change
    8. Stopped and restarted Apache
    9. Tested = no change !

    Can’t see what to do now !

    Plugin Contributor Mike Jolley (a11n)

    (@mikejolley)

    wp-content/languages/woocommerce is correct. Important note though, I think the .no you download from translate.wordpress includes confirmed strings only. If you find the string on there and it is unconfirmed (yellow background, not green) I don’t think its included.

    Thread Starter SimonGiddings

    (@simongiddings)

    The strings I am testing are indeed confirmed and have been for quite a while now – they are even in the .po file.

    Plugin Contributor Mike Jolley (a11n)

    (@mikejolley)

    Thread Starter SimonGiddings

    (@simongiddings)

    As is quite often the case when we develop, we are absolutely certain that “new” problems cannot be in our code !
    Yep, you guessed it, I found the source of the problem.

    I had to filter translations to eliminate the # sign before order numbers.
    Could not see how to do this other wise.
    So I hooked into “gettext_with_context”.
    This takes the following parameters :
    $translations, $text, $context, $domain

    where $translations is the translated text.
    My bug ? I returned $text (the original untranslated text).

    My error, sorry to have wasted your time.
    Perhaps this aspect of putting something before the order number could be a configurable parameter ?

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘upgrading is breaking category links’ is closed to new replies.