Skip to content

[GraphQL] Price and Category Aggregation Labels are not translated #36140

Closed
@t-heuser

Description

@t-heuser

Preconditions and environment

  • Magento version: 2.4.5
  • A store view with any language thats not english

Steps to reproduce

Execute the following graphql query:

query searchProducts {
    products(search: "") {
        aggregations {
            label
        }
    }
}

This query fetches all available aggregations (filters) and the labels for them.

Expected result

I would expect all labels to be translated into the language of the store (german in my case).

{
  "data": {
    "products": {
      "aggregations": [
        {
          "label": "Preis"
        },
        {
          "label": "Kategorie"
        },
        {
          "label": "Farbe"
        },
        {
          "label": "..."
        },
      ]
    }
  }
}

Actual result

{
  "data": {
    "products": {
      "aggregations": [
        {
          "label": "Price"
        },
        {
          "label": "Category"
        },
        {
          "label": "Farbe"
        },
        {
          "label": "..."
        },
      ]
    }
  }
}

Only the label for the attribute color (Farbe) is translated as set in the adminhtml. The label set for the price attribute is ignored and I can't even set any label for the category attribute.

Additional information

The problem arises because of hardcoded labels in the code:

$result = $this->layerFormatter->buildLayer(
self::$bucketMap[self::CATEGORY_BUCKET]['label'],
\count($categoryIds),
self::$bucketMap[self::CATEGORY_BUCKET]['request_name']
);

private static $bucketMap = [
self::CATEGORY_BUCKET => [
'request_name' => 'category_uid',
'label' => 'Category'
],
];

and

$result = $this->layerFormatter->buildLayer(
self::$bucketMap[self::PRICE_BUCKET]['label'],
\count($bucket->getValues()),
self::$bucketMap[self::PRICE_BUCKET]['request_name']
);

private static $bucketMap = [
self::PRICE_BUCKET => [
'request_name' => 'price',
'label' => 'Price'
],
];

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

Labels

Area: ProductComponent: TranslationGraphQlIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: doneReported on 2.4.5Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branch

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions