• Resolved Alexandre Froger

    (@frogerme)


    Hi,

    I noticed that several paths added by third-party plugins are not translated. The most obvious example may be in WooCommerce, such as:

      Original: https://domain.tld/en/my-account/edit-account/

    • Translated: https://domain.tld/en/my-account/

    This comes from Falang_Public::get_translated_url( $language ): indeed, the method requires a queried object or a WordPress system path (archive, search, etc) to translate URLs, but is unaware of other kinds of URL rewrites.

    Would it be possible to:

      Amend falang/src/Falang/Filter/Site/WooCommerce.php to take all WooCommerce paths into account?

    • At the very least (as this is low hanging fruit), provide a filter for developers in Falang_Public::get_translated_url( $language ), returning apply_filters( 'falang_get_translated_link', $link, $language ) instead of the raw $link?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author sbouey

    (@sbouey)

    Hi,
    1) my account url in other language

    if you have an url
    https://domain.tld/en/my-account/
    and you make the translation of the page to “Mon comtpe” (slug my-account)

    the url is translated normally
    https://domain.tld/fr/mon-compte/

    but you are right if you are in the url
    https://domain.tld/en/my-account/edit-account/
    the switcher link to
    http://localhost/falangw/fr/mon-compte/
    and not the edit page

    i will look to fix this

    2) extra filter
    for the filter you want in class-ffalang-public.php
    line 1451

    
    $this->restore_language();
    apply_filters( 'falang_get_translated_link', $link, $language);
    return $link;
    

    yes i can add this in the next version.

    Stéphane

    Plugin Author sbouey

    (@sbouey)

    probably more falang_get_translated_url because it’s throw in get_translated_url function

    `
    apply_filters( ‘falang_get_translated_url’, $link, $language);

    Stéphane

    Plugin Author sbouey

    (@sbouey)

    the right change

    
    $this->restore_language();
    $link = apply_filters( 'falang_get_translated_url', $link, $language);
    return $link;
    

    Stéphane

    Thread Starter Alexandre Froger

    (@frogerme)

    Hi Stéphane @sbouey !

    I just checked the new version, thanks for the filter! That should enable third-party plugins (and my own custom code ;)) to integrate better, much appreciated!

    Plugin Author sbouey

    (@sbouey)

    Hi,

    it’s normal don’t hesitate to ask for more update.

    I will add more documentation on Falang/WooCommerce and i have started video too.

    Stéphane

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘URL translation, WooCommerce, and other third part paths’ is closed to new replies.