saleor / saleor-storefront

A GraphQL-powered, NextJs-based, PWA storefront for Saleor. IMPORTANT: This project is [DEPRECATED] in favor of saleor/react-storefront soon to become our default demo and storefront starter pack.
https://demo.saleor.io/
BSD 3-Clause "New" or "Revised" License
770 stars 674 forks source link

Use model translations #307

Open maarcingebala opened 5 years ago

maarcingebala commented 5 years ago

Our backend supports model translations which allow having multiple language version of the content that is stored in the database e.g. product titles, descriptions, category names, etc. Modal translations can be tested in Dashboard 2.0 in the "Translations" section in the main navigation. Support for that should be also implemented in the storefront.

This example query that fetches product data in original language and translations in German:

{
  product(id: "UHJvZHVjdDo3Mg==") {
    id
    name
    seoDescription
    translation(languageCode: DE) {
      name
      seoDescription
    }
  }
}

Response:

{
  "data": {
    "product": {
      "id": "UHJvZHVjdDo3Mg==",
      "name": "Apple Juice",
      "seoDescription": "Fell straight from the tree, on to Newton’s head, then into the bottle. The autumn taste of English apples. Brought to you by gravity.",
      "translation": {
        "name": "Apfelsaft",
        "seoDescription": "Vom Baum auf Newtons Kopf direkt in die Flasche gefallen. Der Herbstgeschmack englischer Äpfel. Durch Schwerkraft zu Ihnen gebracht."
      }
    }
  }
}
stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

krzysztofwolski commented 4 years ago

For the record - SDK we refine ATM is handling it. In upcoming months we will deliver working examples :)