Skip to content

Commit

Permalink
Revert "Add names of attributes translations (saleor#2433)" (saleor#2531
Browse files Browse the repository at this point in the history
)

This reverts commit 7963836.
  • Loading branch information
orzechdev authored Nov 7, 2022
1 parent 8ab097b commit 7fd2eb2
Show file tree
Hide file tree
Showing 16 changed files with 241 additions and 205 deletions.
16 changes: 0 additions & 16 deletions introspection.json
Original file line number Diff line number Diff line change
Expand Up @@ -9357,22 +9357,6 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "attribute",
"description": "Represents a value of an attribute.",
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "AttributeTranslatableContent",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "attributeValue",
"description": "Represents a value of an attribute.",
Expand Down
8 changes: 4 additions & 4 deletions locale/defaultMessages.json
Original file line number Diff line number Diff line change
Expand Up @@ -3460,6 +3460,10 @@
"context": "window title",
"string": "Create Product"
},
"PajjqE": {
"context": "attribute list",
"string": "Attribute {number}"
},
"PbQJY5": {
"context": "section header",
"string": "Saleor Apps"
Expand Down Expand Up @@ -7878,10 +7882,6 @@
"context": "attribute type",
"string": "Content Attribute"
},
"zgqPGF": {
"context": "attribute list",
"string": "Attribute {name}"
},
"zjHH6b": {
"context": "sale start date",
"string": "Started"
Expand Down
3 changes: 0 additions & 3 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1881,9 +1881,6 @@ type AttributeValueTranslatableContent implements Node {
languageCode: LanguageCodeEnum!
): AttributeValueTranslation

"""Represents an attribute."""
attribute: Attribute!

"""Represents a value of an attribute."""
attributeValue: AttributeValue @deprecated(reason: "This field will be removed in Saleor 4.0. Get model fields from the root level queries.")
}
Expand Down
98 changes: 67 additions & 31 deletions src/fragments/translations.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,5 @@
import { gql } from "@apollo/client";

export const attributeValueTranslatableFragment = gql`
fragment AttributeValueTranslatable on AttributeValueTranslatableContent {
id
name
plainText
richText
attributeValue {
id
}
attribute {
id
name
}
translation(languageCode: $language) {
id
name
plainText
richText
language {
code
language
}
}
}
`;

export const categoryTranslationFragment = gql`
fragment CategoryTranslation on CategoryTranslatableContent {
translation(languageCode: $language) {
Expand Down Expand Up @@ -90,7 +64,21 @@ export const productTranslationFragment = gql`
}
}
attributeValues {
...AttributeValueTranslatable
id
name
richText
attributeValue {
id
}
translation(languageCode: $language) {
id
name
richText
language {
code
language
}
}
}
}
`;
Expand All @@ -110,7 +98,21 @@ export const productVariantTranslationFragment = gql`
}
}
attributeValues {
...AttributeValueTranslatable
id
name
richText
attributeValue {
id
}
translation(languageCode: $language) {
id
name
richText
language {
code
language
}
}
}
}
`;
Expand Down Expand Up @@ -189,7 +191,21 @@ export const pageTranslationFragment = gql`
}
}
attributeValues {
...AttributeValueTranslatable
id
name
richText
attributeValue {
id
}
translation(languageCode: $language) {
id
name
richText
language {
code
language
}
}
}
}
`;
Expand Down Expand Up @@ -224,13 +240,11 @@ export const attributeChoicesTranslationFragment = gql`
node {
id
name
plainText
richText
inputType
translation(languageCode: $language) {
id
name
plainText
richText
}
}
Expand Down Expand Up @@ -277,6 +291,28 @@ export const attributeTranslationDetailsFragment = gql`
}
`;

export const attributeValueTranslatableContentFragment = gql`
fragment AttributeValueTranslatableContent on AttributeTranslatableContent {
translation(languageCode: $language) {
id
name
}
attribute {
id
name
inputType
choices(
first: $firstValues
after: $afterValues
last: $lastValues
before: $beforeValues
) {
...AttributeChoicesTranslation
}
}
}
`;

