Skip to content

Commit

Permalink
Fix product type translations (#1163)
Browse files Browse the repository at this point in the history
* Fix product type translations

* Update changelog
  • Loading branch information
orzechdev authored Jun 15, 2021
1 parent c3e720a commit 88e5db0
Show file tree
Hide file tree
Showing 35 changed files with 661 additions and 110 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ All notable, unreleased changes to this project will be documented in this file.
- Add pagination on attribute values - #1112 by @orzechdev
- Paginate attribute values in filters - #1152 by @orzechdev
- Fix attribute values input display - #1156 by @orzechdev
- Fix product type translations - #1163 by @orzechdev

# 2.11.1

Expand Down
4 changes: 4 additions & 0 deletions locale/defaultMessages.json
Original file line number Diff line number Diff line change
Expand Up @@ -6735,6 +6735,10 @@
"context": "header",
"string": "Translation Attribute \"{attribute}\" - {languageCode}"
},
"src_dot_translations_dot_components_dot_TranslationsProductTypesPage_dot_values": {
"context": "section name",
"string": "Values"
},
"src_dot_translations_dot_components_dot_TranslationsProductsPage_dot_1406947243": {
"string": "Search Engine Description"
},
Expand Down
4 changes: 4 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export interface AppListViewSettings {
[ListViews.VOUCHER_LIST]: ListSettings;
[ListViews.WAREHOUSE_LIST]: ListSettings;
[ListViews.WEBHOOK_LIST]: ListSettings;
[ListViews.TRANSLATION_ATTRIBUTE_VALUE_LIST]: ListSettings;
}
export const defaultListSettings: AppListViewSettings = {
[ListViews.APPS_LIST]: {
Expand Down Expand Up @@ -97,6 +98,9 @@ export const defaultListSettings: AppListViewSettings = {
},
[ListViews.WEBHOOK_LIST]: {
rowNumber: PAGINATE_BY
},
[ListViews.TRANSLATION_ATTRIBUTE_VALUE_LIST]: {
rowNumber: 10
}
};

Expand Down
59 changes: 48 additions & 11 deletions src/fragments/translations.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import gql from "graphql-tag";

import { pageInfoFragment } from "./pageInfo";

export const categoryTranslationFragment = gql`
fragment CategoryTranslationFragment on CategoryTranslatableContent {
translation(languageCode: $language) {
Expand Down Expand Up @@ -161,6 +163,29 @@ export const pageTranslatableFragment = gql`
}
`;

export const attributeChoicesTranslationFragment = gql`
${pageInfoFragment}
fragment AttributeChoicesTranslationFragment on AttributeValueCountableConnection {
pageInfo {
...PageInfoFragment
}
edges {
cursor
node {
id
name
richText
inputType
translation(languageCode: $language) {
id
name
richText
}
}
}
}
`;

export const attributeTranslationFragment = gql`
fragment AttributeTranslationFragment on AttributeTranslatableContent {
translation(languageCode: $language) {
Expand All @@ -171,17 +196,29 @@ export const attributeTranslationFragment = gql`
id
name
inputType
# values {
# id
# name
# richText
# inputType
# translation(languageCode: $language) {
# id
# name
# richText
# }
# }
}
}
`;

export const attributeTranslationDetailsFragment = gql`
${attributeChoicesTranslationFragment}
fragment AttributeTranslationDetailsFragment on AttributeTranslatableContent {
translation(languageCode: $language) {
id
name
}
attribute {
id
name
inputType
choices(
first: $firstValues
after: $afterValues
last: $lastValues
before: $beforeValues
) {
...AttributeChoicesTranslationFragment
}
}
}
`;
46 changes: 46 additions & 0 deletions src/fragments/types/AttributeChoicesTranslationFragment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/* tslint:disable */
/* eslint-disable */
// @generated
// This file was automatically generated and should not be edited.

import { AttributeInputTypeEnum } from "./../../types/globalTypes";

// ====================================================
// GraphQL fragment: AttributeChoicesTranslationFragment
// ====================================================

export interface AttributeChoicesTranslationFragment_pageInfo {
__typename: "PageInfo";
endCursor: string | null;
hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: string | null;
}

export interface AttributeChoicesTranslationFragment_edges_node_translation {
__typename: "AttributeValueTranslation";
id: string;
name: string;
richText: any | null;
}

export interface AttributeChoicesTranslationFragment_edges_node {
__typename: "AttributeValue";
id: string;
name: string | null;
richText: any | null;
inputType: AttributeInputTypeEnum | null;
translation: AttributeChoicesTranslationFragment_edges_node_translation | null;
}

export interface AttributeChoicesTranslationFragment_edges {
__typename: "AttributeValueCountableEdge";
cursor: string;
node: AttributeChoicesTranslationFragment_edges_node;
}

export interface AttributeChoicesTranslationFragment {
__typename: "AttributeValueCountableConnection";
pageInfo: AttributeChoicesTranslationFragment_pageInfo;
edges: AttributeChoicesTranslationFragment_edges[];
}
66 changes: 66 additions & 0 deletions src/fragments/types/AttributeTranslationDetailsFragment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/* tslint:disable */
/* eslint-disable */
// @generated
// This file was automatically generated and should not be edited.

import { AttributeInputTypeEnum } from "./../../types/globalTypes";

// ====================================================
// GraphQL fragment: AttributeTranslationDetailsFragment
// ====================================================

export interface AttributeTranslationDetailsFragment_translation {
__typename: "AttributeTranslation";
id: string;
name: string;
}

export interface AttributeTranslationDetailsFragment_attribute_choices_pageInfo {
__typename: "PageInfo";
endCursor: string | null;
hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: string | null;
}

export interface AttributeTranslationDetailsFragment_attribute_choices_edges_node_translation {
__typename: "AttributeValueTranslation";
id: string;
name: string;
richText: any | null;
}

export interface AttributeTranslationDetailsFragment_attribute_choices_edges_node {
__typename: "AttributeValue";
id: string;
name: string | null;
richText: any | null;
inputType: AttributeInputTypeEnum | null;
translation: AttributeTranslationDetailsFragment_attribute_choices_edges_node_translation | null;
}

export interface AttributeTranslationDetailsFragment_attribute_choices_edges {
__typename: "AttributeValueCountableEdge";
cursor: string;
node: AttributeTranslationDetailsFragment_attribute_choices_edges_node;
}

export interface AttributeTranslationDetailsFragment_attribute_choices {
__typename: "AttributeValueCountableConnection";
pageInfo: AttributeTranslationDetailsFragment_attribute_choices_pageInfo;
edges: AttributeTranslationDetailsFragment_attribute_choices_edges[];
}

export interface AttributeTranslationDetailsFragment_attribute {
__typename: "Attribute";
id: string;
name: string | null;
inputType: AttributeInputTypeEnum | null;
choices: AttributeTranslationDetailsFragment_attribute_choices | null;
}

export interface AttributeTranslationDetailsFragment {
__typename: "AttributeTranslatableContent";
translation: AttributeTranslationDetailsFragment_translation | null;
attribute: AttributeTranslationDetailsFragment_attribute | null;
}
17 changes: 0 additions & 17 deletions src/fragments/types/AttributeTranslationFragment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,11 @@ export interface AttributeTranslationFragment_translation {
name: string;
}

export interface AttributeTranslationFragment_attribute_values_translation {
__typename: "AttributeValueTranslation";
id: string;
name: string;
richText: any | null;
}

export interface AttributeTranslationFragment_attribute_values {
__typename: "AttributeValue";
id: string;
name: string | null;
richText: any | null;
inputType: AttributeInputTypeEnum | null;
translation: AttributeTranslationFragment_attribute_values_translation | null;
}

export interface AttributeTranslationFragment_attribute {
__typename: "Attribute";
id: string;
name: string | null;
inputType: AttributeInputTypeEnum | null;
values: (AttributeTranslationFragment_attribute_values | null)[] | null;
}

export interface AttributeTranslationFragment {
Expand Down
2 changes: 1 addition & 1 deletion src/fragments/types/CategoryTranslationFragment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface CategoryTranslationFragment_translation {
id: string;
description: any | null;
language: CategoryTranslationFragment_translation_language;
name: string;
name: string | null;
seoDescription: string | null;
seoTitle: string | null;
}
Expand Down
2 changes: 1 addition & 1 deletion src/fragments/types/CollectionTranslationFragment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export interface CollectionTranslationFragment_translation {
id: string;
description: any | null;
language: CollectionTranslationFragment_translation_language;
name: string;
name: string | null;
seoDescription: string | null;
seoTitle: string | null;
}
Expand Down
2 changes: 1 addition & 1 deletion src/fragments/types/PageTranslatableFragment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export interface PageTranslatableFragment_translation {
content: any | null;
seoDescription: string | null;
seoTitle: string | null;
title: string;
title: string | null;
language: PageTranslatableFragment_translation_language;
}

Expand Down
2 changes: 1 addition & 1 deletion src/fragments/types/PageTranslationFragment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export interface PageTranslationFragment_translation {
content: any | null;
seoDescription: string | null;
seoTitle: string | null;
title: string;
title: string | null;
language: PageTranslationFragment_translation_language;
}

Expand Down
2 changes: 1 addition & 1 deletion src/fragments/types/ProductTranslationFragment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export interface ProductTranslationFragment_translation {
id: string;
description: any | null;
language: ProductTranslationFragment_translation_language;
name: string;
name: string | null;
seoDescription: string | null;
seoTitle: string | null;
}
Expand Down
Loading

0 comments on commit 88e5db0

Please sign in to comment.