Skip to content

fix(i18n): use 词元 instead of 令牌 for token in zh locale - #40977

Merged
Hona merged 5 commits into
anomalyco:devfrom
Speechlessmanbilibili:fix/zh-token-translation
Aug 7, 2026
Merged

fix(i18n): use 词元 instead of 令牌 for token in zh locale#40977
Hona merged 5 commits into
anomalyco:devfrom
Speechlessmanbilibili:fix/zh-token-translation

Conversation

@Speechlessmanbilibili

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #40976

Type of change

  • Bug fix

What does this PR do?

In the zh locale, the context usage panel translates "token" as 「令牌」, which is the API-credential term (访问令牌) and reads oddly in an LLM context — e.g. 「推理令牌」, 「缓存令牌」. This replaces the 7 occurrences in packages/app/src/i18n/zh.ts with 「词元」, the common scholarly translation for LLM tokens.

The zht locale and older zh versions keep the English "token" (总 token, 输入 token), and .opencode/glossary/zh-cn.md has no entry for token, so there is no established convention to contradict.

How did you verify your code works?

  • Only the 7 string values changed; no keys or logic touched
  • git diff confirms exactly those 7 lines
  • i18n keys still match en.ts (parity is key-based)

Screenshots / recordings

N/A — translation-only change

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@Hona

Hona commented Aug 7, 2026

Copy link
Copy Markdown
Member

Thanks! I'll take a look

@Hona
Hona merged commit b05a0d1 into anomalyco:dev Aug 7, 2026
2 checks passed
HQ123-BOOP pushed a commit to HQ123-BOOP/LibreCode that referenced this pull request Aug 9, 2026
@SlightDust

SlightDust commented Aug 10, 2026

Copy link
Copy Markdown

bad translation from china government

@Eronana

Eronana commented Aug 10, 2026

Copy link
Copy Markdown

This is a terrible, awful translation. It should never have been allowed into this codebase.

@Rin313

Rin313 commented Aug 10, 2026

Copy link
Copy Markdown

Please reject these pointless and garbage pull requests and focus on product development.
👉🌶🐷又在污染文明世界了

@zce

zce commented Aug 10, 2026

Copy link
Copy Markdown

词元 may be a valid academic translation, but that alone doesn't make it the right localization for a developer-facing tool. The relevant question should be what Chinese developers actually use and understand naturally. Today, keeping Token would likely be less surprising and avoids turning product localization into terminology advocacy.

@Speechlessmanbilibili

Copy link
Copy Markdown
Contributor Author

But 令牌 is not a correct translation; it is more likely to cause misunderstanding.

@zce

zce commented Aug 10, 2026

Copy link
Copy Markdown

I strongly prefer keeping Token here. It is already the established term among Chinese, and is far more widely recognized than “词元”.

It’s like NBA vs. 美职篮: a translation can be technically valid without being what people actually use. Localization should reflect established community usage, not try to redefine it.

@silicon14

Copy link
Copy Markdown

The ONLY correct translation is “词元”. This is the hard truth.
你们这帮政治露阴癖的傻逼有本事自己上井冈山,跑人家一个开源项目底下叫什么。

@SlightDust

Copy link
Copy Markdown

Who defines "CORRECT"? First there was the term "token" translated as "令牌", then the Chinese government came up with "词元". "令牌" was already an accepted translation, so why is "词元" supposedly the CORRECT one? Just because the Chinese government proposed it? If you ask me, that's over-politicizing things.

@silicon14

Copy link
Copy Markdown

Who defines "CORRECT"? First there was the term "token" translated as "令牌", then the Chinese government came up with "词元". "令牌" was already an accepted translation, so why is "词元" supposedly the CORRECT one? Just because the Chinese government proposed it? If you ask me, that's over-politicizing things.

Do you know what government means? Yes, government defines which is CORRECT.
Obeying what government decide is not over-politicizing.
Disobeying it just because it's the government's decision is over-politicizing.

@dmwin72015

Copy link
Copy Markdown

Please don't pollute the civilized world.

@hangyan

hangyan commented Aug 10, 2026

Copy link
Copy Markdown

looks good

@cfmj

cfmj commented Aug 10, 2026

Copy link
Copy Markdown

Who defines "CORRECT"? First there was the term "token" translated as "令牌", then the Chinese government came up with "词元". "令牌" was already an accepted translation, so why is "词元" supposedly the CORRECT one? Just because the Chinese government proposed it? If you ask me, that's over-politicizing things.

In the Chinese context, “令牌” means an authentication token, which is obviously inconsistent with the meaning of “token” in the LLM context. “词元” may not be a particularly good Chinese translation, but in any case, it is better than “令牌”.

@tqtij03440

Copy link
Copy Markdown

Please stop introducing this outdated and obsolete pictographic writing system into this open-source project. This is a political project driven by the Chinese government.

@hellodigua

Copy link
Copy Markdown

不知道在吵什么,我觉得原来令牌这个翻译确实不合理,在我心理最合理的翻译,就 token不动 > 词元 > 令牌,词元起码比令牌更合理一些

不讨论官方立场,中文翻译追求事物的本意,从这点上词元我感觉确实问题不大,起码暂时找不到比这个更合理的翻译了。

举个反例,要是按照日语的翻译逻辑,给token翻译成片假名 “托肯” “脱坑”之类的,看楼上的怎么评价 🤣

@rakshith1928

Copy link
Copy Markdown

Came from the X post

@Eronana

Eronana commented Aug 10, 2026

Copy link
Copy Markdown

But 令牌 is not a correct translation; it is more likely to cause misunderstanding.

I agree, but I prefer to directly use the word token.

To be frank, I don’t like the term 词元, because I’m pretty sure the term you actually use when communicating is token, not 词元. That’s why I gave it a thumbs down.

That said, 令牌 is clearly not the right translation either, and I think everyone here would agree on that. Your PR is definitely worthwhile, but what we ultimately settle on may still need to be discussed by the community.

@yiding-he

Copy link
Copy Markdown

Who defines "CORRECT"? First there was the term "token" translated as "令牌", then the Chinese government came up with "词元". "令牌" was already an accepted translation, so why is "词元" supposedly the CORRECT one? Just because the Chinese government proposed it? If you ask me, that's over-politicizing things.

  • token for authentication -> 令牌
  • token for LLM processing -> 词元

在界面上,二者的表达并不难区分,所以错误的翻译应该纠正。

@Ion-nsx

Ion-nsx commented Aug 10, 2026

Copy link
Copy Markdown

恶心人🤢

@pplab

pplab commented Aug 10, 2026

Copy link
Copy Markdown

Why not check what Wikipedia says?
https://zh.wikipedia.org/wiki/Token

@rtwangdev-lab

rtwangdev-lab commented Aug 10, 2026

Copy link
Copy Markdown

官方"词元"的翻译肯定好于“令牌”,一帮魑魅魍魉在此狂吠,真令人作呕!
下次你们被解雇(fire)了的时候就说自己火(fire)了吧...

@ShaoxiongXu

ShaoxiongXu commented Aug 10, 2026

Copy link
Copy Markdown

词元容易让人误解1个token是一个词,
字元容易让人误解1个token是一个字,
上下文 上下文 模型处理的最小文本单位。
不如叫文元。

@1208nn

1208nn commented Aug 10, 2026

Copy link
Copy Markdown

'词元量' may better than '词元数'. It sometimes a cost unit.

btw, this translation has not yet been officially ratified; it is only a recommended usage and remains provisional.

@OliverZou

Copy link
Copy Markdown

这个怎么可能,你这是语文...> 词元容易让人误解1个token是一个词,

字元容易让人误解1个token是一个字,
上下文 上下文 模型处理的最小文本单位。
不如叫文元。

@alexj11324

Copy link
Copy Markdown

Since "token" is already widely recognized and commonly used among Chinese developers, I don’t think there is much benefit in translating it as "词元." Keeping "token" untranslated would be clearer and more consistent with how the developer community actually uses the term.

As others have mentioned above, "词元" is a relatively formal translation that has been promoted largely through Chinese government-affiliated press and does not necessarily reflect the terminology preferred by the majority of Chinese developers.

More broadly, there are many English technical terms whose official Chinese translations have never become common in everyday usage. For example, "无线局域网" may be used as a formal translation in contexts related to Wi-Fi, while most people simply say "Wi-Fi." Similarly, "App" remains extremely common in Chinese despite the existence of translations such as "应用" or "应用程序."

For this reason, I think it would be better for the OpenCode maintenance team to keep "token" untranslated in the Chinese localization. This would better match actual developer usage and make the terminology feel more natural to Chinese users.

@mstscmsn

Copy link
Copy Markdown

傻逼

@jhqn2023

Copy link
Copy Markdown

is:pr is:open 蠢人翻译插入 "词元"这种私货,

@davyzhu

davyzhu commented Aug 11, 2026

Copy link
Copy Markdown

Technical issues should not be politicized; support opencode in translating token as 词元.

技术问题不应该政治化,支持opencode把token翻译成词元。

@Fission21

Copy link
Copy Markdown

https://www.peopleapp.com/column/30052861725-500007638386
image
这是官方的解释,所有想把token改成词元的,官方背书是这样背书的, 在github这就不是一个单纯的技术翻译问题讨论,一部分人想把中国国内特供的思想污染到整个社区,即便是这个社区被GFW屏蔽了,WIFI,APP, 此类缩写简单好记,你可以曾见过强推中文译名? token 就是token 不需要中译中

@gitkeniwo

gitkeniwo commented Aug 11, 2026

Copy link
Copy Markdown

词元 the word itself is objectively bad and fundamentally incorrect as tokens could be larger than words(词) or span over word boundaries. Tokenizers do not operate on 词 but rather on byte streams. There is nothing 元 about tokens at all with respect to splitting up words.

@cfmj

cfmj commented Aug 11, 2026

Copy link
Copy Markdown

提反对意见的一律打上反中标签,还是这个熟悉的味道

