Menu

#43 Multi-language support for WooCommerce (slugs) skip cache rules

open
nobody
None
2022-01-22
2020-05-19
Anonymous
No

Originally created by: Bronislawsky

/sites-enables/default

    ## sensitive wordpress urls should always skip the cache
    if ($request_uri ~* "index.php|/account.*|/cart.*|/checkout.*|/contact.*|/dashboard.*|/login.*|/my-.*|/order.*|/profile.*|/register.*|/settings.*|/view.*|/wc-api.*|/wp-admin.*|wp-.*.php") {
        set $skip_cache 1;
    }

In french, we use panier instead of cart etc,

Is it a possibility to eventually add multilang support or a custom skip cache options for
other language than English ?

Discussion

  • Anonymous

    Anonymous - 2020-05-19

    Originally posted by: jessuppi

    @Bronislawsky It is something that I've thought about since the beginning, however I'm not sure what the best approach would be. Obviously yes, including every single common URI slug in dozens of languages by default would not be very manageable.

    So yah, probably it would need a variable in ss-config for custom slugs to skip cache.

    That said, I'd also love to be able to popularize certain URIs (spellings) for commonality/SEO... I'm not a fan of needlessly complex slugs like shopping-cart instead of just cart etc.

     
  • Anonymous

    Anonymous - 2022-01-19

    Originally posted by: backamblock

    suggestion:
    ask about language in the installer script and link it to a file in your repository. everybody who needs a language should contribute the file with the correct translations.
    Workaround for not yet accepted contributions: set own URL or path to language files in the ss-config

    example file: "de_DE.txt"

    cart="warenkorb"
    account="mein-konto"
    checkout="checkout"
    contact="kontakt"
    .....

    this is just an example, i don't have the correct slugs in my head right now.

    another, easier, way would be to set the initial exclusions in english, then get the current values of woocommerce on each ss-update.
    this way the user would not need to install everything a second time after reading his config and writing the file.
    but i guess this would involve more coding

     
  • Anonymous

    Anonymous - 2022-01-22

    Originally posted by: backamblock

    In french, we use panier instead of cart etc,

    Is it a possibility to eventually add multilang support or a custom skip cache options for
    other language than English ?

    can you please insert the correct values here @Bronislawsky and i will add them to my fork. they may get pulled to this repo

        ## FRENCH - sensitive wordpress urls should always skip the cache
        if ($request_uri ~* "index.php|/account.*|/cart.*|/checkout.*|/contact.*|/dashboard.*|/login.*|/my-.*|/order.*|/profile.*|/register.*|/settings.*|/view.*|/wc-api.*|/wp-admin.*|wp-.*.php") {
            set $skip_cache 1;
        }
    
     
  • Anonymous

    Anonymous - 2022-01-22

    Originally posted by: jessuppi

    As an aside, I mentioned this on the Pull Request but to begin considering support for 100 languages we should probably move the skip cache rules into a new Nginx module instead like:

    /etc/nginx/conf.d/skip-cache.conf ... or something where users only install the skip cache rules for one language.

    Ref: https://github.com/littlebizzy/slickstack/pull/141

     

Log in to post a comment.

MongoDB Logo MongoDB