wenyan icon indicating copy to clipboard operation
wenyan copied to clipboard

[BRAINSTORM] Translation of Terminology & Nomenclature

Open LingDong- opened this issue 4 years ago • 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

LingDong- avatar Jan 08 '20 04:01 LingDong-

Some ideas owo

  1. startsWith -> 始於「」
  2. replace -> 以「」代「」
  3. toUpperCase -> 遷
  4. toLowerCase -> 謫

Meowcolm024 avatar Jan 08 '20 05:01 Meowcolm024

  1. search, indexOf, find => 「」中尋「」。何處。
  2. slice => 割「」以「」。

S-Asakoto avatar Jan 08 '20 10:01 S-Asakoto

简体中文来答一波。

个人觉得 "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 。所以只翻译其一也勉强可行。

lymslive avatar Jan 08 '20 12:01 lymslive

Concept Wenyan
fromCharCode  暗語
charAt  摘字
substring  摘句
split 以...分...
startsWith 始於
endsWith 止於
toUpperCase 大篆
toLowerCase  小楷

cuixiping avatar Jan 08 '20 15:01 cuixiping

toUpperCase 大写 toLowerCase 小写

kaiyuan01 avatar Jan 09 '20 00:01 kaiyuan01

toUpperCase 繁体 toLowerCase 简体 施于英文时换大小写,施于中文时换简繁体

lymslive avatar Jan 09 '20 00:01 lymslive

@lymslive 鉴于我proposed了连环,想解释一下连环是指一环套一环而连成串的结构,这里的环就是一个node,并不是说一定要有cycle才叫连环。

MerakDipper avatar Jan 09 '20 01:01 MerakDipper

hash -> “号” 既有别号,别字之意,又兼号码之用。且与英文发音有类似之处。

MerakDipper avatar Jan 09 '20 01:01 MerakDipper

hash我感觉可以用"志",用这个字"标记"的意思

Fros1er avatar Jan 09 '20 09:01 Fros1er

hash/map 或者也可用“表”字。 已经有“列”字用于数组,“列表”并举,基本能囊括大部分脚本语言的重要数据结构,即 list 与 hash 而 lua 其实就一种数据结构 table ,它的“表”也包括“列”。

不过 wenyan 已有“物”表示 object ,其底层应是与 hash/map 类似或相关的概念。

lymslive avatar Jan 10 '20 09:01 lymslive

如果一时没有很恰当的古词,不妨先用现代词,以免生硬而造成理解困难。 我认为并非所有现代编程需要的概念都能找到很恰当的古语对应。

cuixiping avatar Jan 10 '20 10:01 cuixiping

search: 搜,探,查 padStart: 头垫 padEnd: 尾垫 replace: 变,替

hanyuone avatar Jan 31 '20 01:01 hanyuone

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 皆配

yawnoc avatar Feb 03 '20 14:02 yawnoc

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.

GLanguage avatar Feb 18 '20 13:02 GLanguage

cf #619

UltimatePea avatar Jul 13 '20 22:07 UltimatePea