mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-25 15:15:23 +03:00
feat: add i18n internationalization for memo and cheatsheet (#552)
* feat(git-memo): add i18n support and Chinese translation - Dynamically load locale-specific markdown content - Add comprehensive Chinese translation for git memo - Apply theme-aware styles for tables and links * feat(git-semantic-commit-memo): add i18n support and table styling Load memo markdown dynamically based on locale, add Chinese translation, and apply theme-aware styles for tables and links. * feat(jq-memo): add i18n support and Chinese memo Support multiple languages for the jq memo tool by dynamically loading locale-specific markdown files based on the current i18n locale, and add the Chinese translation (jq.zh.md). * feat(jsonpath-memo): add i18n support for memo component Dynamically load localized markdown files based on the current locale, falling back to the default English memo. * feat(markdown-cheatsheet): add i18n support with Chinese content Load locale-specific memo content dynamically using glob import and provide the Chinese translation for the Markdown cheatsheet. * style(markdown-cheatsheet): add table and link styling Add borders, padding, and collapse for tables, and set link color using theme variables. * feat(nano-memo): add i18n support and table/link styling - Dynamically load locale-specific content markdown based on the current language - Add Chinese translation content file - Apply theme-aware border and link colors for tables and links * feat(nginx-memo): add i18n support and styling improvements - dynamically load localized content based on current locale - add Chinese (zh) translation for nginx memo - add table and link styling using theme variables - fallback to default content if localized version is missing * feat(powershell-memo): add i18n support and Chinese translation Load localized Markdown content based on the current locale, falling back to the default English version. Include the complete Chinese translation file. * feat(sed-memo): add i18n support and zh docs * feat(tmux-memo): add i18n support and Chinese translation - Dynamically load locale-specific markdown content - Add Chinese translation (tmux-memo.content.zh.md) - Fall back to default content if locale file not found * feat(vim-memo): add i18n support and zh content - Implement dynamic locale-based content loading - Add comprehensive Chinese translation file - Update styles for tables and links using theme variables * feat(xpath-memo): support locale-based markdown loading Load the appropriate markdown file based on the current i18n locale, falling back to the default when a localized version is not available. * feat(zellij-memo): add i18n support for memo content Load locale-specific markdown files dynamically based on the current language setting, falling back to the default when a translation is unavailable. * feat(chmod-memo): add i18n support and Chinese docs - load locale-specific markdown via dynamic imports - add chmod.zh.md with detailed Chinese documentation - fall back to default chmod.md if no locale match * feat(screen-memo): add i18n support with Chinese translation Add dynamic locale-based markdown loading for the Screen Memo tool and include the complete Chinese (zh) translation. * feat(regex-memo): add i18n support with Chinese translation Load locale-specific markdown content dynamically based on the selected language.
This commit is contained in:
1 parent
db3a344568
commit
04cfee6f3e
32 files changed
+3437
-32
No files matched your search
@@ -0,0 +1,163 @@
|
||||
# 约定式提交速查表
|
||||
|
||||
## 结构
|
||||
|
||||
约定式提交信息遵循以下结构:
|
||||
|
||||
```
|
||||
<type>[optional scope]: <description>
|
||||
|
||||
[optional body]
|
||||
|
||||
[optional footer(s)]
|
||||
```
|
||||
|
||||
## 元素
|
||||
|
||||
### 类型(Type)(必填)
|
||||
类型描述所做更改的种类。常用类型包括:
|
||||
|
||||
- **feat**: 面向用户的新功能
|
||||
- **fix**: 面向用户的 Bug 修复
|
||||
- **docs**: 文档更改
|
||||
- **style**: 代码风格更改(格式化、缺少分号等)
|
||||
- **refactor**: 既不修复 Bug 也不添加功能的代码更改
|
||||
- **test**: 添加或更新测试
|
||||
- **chore**: 维护任务、依赖更新、构建变更
|
||||
- **perf**: 性能优化
|
||||
- **ci**: CI/CD 配置更改
|
||||
- **build**: 构建系统或外部依赖更改
|
||||
- **revert**: 回退之前的提交
|
||||
|
||||
### 作用域(Scope)(可选)
|
||||
作用域提供关于代码库中受影响部分的附加上下文:
|
||||
|
||||
```
|
||||
feat(auth): add OAuth2 integration
|
||||
fix(api): resolve timeout issues
|
||||
docs(readme): update installation instructions
|
||||
```
|
||||
|
||||
### 描述(必填)
|
||||
对更改的简要描述:
|
||||
|
||||
- 使用祈使语气("add" 而非 "added" 或 "adds")
|
||||
- 保持简洁(建议不超过 50 个字符)
|
||||
- 首字母不大写
|
||||
- 结尾不加句号
|
||||
|
||||
### 正文(可选)
|
||||
提供更详细的更改说明:
|
||||
|
||||
- 用空行与描述分隔
|
||||
- 解释动机并与之前的行为进行对比
|
||||
- 使用祈使语气
|
||||
|
||||
### 脚注(可选)
|
||||
包含提交的元数据:
|
||||
|
||||
- **破坏性更改**: 以 `BREAKING CHANGE:` 开头
|
||||
- **Issue 引用**: `Closes #123`、`Fixes #456`
|
||||
- **共同作者**: `Co-authored-by: Name <email>`
|
||||
|
||||
## 示例
|
||||
|
||||
### 简单提交
|
||||
```
|
||||
feat: add user authentication
|
||||
```
|
||||
|
||||
### 带作用域
|
||||
```
|
||||
fix(parser): handle edge case in JSON parsing
|
||||
```
|
||||
|
||||
### 带正文
|
||||
```
|
||||
feat: add email notifications
|
||||
|
||||
Users can now receive email notifications for important events.
|
||||
This includes account changes, security alerts, and system updates.
|
||||
```
|
||||
|
||||
### 带脚注
|
||||
```
|
||||
fix: prevent racing of requests
|
||||
|
||||
Introduce a request id and a reference to latest request. Dismiss
|
||||
incoming responses other than from latest request.
|
||||
|
||||
Closes #123
|
||||
```
|
||||
|
||||
### 破坏性更改
|
||||
```
|
||||
feat!: send an email to the customer when a product is shipped
|
||||
|
||||
BREAKING CHANGE: The shipping service now requires an email address
|
||||
```
|
||||
|
||||
### 完整示例
|
||||
```
|
||||
feat(shopping cart): add ability to remove items
|
||||
|
||||
Users can now remove items from their shopping cart by clicking
|
||||
the remove button next to each item. This improves the user
|
||||
experience by allowing corrections without starting over.
|
||||
|
||||
Closes #456
|
||||
Co-authored-by: Jane Doe <jane@example.com>
|
||||
```
|
||||
|
||||
## 常用工具
|
||||
|
||||
### Commitizen
|
||||
用于创建约定式提交的交互式工具:
|
||||
|
||||
```shell
|
||||
npm install -g commitizen
|
||||
npm install -g cz-conventional-changelog
|
||||
echo '{ "path": "cz-conventional-changelog" }' > ~/.czrc
|
||||
```
|
||||
|
||||
用法:
|
||||
```shell
|
||||
git cz
|
||||
```
|
||||
|
||||
### Commitlint
|
||||
对提交信息进行 lint 检查,确保遵循约定式格式:
|
||||
|
||||
```shell
|
||||
npm install --save-dev @commitlint/config-conventional @commitlint/cli
|
||||
```
|
||||
|
||||
在 `.commitlintrc.json` 中配置:
|
||||
```json
|
||||
{
|
||||
"extends": ["@commitlint/config-conventional"]
|
||||
}
|
||||
```
|
||||
|
||||
### Husky
|
||||
用于强制执行提交信息格式的 Git 钩子:
|
||||
|
||||
```shell
|
||||
npm install --save-dev husky
|
||||
npx husky add .husky/commit-msg 'npx --no -- commitlint --edit ${1}'
|
||||
```
|
||||
|
||||
### Semantic Release
|
||||
根据约定式提交自动生成发布版本:
|
||||
|
||||
```shell
|
||||
npm install --save-dev semantic-release
|
||||
```
|
||||
|
||||
### Conventional Changelog
|
||||
根据约定式提交生成变更日志:
|
||||
|
||||
```shell
|
||||
npm install -g conventional-changelog-cli
|
||||
conventional-changelog -p angular -i CHANGELOG.md -s
|
||||
```
|
||||
@@ -1,13 +1,36 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useThemeVars } from 'naive-ui';
|
||||
import Memo from './git-sem.memo.md';
|
||||
import type { Component } from 'vue';
|
||||
|
||||
const themeVars = useThemeVars();
|
||||
const { locale } = useI18n();
|
||||
|
||||
const memoImports = import.meta.glob('./git-sem.memo*.md');
|
||||
const memoComponent = ref<Component | null>(null);
|
||||
|
||||
async function loadMemo(currentLocale = locale.value) {
|
||||
const memoKey = `./git-sem.memo.${currentLocale}.md`;
|
||||
const loader = memoImports[memoKey] ?? memoImports['./git-sem.memo.md'];
|
||||
|
||||
if (!loader) {
|
||||
memoComponent.value = null;
|
||||
return;
|
||||
}
|
||||
|
||||
const module = (await loader()) as { default?: Component };
|
||||
memoComponent.value = module.default ?? module;
|
||||
}
|
||||
|
||||
watch(locale, () => {
|
||||
loadMemo();
|
||||
}, { immediate: true });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<Memo />
|
||||
<component :is="memoComponent" style="overflow-x: auto;" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -19,4 +42,14 @@ const themeVars = useThemeVars();
|
||||
border-radius: 4px;
|
||||
overflow: auto;
|
||||
}
|
||||
::v-deep(table) {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
::v-deep(table), ::v-deep(td), ::v-deep(th) {
|
||||
border: 1px solid v-bind('themeVars.textColor1');
|
||||
padding: 5px;
|
||||
}
|
||||
::v-deep(a) {
|
||||
color: v-bind('themeVars.textColor1');
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user