inclusive-language
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseInclusive Language
包容性语言
Overview
概述
Use respectful, accessible language in all code and documentation.
Core principle: Words matter. Use inclusive terminology.
This applies to: Code, comments, documentation, commit messages, branch names, and all text.
在所有代码和文档中使用尊重、易访问的语言。
核心原则: 语言至关重要。请使用包容性术语。
适用范围: 代码、注释、文档、提交信息、分支名称及所有文本内容。
Terminology Guide
术语指南
Branch Names
分支名称
| Instead of | Use |
|---|---|
| master | main |
| slave | replica, secondary, follower |
bash
undefined| 替代 | 推荐使用 |
|---|---|
| master | main |
| slave | replica、secondary、follower |
bash
undefinedCorrect
正确示例
git checkout main
git push origin main
git checkout main
git push origin main
Repository default branch should be 'main'
仓库默认分支应设为'main'
undefinedundefinedAccess Control
访问控制
| Instead of | Use |
|---|---|
| whitelist | allowlist, permitlist |
| blacklist | denylist, blocklist |
typescript
// Correct
const allowlist = ['admin@example.com', 'user@example.com'];
const denylist = ['spam@example.com'];
function isAllowed(email: string): boolean {
return allowlist.includes(email) && !denylist.includes(email);
}| 替代 | 推荐使用 |
|---|---|
| whitelist | allowlist、permitlist |
| blacklist | denylist、blocklist |
typescript
// 正确示例
const allowlist = ['admin@example.com', 'user@example.com'];
const denylist = ['spam@example.com'];
function isAllowed(email: string): boolean {
return allowlist.includes(email) && !denylist.includes(email);
}Primary/Secondary
主/从替代术语
| Instead of | Use |
|---|---|
| master/slave | primary/replica, primary/secondary, leader/follower |
| master (device) | primary, controller, host |
| slave (device) | secondary, peripheral, client |
typescript
// Correct
interface DatabaseConfig {
primary: ConnectionString;
replicas: ConnectionString[];
}
class ReplicationManager {
private leader: Node;
private followers: Node[];
}| 替代 | 推荐使用 |
|---|---|
| master/slave | primary/replica、primary/secondary、leader/follower |
| master(设备) | primary、controller、host |
| slave(设备) | secondary、peripheral、client |
typescript
// 正确示例
interface DatabaseConfig {
primary: ConnectionString;
replicas: ConnectionString[];
}
class ReplicationManager {
private leader: Node;
private followers: Node[];
}Gendered Terms
性别相关术语
| Instead of | Use |
|---|---|
| man hours | person hours, work hours |
| manpower | workforce, staffing |
| mankind | humanity, people |
| guys | everyone, folks, team |
| he/she (generic) | they |
typescript
// Correct
/**
* When a user logs in, they receive a session token.
* The user can then use their token to access resources.
*/| 替代 | 推荐使用 |
|---|---|
| man hours | person hours、work hours |
| manpower | workforce、staffing |
| mankind | humanity、people |
| guys | everyone、folks、team |
| he/she(泛指) | they |
typescript
// 正确示例
/**
* 当用户登录后,他们会收到一个会话令牌。
* 随后用户可使用该令牌访问资源。
*/Ability-Related
能力相关术语
| Instead of | Use |
|---|---|
| sanity check | validity check, confidence check |
| crazy/insane | unexpected, surprising |
| blind (as negative) | unaware, unnoticed |
| cripple | disable, limit |
| dumb | silent, without output |
typescript
// Correct
function validateInput(data: unknown): boolean {
// Perform validity check on input data
}
// Instead of "sanity check"
function confidenceCheck(result: Result): boolean {
// Verify result is within expected bounds
}| 替代 | 推荐使用 |
|---|---|
| sanity check | validity check、confidence check |
| crazy/insane | unexpected、surprising |
| blind(含负面含义) | unaware、unnoticed |
| cripple | disable、limit |
| dumb | silent、without output |
typescript
// 正确示例
function validateInput(data: unknown): boolean {
// 对输入数据执行有效性检查
}
// 替代"sanity check"
function confidenceCheck(result: Result): boolean {
// 验证结果是否在预期范围内
}Violence-Related
暴力相关术语
| Instead of | Use |
|---|---|
| kill | stop, terminate, end |
| abort | cancel, stop |
| hit | access, call, reach |
| execute | run, perform |
| nuke | delete, remove, clear |
typescript
// Correct
function terminateProcess(pid: number): void { }
function stopServer(): void { }
function cancelRequest(id: string): void { }
// Acceptable (industry standard)
function executeQuery(sql: string): Result { }| 替代 | 推荐使用 |
|---|---|
| kill | stop、terminate、end |
| abort | cancel、stop |
| hit | access、call、reach |
| execute | run、perform |
| nuke | delete、remove、clear |
typescript
// 正确示例
function terminateProcess(pid: number): void { }
function stopServer(): void { }
function cancelRequest(id: string): void { }
// 可接受(行业标准)
function executeQuery(sql: string): Result { }Other Terms
其他术语
| Instead of | Use |
|---|---|
| dummy | placeholder, sample |
| native | built-in, core |
| first-class | built-in, fully-supported |
| grandfather/legacy | established, existing |
| grandfathered in | exempted, pre-existing |
| 替代 | 推荐使用 |
|---|---|
| dummy | placeholder、sample |
| native | built-in、core |
| first-class | built-in、fully-supported |
| grandfather/legacy | established、existing |
| grandfathered in | exempted、pre-existing |
Examples in Context
上下文示例
Configuration
配置
typescript
// Correct
interface FeatureFlags {
allowlist: string[];
denylist: string[];
}
const replicationConfig = {
primary: 'db-primary.example.com',
replicas: [
'db-replica-1.example.com',
'db-replica-2.example.com',
],
};typescript
// 正确示例
interface FeatureFlags {
allowlist: string[];
denylist: string[];
}
const replicationConfig = {
primary: 'db-primary.example.com',
replicas: [
'db-replica-1.example.com',
'db-replica-2.example.com',
],
};Documentation
文档
markdown
<!-- Correct -->markdown
<!-- 正确示例 -->Getting Started
快速开始
When a user creates an account, they will receive a confirmation email.
They can then set up their profile using their preferred settings.
当用户创建账户后,他们会收到一封确认邮件。
随后可使用偏好设置配置个人资料。
Access Control
访问控制
Use the allowlist to specify approved domains.
Use the denylist to block specific addresses.
undefined使用allowlist指定已批准的域名。
使用denylist阻止特定地址。
undefinedComments
注释
typescript
// Correct
// Validity check: ensure the input meets expected format
if (!isValidFormat(input)) {
throw new ValidationError('Input format is invalid');
}
// Confidence check: verify result is within expected bounds
if (result > MAX_EXPECTED || result < MIN_EXPECTED) {
logger.warn('Result outside expected range');
}typescript
// 正确示例
// 有效性检查:确保输入符合预期格式
if (!isValidFormat(input)) {
throw new ValidationError('输入格式无效');
}
// 可信度检查:验证结果是否在预期范围内
if (result > MAX_EXPECTED || result < MIN_EXPECTED) {
logger.warn('结果超出预期范围');
}Error Messages
错误信息
typescript
// Correct
throw new Error('Email address is on the denylist');
throw new Error('Origin not in allowlist');
throw new Error('Request terminated due to timeout');typescript
// 正确示例
throw new Error('该邮箱地址在denylist中');
throw new Error('来源不在allowlist中');
throw new Error('请求因超时终止');Applying to Existing Code
应用到现有代码
When modifying existing code with non-inclusive terms:
当修改包含非包容性术语的现有代码时:
Small Scope (Same File)
小范围(单个文件)
If you're modifying a function that uses non-inclusive language:
- Rename the term as part of your change
- Update related documentation
- Note in commit message: "Renamed to inclusive terminology"
如果你正在修改使用非包容性语言的函数:
- 在本次修改中重命名该术语
- 更新相关文档
- 在提交信息中注明:"Renamed to inclusive terminology"(已重命名为包容性术语)
Large Scope (Multiple Files)
大范围(多个文件)
If renaming would touch many files:
- Create a separate issue for the terminology update
- Complete current work with existing terms
- Schedule terminology update as future work
如果重命名会涉及多个文件:
- 为术语更新创建单独的议题
- 先使用现有术语完成当前工作
- 将术语更新安排为后续工作
API/Public Interface
API/公共接口
If the term is in a public API:
- Document the plan for deprecation
- Add deprecated alias with new term
- Migrate users over time
- Remove deprecated term in major version
typescript
// Transition approach
/** @deprecated Use allowlist instead */
export const whitelist = allowlist;
export const allowlist: string[] = [];如果术语存在于公共API中:
- 记录弃用计划
- 添加新术语的同时保留已弃用的别名
- 逐步引导用户迁移
- 在大版本更新中移除已弃用的术语
typescript
// 过渡方案
/** @deprecated 请使用allowlist替代 */
export const whitelist = allowlist;
export const allowlist: string[] = [];Commit Messages and Branch Names
提交信息与分支名称
bash
undefinedbash
undefinedBranch names
分支名称
feature/issue-123-add-denylist-support # Correct
fix/issue-456-update-replica-config # Correct
feature/issue-123-add-denylist-support # 正确示例
fix/issue-456-update-replica-config # 正确示例
Commit messages
提交信息
"Add email denylist validation" # Correct
"Update replica failover logic" # Correct
undefined"Add email denylist validation" # 正确示例
"Update replica failover logic" # 正确示例
undefinedChecklist
检查清单
When writing or reviewing code:
- No master/slave terminology
- No whitelist/blacklist terminology
- No gendered language for generic users
- No ability-related negative terms
- Documentation uses inclusive language
- Variable/function names are inclusive
- Error messages are inclusive
- Comments are inclusive
编写或评审代码时,请确认:
- 未使用master/slave术语
- 未使用whitelist/blacklist术语
- 未使用性别相关术语泛指用户
- 未使用含负面含义的能力相关术语
- 文档使用了包容性语言
- 变量/函数名称具有包容性
- 错误信息使用了包容性语言
- 注释使用了包容性语言
Resources
参考资源
- Google Developer Style Guide: https://developers.google.com/style/inclusive-documentation
- Inclusive Naming Initiative: https://inclusivenaming.org/
- Google开发者风格指南:https://developers.google.com/style/inclusive-documentation
- 包容性命名倡议:https://inclusivenaming.org/
Integration
集成说明
This skill is applied by:
- - Step 7
issue-driven-development - - Style criterion
comprehensive-review
This skill ensures:
- Welcoming codebase
- Professional standards
- Accessibility for all contributors
本技能适用于:
- - 第7步
issue-driven-development - - 风格标准
comprehensive-review
本技能可确保:
- 友好的代码库
- 专业标准
- 对所有贡献者的包容性