reactjs / reactjs/react.dev

Translation feature in concurrent mode's example CodeSandbox might not work.

未关闭
#3,473 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
JavaScript
星标
11.8k
派生
7.9k
平均合并
1 天 11 小时
30 天内合并 PR
11

描述

https://reactjs.org/docs/concurrent-mode-patterns.html#splitting-high-and-low-priority-state
In above section's example CodeSandbox, yandex-translate is used for translation feature.

But, translation doesn't work when I open the CodeSandbox.
↓ The translation result should appear under the input.
スクリーンショット 2021-01-02 1 55 41

And I got a following message from the response of translate().

// fakeApi.js
export function fetchTranslation(text) {
  const promise = new Promise(
    (resolve, reject) => {
      translate(
        text,
        {
          to: "fr"
        },
        (err, res) => {
          if (err) {
            reject(err);
          } else {
            console.log(res) // <- Added this line
            resolve(res.text);
          }
        }
      );
    }
  );
  return wrapPromise(promise);
}
code: 404
message: "Maximum daily translated text volume exceeded"

This is not an example code's bug, but it can be confusing for beginners. (Actually, I suspected a bug in the React part of the code at first.)
Can we avoid this problem? For example, use other translation feature, use another plan(?) of yandex-translate.

Thanks.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

打开 concurrent mode patterns 文档及其链接的 CodeSandbox,然后检查示例中 fakeApi.js 的翻译路径。确认 yandex-translate 请求返回所报告 quota 错误的原因,并确定一种受支持的方式来保持示例可用。当翻译结果出现在输入内容下方,且不依赖不可用的翻译 quota 时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript, react
领域
documentation
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
30/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。