open-api icon indicating copy to clipboard operation
open-api copied to clipboard

[FEATURE]: Provide variations values translation in inventory and properties

Open creharmony opened this issue 4 years ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Describe the bug

(it's close to #254 but not the same issue)

I worked with listing having variations, and using previous v2 version of api, I were able to get complete translations of a given listing: fr, en. especially variation property values.

If we focus on variations, the v2 getListing with "Variations" in includes, and with language: 'en'|'fr' allow us to retrieve formatted_name and formatted_value in french or in english.

By applying the same need with v3 API, first we need a new call because Variationsis no supported by getListing (etsy/open-api#236) second it seems that the language parameter only apply on formatted_name and not apply on `formatted_value

Steps to reproduce

V2: getListing en options: { language: 'en', translate_keywords:true, currency: "EUR", includes:"Variations" }

      "Variations": [
        {
          "property_id": 200,
          "formatted_name": "Primary color",
          "options": [
            {
              "value_id": 52319013442,
              "value": "Blue",
              "formatted_value": "Blue",
              "is_available": true,
              "price_diff": 0,
              "price": 11.5
            },
            {
              "value_id": 68786843649,
              "value": "Clear",
              "formatted_value": "Clear",
              "is_available": true,
              "price_diff": 0,
              "price": 11.5
            }
          ]
        }

V2: getListing fr options:{ language: 'fr', translate_keywords:true, currency: "EUR", includes:"Variations" }

      "Variations": [
        {
          "property_id": 200,
          "formatted_name": "Couleur principale",
          "options": [
            {
              "value_id": 52319013442,
              "value": "Bleu",
              "formatted_value": "Bleu",
              "is_available": true,
              "price_diff": 0,
              "price": 11.5
            },
            {
              "value_id": 68786843649,
              "value": "Transparent",
              "formatted_value": "Transparent",
              "is_available": true,
              "price_diff": 0,
              "price": 11.5
            }
          ]
        }
      ]
    }
  ],

v3 getListingInventory(listing_id, { language: 'fr' }) getListingInventory(listing_id, { language: 'en', translate_keywords:true})

  "products": [
    {
      "product_id": 6737693855,
      "sku": "",
      "is_deleted": false,
      "offerings": [
        {
          "offering_id": 6958721164,
          "quantity": 2,
          "is_enabled": true,
          "is_deleted": false,
          "price": {
            "amount": 1150,
            "divisor": 100,
            "currency_code": "EUR"
          }
        }
      ],
      "property_values": [
        {
          "property_id": 200,
          "property_name": "Primary color",		// OK
          "scale_id": null,
          "scale_name": null,
          "value_ids": [
            52319013442
          ],
          "values": [
            "Bleu"					<=== not translated
          ]
        }
      ]
    },
    {
      "product_id": 6972915806,
      "sku": "",
      "is_deleted": false,
      "offerings": [
        {
          "offering_id": 6831063957,
          "quantity": 2,
          "is_enabled": true,
          "is_deleted": false,
          "price": {
            "amount": 1150,
            "divisor": 100,
            "currency_code": "EUR"
          }
        }
      ],
      "property_values": [
        {
          "property_id": 200,
          "property_name": "Primary color",
          "scale_id": null,
          "scale_name": null,
          "value_ids": [
            68786843649
          ],
          "values": [
            "Transparent"		       <=== not translated
          ]
        }
      ]
    }
  ],
getListingVariationImages(listing_id, { language: 'fr' })
getListingVariationImages(listing_id, { language: 'en' }) 
  "count": 2,
  "results": [
    {
      "property_id": 200,
      "value_id": 52319013442,
      "value": "Bleu",			<=== not translated
      "image_id": 3104809751
    },
    {
      "property_id": 200,
      "value_id": 68786843649,
      "value": "Transparent",	<=== not translated
      "image_id": 3104809861
    }
  ]
}

Expected behavior

I expect values to be translated too.

Additional context

I also notice with this updates etsy/open-api#405 that getListingVariationImages also include shopId in url that may be removed too ? cc @etsyachristensen

creharmony avatar Apr 07 '22 19:04 creharmony

@creharmony

  1. First off, yes you can remove shops/{shop_id} from the getListingVariationImages endpoint call as it's no longer needed.
  2. On the translations... I'm a bit confused. We don't translate the Property Name value currently. I can see that and will look into the reasoning for that. But the your examples for V3 are incorrect I think.

In your examples you are asking for French and are saying that "Bleu" is not translated. Yet that is the French version of "Blue" and "Transparent" is also the French translation (spelled the same in the masculine form).

etsyachristensen avatar Apr 11 '22 22:04 etsyachristensen

The V3 OpenAPI does not use the language and translate_keywords variables. We don't currently have a way in the OpenAPI V3 to get translations for the inventory or any other association for the listing. We only have the getListingTranslation endpoint that returns translation of the listing. At the moment, all other endpoints will return the default shop language information.

We will work on adding a way to get the inventory translated.

etsyachristensen avatar Apr 15 '22 20:04 etsyachristensen