Repository: saleor/saleor
Pull request: Deprecate `localized` field in Money type
Set 'localized' field in the Money type as deprecated - it's useless. Price formatting according to the current locale will be handled by the frontend client.

Closes #4934 

### Pull Request Checklist

<!-- Please keep this section. It will make maintainer's life easier. -->

1. [ ] Privileged views and APIs are guarded by proper permission checks.
1. [ ] All visible strings are translated with proper context.
1. [ ] All data-formatting is locale-aware (dates, numbers, and so on).
1. [ ] Database queries are optimized and the number of queries is constant.
1. [ ] Database migration files are up to date.
1. [ ] The changes are tested.
1. [x] GraphQL schema and type definitions are up to date.
1. [x] Changes are mentioned in the changelog.


Problem statement:
Deprecate `localized` field
Deprecate the `localized` field in the `Money` type. In the API it's enough to expose the `amount` and `currency` fields, while price formatting according to the current locale should be handled by the frontend client (we already have a library for that in our dashboard).

Hints from issue discussion:

Commit message: Edit changelog

Patch to review:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c0d1bd83e64..4fb2656c7f9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,7 @@ All notable, unreleased changes to this project will be documented in this file.
 
 - Fix problem with free shipping voucher - #4942 by @IKarbowiak
 - Add sub-categories to random data - #4949 by @IKarbowiak
+- Deprecate `localized` field in Money type - #4952 by @IKarbowiak
 
 ## 2.9.0
 
diff --git a/saleor/graphql/core/types/money.py b/saleor/graphql/core/types/money.py
index e1f7c1e6f04..9b10ef01cb3 100644
--- a/saleor/graphql/core/types/money.py
+++ b/saleor/graphql/core/types/money.py
@@ -8,7 +8,11 @@ class Money(graphene.ObjectType):
     currency = graphene.String(description="Currency code.", required=True)
     amount = graphene.Float(description="Amount of money.", required=True)
     localized = graphene.String(
-        description="Money formatted according to the current locale.", required=True
+        description="Money formatted according to the current locale.",
+        required=True,
+        deprecation_reason="DEPRECATED: Will be removed in Saleor 2.11. "
+        "Price formatting according to the current locale will be "
+        "handled by the frontend client.",
     )
 
     class Meta:
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphql
index 4d12f342c11..7c3ecdd1e1d 100644
--- a/saleor/graphql/schema.graphql
+++ b/saleor/graphql/schema.graphql
@@ -2004,7 +2004,7 @@ type MetaStore {
 type Money {
   currency: String!
   amount: Float!
-  localized: String!
+  localized: String! @deprecated(reason: "DEPRECATED: Will be removed in Saleor 2.11. Price formatting according to the current locale will be handled by the frontend client.")
 }
 
 type MoneyRange {


Code review comments:
diff_hunk: @@ -8,7 +8,11 @@ class Money(graphene.ObjectType):
     currency = graphene.String(description="Currency code.", required=True)
     amount = graphene.Float(description="Amount of money.", required=True)
     localized = graphene.String(
-        description="Money formatted according to the current locale.", required=True
+        description="Money formatted according to the current locale.",
+        required=True,
+        deprecation_reason="DEPRECATED: Will be removed in Saleor 2.11. "
+        "Price formatting according to the current locale will be "
path: saleor/graphql/core/types/money.py
text: @user1:
```suggestion
        "Price formatting according to the current locale should be "
```

diff_hunk: @@ -2004,7 +2004,7 @@ type MetaStore {
 type Money {
   currency: String!
   amount: Float!
-  localized: String!
+  localized: String! @deprecated(reason: "DEPRECATED: Will be removed in Saleor 2.11. Price formatting according to the current locale will be handled by the frontend client.")
path: saleor/graphql/schema.graphql
text: @user2:
```suggestion
  localized: String! @user1(reason: "DEPRECATED: Will be removed in Saleor 2.11. Price formatting according to the current locale should be handled by the frontend client.")
```