export const menuItemTranslationFragment = gql`
fragment MenuItemTranslation on MenuItemTranslatableContent {
translation(languageCode: $language) {
Expand Down
102 changes: 69 additions & 33 deletions src/graphql/hooks.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2437,31 +2437,6 @@ export const CollectionTranslationFragmentDoc = gql`
}
}
`;
export const AttributeValueTranslatableFragmentDoc = gql`
fragment AttributeValueTranslatable on AttributeValueTranslatableContent {
id
name
plainText
richText
attributeValue {
id
}
attribute {
id
name
}
translation(languageCode: $language) {
id
name
plainText
richText
language {
code
language
}
}
}
`;
export const ProductTranslationFragmentDoc = gql`
fragment ProductTranslation on ProductTranslatableContent {
product {
Expand All @@ -2483,10 +2458,24 @@ export const ProductTranslationFragmentDoc = gql`
}
}
attributeValues {
...AttributeValueTranslatable
id
name
richText
attributeValue {
id
}
translation(languageCode: $language) {
id
name
richText
language {
code
language
}
}
}
}
${AttributeValueTranslatableFragmentDoc}`;
`;
export const ProductVariantTranslationFragmentDoc = gql`
fragment ProductVariantTranslation on ProductVariantTranslatableContent {
productVariant {
Expand All @@ -2502,10 +2491,24 @@ export const ProductVariantTranslationFragmentDoc = gql`
}
}
attributeValues {
...AttributeValueTranslatable
id
name
richText
attributeValue {
id
}
translation(languageCode: $language) {
id
name
richText
language {
code
language
}
}
}
}
${AttributeValueTranslatableFragmentDoc}`;
`;
export const SaleTranslationFragmentDoc = gql`
fragment SaleTranslation on SaleTranslatableContent {
sale {
Expand Down Expand Up @@ -2579,10 +2582,24 @@ export const PageTranslationFragmentDoc = gql`
}
}
attributeValues {
...AttributeValueTranslatable
id
name
richText
attributeValue {
id
}
translation(languageCode: $language) {
id
name
richText
language {
code
language
}
}
}
}
${AttributeValueTranslatableFragmentDoc}`;
`;
export const PageTranslatableFragmentDoc = gql`
fragment PageTranslatable on PageTranslatableContent {
id
Expand Down Expand Up @@ -2628,13 +2645,11 @@ export const AttributeChoicesTranslationFragmentDoc = gql`
node {
id
name
plainText
richText
inputType
translation(languageCode: $language) {
id
name
plainText
richText
}
}
Expand Down Expand Up @@ -2663,6 +2678,27 @@ export const AttributeTranslationDetailsFragmentDoc = gql`
}
}
${AttributeChoicesTranslationFragmentDoc}`;
export const AttributeValueTranslatableContentFragmentDoc = gql`
fragment AttributeValueTranslatableContent on AttributeTranslatableContent {
translation(languageCode: $language) {
id
name
}
attribute {
id
name
inputType
choices(
first: $firstValues
after: $afterValues
last: $lastValues
before: $beforeValues
) {
...AttributeChoicesTranslation
}
}
}
${AttributeChoicesTranslationFragmentDoc}`;
export const MenuItemTranslationFragmentDoc = gql`
fragment MenuItemTranslation on MenuItemTranslatableContent {
translation(languageCode: $language) {
Expand Down
3 changes: 1 addition & 2 deletions src/graphql/typePolicies.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -549,14 +549,13 @@ export type AttributeValueDeletedFieldPolicy = {
recipient?: FieldPolicy<any> | FieldReadFunction<any>,
attributeValue?: FieldPolicy<any> | FieldReadFunction<any>
};
export type AttributeValueTranslatableContentKeySpecifier = ('id' | 'name' | 'richText' | 'plainText' | 'translation' | 'attribute' | 'attributeValue' | AttributeValueTranslatableContentKeySpecifier)[];
export type AttributeValueTranslatableContentKeySpecifier = ('id' | 'name' | 'richText' | 'plainText' | 'translation' | 'attributeValue' | AttributeValueTranslatableContentKeySpecifier)[];
export type AttributeValueTranslatableContentFieldPolicy = {
id?: FieldPolicy<any> | FieldReadFunction<any>,
name?: FieldPolicy<any> | FieldReadFunction<any>,
richText?: FieldPolicy<any> | FieldReadFunction<any>,
plainText?: FieldPolicy<any> | FieldReadFunction<any>,
translation?: FieldPolicy<any> | FieldReadFunction<any>,
attribute?: FieldPolicy<any> | FieldReadFunction<any>,
attributeValue?: FieldPolicy<any> | FieldReadFunction<any>
};
export type AttributeValueTranslateKeySpecifier = ('translationErrors' | 'errors' | 'attributeValue' | AttributeValueTranslateKeySpecifier)[];
Expand Down
Loading

0 comments on commit 7fd2eb2

Please sign in to comment.