SAP / spartacus

Spartacus is a lean, Angular-based JavaScript storefront for SAP Commerce Cloud that communicates exclusively through the Commerce REST API.
Apache License 2.0
740 stars 387 forks source link

Redirect when site-context active language changes #727

Open Platonn opened 5 years ago

Platonn commented 5 years ago

Many Customers have CMS content in many different languages. Currently, we support switching language of CMS content using the site-context language switcher

Customers should be also able to configure the additional behaviour of site-context switcher - if and where to redirect after language change:

  1. nowhere
  2. to other (sub)domain
  3. to other sub-route /en/, /de/

Cases to support

  1. 2 domains (de.mystore.com, en.mystore.com), routes internationalized (/produkt, /product), each domain shows content in its language, redirect to other domain on language change
  2. 2 domains (de.mystore.com, en.mystore.com), routes internationalized (/produkt, /product), two content languages per domain: DE & FR for de.mystore.com and EN & FR for en.mystore.com, redirect to other domain on language change (but what if FR is chosen?)
  3. 1 domain mystore.com, routes internationalized (/de/produkt, /en/product), each sub-route shows content in its language, redirect to other sub-route on language change
  4. 1 domain mystore.com, routes internationalized (/de/produkt, /en/product), 3 content languages: EN, DE, FR, don't redirect on language change
  5. The most complex: 2 domains (fr.mystore.com, mystore.com), routes internationalized (/produit in french domain; /de/produkt, /en/product in global domain), 4 content languages: FR for french domain; EN, DE, PL for global domain, redirect to other domain or other sub-route on language change conditionally (but what if PL is chosen?)

NOTE: This task should be started when #186 is done (the support of internationalized routes at one domain)

Possibly related topic: Multisite & multisite switcher

tobi-or-not-tobi commented 5 years ago

If the active language doesn't match any of the languages of the storefront, we should set the active language to the defaultLanguage of the store.

Platonn commented 5 years ago

When navigating to a page in new language but in scope of the same Storefront's intance, it would be nice to:

Platonn commented 5 years ago

Assigned 'future' label (post-1.0), because in 1.0 we won't support localizable routes.