565ed83e-1eaf-498a-8ed9-2bad50dd78f7 你又在装什么呢

@demo-zexuan

Copy link
Copy Markdown

一帮人政治漏阴癖真的是服了😅😅😅

https://zh.wikipedia.org/wiki/Token

@Ion-nsx
This comment was marked as a violation of GitHub Acceptable Use Policies
@xq546247083

Copy link
Copy Markdown

提反对意见的一律打上反中标签,还是这个熟悉的味道

565ed83e-1eaf-498a-8ed9-2bad50dd78f7 你又在装什么呢

傻逼🖕🖕🖕🖕

你这种人好恶心啊。说就说,骂人干嘛?素质极其低。

@demo-zexuan

Copy link
Copy Markdown

@Hona Hi~ If possible, please close the comment section of this issue as soon as possible. Some irrational people have begun to personally attack under the comment.

At present, the following discussion is completely full of political and personal attacks, which is no longer relevant to the opencode project.

@Ion-nsx
This comment was marked as a violation of GitHub Acceptable Use Policies
@demo-zexuan

Copy link
Copy Markdown

提反对意见的一律打上反中标签,还是这个熟悉的味道

565ed83e-1eaf-498a-8ed9-2bad50dd78f7 你又在装什么呢

傻逼🖕🖕🖕🖕

你这种人好恶心啊。说就说,骂人干嘛?素质极其低。

骂的就是你🖕🖕

@Hona At present, the comment area has been introduced into meaningless personal attacks by such people, which is not good news for the opencode community. It‘s ridiculous.

@xq546247083

Copy link
Copy Markdown

提反对意见的一律打上反中标签,还是这个熟悉的味道

565ed83e-1eaf-498a-8ed9-2bad50dd78f7 你又在装什么呢

傻逼🖕🖕🖕🖕

你这种人好恶心啊。说就说,骂人干嘛?素质极其低。

骂的就是你🖕🖕

对对对,继续骂。我好难受。

@Ion-nsx
This comment was marked as a violation of GitHub Acceptable Use Policies
@xq546247083

Copy link
Copy Markdown

提反对意见的一律打上反中标签,还是这个熟悉的味道

565ed83e-1eaf-498a-8ed9-2bad50dd78f7 你又在装什么呢

傻逼🖕🖕🖕🖕

你这种人好恶心啊。说就说,骂人干嘛?素质极其低。

骂的就是你🖕🖕

对对对,继续骂。我好难受。

傻逼🖕

哈哈

@Fido6

Fido6 commented Aug 11, 2026

Copy link
Copy Markdown

1.此处传入的内容并非api key,故原始的 "令牌" 翻译为错误翻译,“词元”为正确翻译。
2.因为国内的这个"词元"官方翻译,我已经见到国内很多媒体将api token翻译为"词元"了,所以我感觉此处的“token”不用翻译

=================

  1. The content passed here is not an API key; therefore, the original translation of "token" as "令牌" (lingpai) is incorrect, whereas "词元" (ciyuan) is the correct translation.
  2. Given that "词元" is the official domestic translation—and I have already seen many domestic media outlets translating "API token" as "词元"—I feel that the word "token" here does not need to be translated.

@yeliex

yeliex commented Aug 11, 2026

Copy link
Copy Markdown

Actually just keeping Token better than 令牌 or 词元. The 令牌 was a wrong translation in the wrong scene, but 词元 even not a currect Chinese spelling. It looks ugly to use 词元 as the translation for token, the word created by goverment media workers who knows nothing with LLM or Agents, just for political intentions.

@yeliex

yeliex commented Aug 11, 2026

Copy link
Copy Markdown

Before 词元, nobody in China called 令牌 for Token, we just called it Token. Give everything a Chinese translation, even not works well in daily life looks wired.

@Mar7thLover

Copy link
Copy Markdown

OpenCode should not use such a terrible translation.

By the way, this is a politically charged translation that should absolutely not be accepted by the open-source community.

@hackroid

hackroid commented Aug 11, 2026

Copy link
Copy Markdown

看完这条thread这下不得不支持词元了,想看这堆📍CN的起号小鬼和词元组一辈子代码😋赞成割裂,加速不要停🫡反正就是个翻译,爱用en用en爱用zh用zh,何苦互相为难呢

@Zhou-Shilin

Copy link
Copy Markdown

@Hona I would recommend locking this conversation at this point to prevent further unnecessary debate.

Regarding the terminology, I strongly suggest keeping the original English word Token rather than translating it to 词元. The general consensus among Chinese developers and tech professionals is that 词元 is an awkward and suboptimal translation. In the Chinese tech community—both in day-to-day discussions and in formal technical documentation—it is standard practice to retain well-established English terms like Token as they are. Keeping it in English will feel much more natural and accurate to native readers.

@mamawai

mamawai commented Aug 11, 2026

Copy link
Copy Markdown

很难理解么,我觉得译成词元没问题,跟政府有什么关系?
image

@anomalyco anomalyco locked as too heated and limited conversation to collaborators Aug 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

i18n(zh): token translated as 令牌 reads oddly in LLM context