[BRAINSTORM] Translation of Terminology & Nomenclature
LingDong- opened this issue · 15 comments
This issue is dedicated to the discussion of translation of programming concepts into 文言. Please contribute by posting your translation in a comment, and the collaborators will add them to the table below. Please indicate in your comment the concept you're trying to translate, the wenyan translation (preferably in traditional Chinese), as well as a brief explanation of why you think it is a good translation. If the phrase comes from a classic, please also indicate.
The table currently only contains suggestions from #494 and #349 . Feel free to propose more rows!
Thank you very much for your contribution!
Data structures
Concept | Wenyan |
---|---|
matrix | 陣 |
linked-list | 連環 |
String manipulation
Concept | Wenyan |
---|---|
fromCharCode | |
fromCodePoint | |
charAt | |
charCodeAt | |
codePointAt | |
concat | |
endsWith | |
fixed | |
includes | |
indexOf | |
match | |
matchAll | |
padEnd | |
padStart | |
repeat | |
replace | |
search | |
slice | |
split | |
startsWith | |
substring | |
toLowerCase | |
toString | |
toUpperCase | |
trim | |
trimEnd | |
trimStart |
Some ideas owo
- startsWith -> 始於「」
- replace -> 以「」代「」
- toUpperCase -> 遷
- toLowerCase -> 謫
- search, indexOf, find => 「」中尋「」。何處。
- slice => 割「」以「」。
简体中文来答一波。
个人觉得 "linked-list" 用“连环”表示不太好。“连环”或许用于环形链表更合适,不过对于数据结构,教科书上的翻译也基本能接受了。就可以叫“链表”,在古文中只用单字“链”也够了。
data struct | 中文 |
---|---|
linked list | 链 |
double linked | 双链 |
circle linked | 环链 |
stack | 栈 |
heap | 堆 |
tree | 树 |
graph | 图 |
hash | 栖 |
map | ? |
"hash" 有点音译,但我也是有联想到“凤凰来栖”“凤凰栖于梧”的意象,一个数据(飞)来了,总是能分配(栖落)到合适的地方,此所谓“良禽择木而栖”也。
"map" 暂时没想到合适的翻译。“映射”的“射”或许可达意,但它是个动词。
不过从另一观点,hash/map/dict 在许多脚本语言中是近义词,只有老牌语言如 C++/java 区分无序的 hash 与有序的 map 。所以只翻译其一也勉强可行。
Concept | Wenyan |
---|---|
fromCharCode | 暗語 |
charAt | 摘字 |
substring | 摘句 |
split | 以...分... |
startsWith | 始於 |
endsWith | 止於 |
toUpperCase | 大篆 |
toLowerCase | 小楷 |
toUpperCase 大写
toLowerCase 小写
toUpperCase 繁体
toLowerCase 简体
施于英文时换大小写,施于中文时换简繁体
@lymslive 鉴于我proposed了连环,想解释一下连环是指一环套一环而连成串的结构,这里的环就是一个node,并不是说一定要有cycle才叫连环。
hash -> “号”
既有别号,别字之意,又兼号码之用。且与英文发音有类似之处。
hash我感觉可以用"志",用这个字"标记"的意思
hash/map 或者也可用“表”字。
已经有“列”字用于数组,“列表”并举,基本能囊括大部分脚本语言的重要数据结构,即 list 与 hash
而 lua 其实就一种数据结构 table ,它的“表”也包括“列”。
不过 wenyan 已有“物”表示 object ,其底层应是与 hash/map 类似或相关的概念。
如果一时没有很恰当的古词,不妨先用现代词,以免生硬而造成理解困难。
我认为并非所有现代编程需要的概念都能找到很恰当的古语对应。
search: 搜,探,查
padStart: 头垫
padEnd: 尾垫
replace: 变,替
Prefer 頭尾 for "start" and "end"; 削 for "trim", or "cut off".
《焦氏易林・離之》
井:頭尾顛倒,不知緒處,君失其國。
English | 文言 |
---|---|
trim | 削 |
trimStart | 削頭 or 頭削 |
trimEnd | 削尾 or 尾削 |
《禮記・曲禮上》
居喪之禮,頭有創則沐,身有瘍則浴...
Note: 頭 above is physical "head", not figurative "start".
始於 suggested above for "begins with" is also good, but IMO is more like "begins at". Prefer 終於 over 止於:
《孝經・開宗明義》
夫孝,始於事親,中於事君,終於立身。
English | 文言 |
---|---|
startsWith | 頭有 or 始於 |
endsWith | 尾有 or 終於 |
English | 文言 |
---|---|
slice | 割 |
split | 分 or 拆 |
search | 覓 (save 索 for cord-related stuff) |
replace | 替 |
includes | 含 |
match | 配 |
matchAll | 皆配 |
For toString
:
I wrote a package called 交互秘術
(available in wyg
now) . In order to transfer the input (as a Buffer
object) to string
, I used 化言
for toString
. It may be a good choice.
cf #619