我想从Shopify商店买到第二种语言的产品。
Storefront API声明HTTP请求标头必须包含Accept-Language: de,在我的示例中(在React中),设置应如下所示:https://shopify.dev/tutorials/manage-app-translations-with-admin-api#storefront-api-translation-header
const clientWithTranslatedContent = Client.buildClient({
domain: 'your-shop-name.myshopify.com',
storefrontAccessToken: 'your-storefront-access-token',
language: 'de' // Accept-Language
});你可以在这里找到它的工作原理:https://github.com/Shopify/js-buy-sdk/blob/update-language-setting/src/client.js
我使用的是Shopify Webhook API版本2020-07 (最新版本)。在这里gatsbyjs/gatsby#24173 (注释)我找到了2020-04版本的Accept-Language头文件支持翻译的信息,但它在我的例子中不起作用。
在构建应用程序时,我总是收到带有默认翻译(EN)的商品。
发布于 2020-10-02 21:23:34
这个问题是由在gatsby-node.js中生成页面的"gatsby-source-shopify“插件引起的。它不考虑HTTP请求报头中的接受语言。为了解决这个问题,我的团队已经完成了这个插件。
这里有一个链接:https://github.com/alex-borodin-vtlabs/gatsby-source-shopify-translated
https://stackoverflow.com/questions/64062359
复制相似问题