-
Notifications
You must be signed in to change notification settings - Fork 52
DEVDOCS-6444 - Product Filter translations #1166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
bc-terra
wants to merge
16
commits into
main
Choose a base branch
from
DEVDOCS-6444
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
064e903
Created new doc for product filter translations
bc-terra b8af908
Update docs/store-operations/translations/filters.mdx
bc-terra ce94bb5
Update docs/store-operations/translations/filters.mdx
bc-terra 2521bde
Update docs/store-operations/translations/filters.mdx
bc-terra f74ce6a
Update docs/store-operations/translations/filters.mdx
bc-terra 6c14d37
Update docs/store-operations/translations/filters.mdx
bc-terra f79dc42
Update docs/store-operations/translations/filters.mdx
bc-terra c1f4409
Update docs/store-operations/translations/filters.mdx
bc-terra 5cf8f7f
Update docs/store-operations/translations/filters.mdx
bc-terra 26246cc
Update docs/store-operations/translations/filters.mdx
bc-terra 2153236
Update docs/store-operations/translations/filters.mdx
bc-terra e136f9e
Update docs/store-operations/translations/filters.mdx
bc-terra 91bb276
Update docs/store-operations/translations/filters.mdx
bc-terra f6783ed
Update docs/store-operations/translations/filters.mdx
bc-terra ba9d12a
Apply suggestions from code review
bc-terra 9528512
Merge branch 'main' into DEVDOCS-6444
bc-terra File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,280 @@ | ||
| --- | ||
| title: Product Filter Translations | ||
| keywords: translations, product filters, localization, l18n, graphql, filters | ||
| description: Translate product filter display names and labels for multilingual storefronts using the Translations Admin GraphQL API. | ||
bc-terra marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| --- | ||
|
|
||
| # Translations for Product Filters (Beta) | ||
|
|
||
| <Callout type='info'> | ||
| The Translations Admin GraphQL API is currently available on Catalyst storefronts only. | ||
| </Callout> | ||
|
|
||
bc-terra marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| The product filter translatable fields are: | ||
|
|
||
| | Filter Type | Translatable Fields | | ||
| |-------------|-------------------| | ||
| | Category, Brand, Variants, Custom Fields, Price, Rating | Display Name as `display_name` | | ||
bc-terra marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| | Other Filters | Display Name as `display_name` <br /> Has Free Shipping as `has_free_shipping` <br /> Is Featured as `is_featured` <br /> In Stock as `in_stock` | | ||
bc-terra marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| <Callout type='info'> | ||
bc-terra marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Only string values are translatable. Numeric content such as product count or price values are not translatable. | ||
| </Callout> | ||
|
|
||
| ## Query translations | ||
|
|
||
| This query returns a paginated list of translations by `resourceType`, `channelId`, and `localeId` with a maximum of 50 results per request. | ||
|
|
||
| Translated fields are returned whenever available, and the default locale values are returned otherwise on a field-by-field basis. | ||
|
|
||
| <Tabs items={['Request', 'Response']}> | ||
| <Tab> | ||
| ```graphql filename="Example query: Query a list of translations" showLineNumbers copy | ||
| GRAPHQL https://api.bigcommerce.com/stores/{{store_hash}}/graphql | ||
| X-Auth-Token: {{token}} | ||
|
|
||
| query { | ||
| store { | ||
| translations(filters: { | ||
| resourceType: PRODUCT_FILTERS, | ||
| channelId: "bc/store/channel/1", | ||
bc-terra marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| localeId: "bc/store/locale/fr" | ||
| } first: 50) { | ||
| edges { | ||
| node { | ||
| resourceId | ||
| fields { | ||
| fieldName | ||
| original | ||
| translation | ||
| } | ||
| } | ||
| cursor | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
| </Tab> | ||
| <Tab> | ||
|
|
||
| ```json filename="Example query: Query a list of translations" showLineNumbers copy | ||
| { | ||
| "data": { | ||
| "store": { | ||
| "translations": { | ||
| "edges": [ | ||
| { | ||
| "node": { | ||
| "resourceId": "bc/store/product-filter/23", | ||
bc-terra marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| "fields": [ | ||
| { | ||
| "fieldName": "display_name", | ||
| "original": "Price", | ||
| "translation": "Prix" | ||
| }, | ||
| { | ||
| "fieldName": "has_free_shipping", | ||
| "original": "Free Shipping", | ||
| "translation": "Livraison gratuite" | ||
| } | ||
| ] | ||
| }, | ||
| "cursor": "eyJpZCI6MjN9" | ||
| } | ||
bc-terra marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ] | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
| </Tab> | ||
| </Tabs> | ||
|
|
||
| ### Query a translation by `resourceId` | ||
|
|
||
| <Callout type='warning'> | ||
| When querying a translation by `resourceId`, you must provide the full `resourceId` in the format `bc/store/product-filter/{filter_id}`. | ||
| </Callout> | ||
|
|
||
| This query returns a translation by `resourceId`. | ||
bc-terra marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| <Tabs items={['Request', 'Response']}> | ||
| <Tab> | ||
| ```graphql filename="Example query: Query a translation by resource id" showLineNumbers copy | ||
| GRAPHQL https://api.bigcommerce.com/stores/{{store_hash}}/graphql | ||
| X-Auth-Token: {{token}} | ||
|
|
||
| query { | ||
| store { | ||
| translations(filters: { | ||
| resourceType: PRODUCT_FILTERS, | ||
| channelId: "bc/store/channel/2", | ||
bc-terra marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| localeId: "bc/store/locale/it", | ||
| resourceIds: ["bc/store/product-filter/42"] | ||
bc-terra marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| }) { | ||
| edges { | ||
| node { | ||
| resourceId | ||
| fields { | ||
| fieldName | ||
| original | ||
| translation | ||
| } | ||
| } | ||
| cursor | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
| </Tab> | ||
| <Tab> | ||
|
|
||
| ```json filename="Example query: Query a translation by resource id" showLineNumbers copy | ||
| { | ||
| "data": { | ||
| "store": { | ||
| "translations": { | ||
| "edges": [ | ||
| { | ||
| "node": { | ||
| "resourceId": "bc/store/product-filter/42", | ||
| "fields": [ | ||
| { | ||
| "fieldName": "display_name", | ||
| "original": "Rating", | ||
| "translation": "Évaluation" | ||
bc-terra marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| ] | ||
| }, | ||
| "cursor": "eyJpZCI6NDJ9" | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
| </Tab> | ||
| </Tabs> | ||
|
|
||
| ## Update a translation | ||
|
|
||
| This mutation updates a translation. | ||
|
|
||
| <Tabs items={['Request', 'Response']}> | ||
| <Tab> | ||
| ```graphql filename="Example mutation: Update a translation" showLineNumbers copy | ||
| GRAPHQL https://api.bigcommerce.com/stores/{{store_hash}}/graphql | ||
| X-Auth-Token: {{token}} | ||
|
|
||
| mutation { | ||
| translation { | ||
| updateTranslations(input: { | ||
| resourceType: PRODUCT_FILTERS, | ||
| channelId: "bc/store/channel/1", | ||
| localeId: "bc/store/locale/es", | ||
| entities: [ | ||
| { | ||
| resourceId: "bc/store/product-filter/23", | ||
| fields: [ | ||
| { fieldName: "display_name", value: "Precio" }, | ||
| { fieldName: "is_featured", value: "Destacado" } | ||
| ] | ||
| } | ||
| ] | ||
| }) { | ||
| __typename | ||
| errors { | ||
| __typename | ||
| ... on Error { | ||
| message | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
bc-terra marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ``` | ||
| </Tab> | ||
| <Tab> | ||
|
|
||
| ```json filename="Example mutation: Update a translation" showLineNumbers copy | ||
| { | ||
| "data": { | ||
| "translation": { | ||
| "updateTranslations": { | ||
| "__typename": "UpdateTranslationsResult", | ||
| "errors": [] | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
| </Tab> | ||
| </Tabs> | ||
|
|
||
| ## Delete a translation | ||
|
|
||
| The following mutation deletes a translation. | ||
|
|
||
| <Tabs items={['Request', 'Response']}> | ||
| <Tab> | ||
| ```graphql filename="Example mutation: Delete a translation" showLineNumbers copy | ||
| GRAPHQL https://api.bigcommerce.com/stores/{{store_hash}}/graphql | ||
| X-Auth-Token: {{token}} | ||
|
|
||
| mutation { | ||
| translation { | ||
| deleteTranslations(input: { | ||
| resourceType: PRODUCT_FILTERS, | ||
| channelId: "bc/store/channel/1", | ||
| localeId: "bc/store/locale/es", | ||
| resources: [ | ||
| { | ||
| resourceId: "bc/store/product-filter/23", | ||
| fields: ["display_name", "is_featured"] | ||
| } | ||
| ] | ||
| }) { | ||
| __typename | ||
| errors { | ||
| __typename | ||
| ... on Error { | ||
| message | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
bc-terra marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ``` | ||
| </Tab> | ||
| <Tab> | ||
|
|
||
| ```json filename="Example mutation: Delete a translation" showLineNumbers copy | ||
| { | ||
| "data": { | ||
| "translation": { | ||
| "deleteTranslations": { | ||
| "__typename": "DeleteTranslationsResult", | ||
| "errors": [] | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
| </Tab> | ||
| </Tabs> | ||
|
|
||
| ## Limitations | ||
|
|
||
| - Product count and other numeric-only fields do not support localization. | ||
| - Only displayable string content for filter names and values is translatable. | ||
| - Currently available on Catalyst storefronts only. | ||
|
|
||
| ## Best Practices | ||
|
|
||
| - Use the GraphQL Admin API to manage translations in bulk. | ||
| - Check for existing translations before creating new ones to minimize overwrites. | ||
| - Always use full `resourceId` values as required by the API. | ||
| - Storefront GraphQL API automatically uses the shopper’s locale for product filter display names. | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.