Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6c23732
feat: 实现多语言支持 (i18n)
piratf Jan 29, 2026
5b45b3e
chore: improve i18n workflow and fix README naming
piratf Jan 29, 2026
4a2b209
feat: 改进 Windows 语言检测,添加 GetUserDefaultLocaleName API 支持
piratf Jan 29, 2026
e75f3dc
fix: 修复打包后语言切换功能和控制台输出乱码
piratf Jan 30, 2026
2b7d2c2
docs: update README with tool advantages and fix filename case
piratf Jan 30, 2026
5cda23b
chore: bump version to 2.0.6 and enhance SEO
piratf Jan 30, 2026
129325e
feat: add VitePress bilingual documentation site
piratf Jan 30, 2026
f565791
refactor: restructure README files and add GitHub Pages deployment
piratf Jan 30, 2026
cf0788a
fix: correct workflow path for package.json
piratf Jan 30, 2026
260f276
test: add feat-i18n branch trigger for testing
piratf Jan 30, 2026
604c13e
test: remove feat-i18n branch trigger after testing
piratf Jan 30, 2026
49cc14e
fix: add base path for GitHub Pages
piratf Jan 30, 2026
0700775
fix: simplify locale config and nav links
piratf Jan 30, 2026
ec4bb74
revert: restore working config for VitePress build
piratf Jan 30, 2026
1c2873b
docs: add prominent language switch links to READMEs
piratf Jan 30, 2026
31172af
fix: set default language to zh for tests
piratf Jan 30, 2026
91764e7
fix: set LANG env var before imports for consistent i18n in tests
piratf Jan 30, 2026
3f269c8
fix: prioritize LANG env var for consistent i18n in tests
piratf Jan 30, 2026
070009b
fix: force reinitialize translator to Chinese in pytest_configure
piratf Jan 30, 2026
059b52d
fix: ensure sys is imported before use in pytest_configure
piratf Jan 30, 2026
5125ff5
fix: add autouse fixture to set Chinese language before each test
piratf Jan 30, 2026
6560a06
fix: set language at module level before any imports
piratf Jan 30, 2026
e488464
test: add detailed debug output for translation loading
piratf Jan 31, 2026
9928107
fix: include compiled .mo translation files in repository
piratf Jan 31, 2026
1182caa
test: remove debug output from conftest.py
piratf Jan 31, 2026
a1a817a
docs: 优化工具描述,去除生硬信息
piratf Jan 31, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Deploy VitePress site to Pages

on:
push:
branches: [main]
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: package-lock.json

- name: Install dependencies
run: npm ci

- name: Build VitePress site
run: npm run docs:build

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/.vitepress/dist

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,12 @@ dmypy.json
*.whl
*.tar.gz
/tools/upx/

# i18n - 不再忽略 .mo 文件,需要提交到仓库以便 CI 使用
# .mo 文件由 pybabel compile 生成,从 .po 文件编译而来

# bv (beads viewer) local config and caches
.bv/

# Node.js
node_modules/
25 changes: 25 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,31 @@ repos:
stages: [pre-push]
pass_filenames: false

# i18n 相关检查
- id: extract-translations
name: Extract i18n messages
entry: bash -c 'pybabel extract -k "_" -k "gettext" -k "ngettext" -o messages.pot remark/ && echo "Translations extracted successfully"'
language: system
types: [python]
stages: [pre-commit]
pass_filenames: false
require_serial: true

- id: check-i18n-completeness
name: Check i18n completeness
entry: bash -c 'pybabel update -i messages.pot -d locale --check'
language: system
types: [python]
stages: [pre-commit]
pass_filenames: false

- id: check-po-files
name: Check PO files with polint
entry: bash -c 'if compgen -G "locale/*/LC_MESSAGES/*.po" > /dev/null; then polint locale/*/LC_MESSAGES/*.po || true; fi'
language: system
types: [po]
stages: [pre-commit]

# 全局排除
exclude: |
^(?:
Expand Down
157 changes: 157 additions & 0 deletions README.en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
# Windows Folder Remark/Comment Tool

**[English](README.en.md)** | [中文文档](README.md)

[![PyPI](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
[![en](https://img.shields.io/badge/lang-en-blue.svg)](README.en.md)
[![zh](https://img.shields.io/badge/lang-zh-red.svg)](README.md)

A lightweight CLI tool to add remarks/comments to Windows folders via Desktop.ini. No system residency, no data upload, safe and secure, use it when you need it. Perfect for organizing your files with custom descriptions.

## ⭐ Star Us

If you find this tool helpful, please consider giving it a star on GitHub!

## Why This Tool

- **Use and Go**: Runs when needed, exits when done — no system residency
- **Safe & Secure**: Completely local operation, no data upload, privacy protected
- **Portable**: Single-file exe packaging, no installation required

## Features

- Multi-language character support (UTF-16 encoding)
- Multi-language interface support (English, Chinese)
- Command-line and interactive modes
- Automatic encoding detection and repair
- Automatic update checking to stay current
- Right-click menu integration for quick access
- Single-file exe packaging, no Python environment required

## Installation

### Method 1: Using exe file (Recommended)

Download `windows-folder-remark.exe` from [releases](https://github.com/piratf/windows-folder-remark/releases) and use directly.

### Method 2: Install from source

```bash
# Clone repository
git clone https://github.com/piratf/windows-folder-remark.git
cd windows-folder-remark

# Install dependencies (no external dependencies)
pip install -e .

# Run
python -m remark.cli --help
```

## Usage

### Command-line Mode

```bash
# Add remark
windows-folder-remark.exe "C:\MyFolder" "This is my folder"

# View remark
windows-folder-remark.exe --view "C:\MyFolder"

# Delete remark
windows-folder-remark.exe --delete "C:\MyFolder"

# Check updates
windows-folder-remark.exe --update

# Install right-click menu
windows-folder-remark.exe --install

# Uninstall right-click menu
windows-folder-remark.exe --uninstall
```

### Interactive Mode

```bash
# Follow prompts after running
windows-folder-remark.exe
```

### Right-click Menu (Recommended)

After installing the right-click menu, you can add remarks directly in File Explorer by right-clicking folders:

```bash
# Install right-click menu
windows-folder-remark.exe --install
```

- **Windows 10**: Right-click folder to see "Add Folder Remark"
- **Windows 11**: Right-click folder → Click "Show more options" → Add Folder Remark

### Auto Update

The program automatically checks for updates on exit (once every 24 hours) and prompts if a new version is available.

You can also manually check for updates:

```bash
windows-folder-remark.exe --update
```

## Encoding Detection

When viewing remarks with `--view`, if the `desktop.ini` file is not in standard UTF-16 encoding, the tool will prompt you:

```
Warning: desktop.ini file encoding is utf-8, not standard UTF-16.
This may cause Chinese and other special characters to display abnormally.
Fix encoding to UTF-16? [Y/n]:
```

Select `Y` to automatically fix the encoding.

## Development

```bash
# Install development dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Code check
ruff check .
ruff format .

# Type check
mypy remark/

# Build exe locally
python -m scripts.build
```

## How It Works

This tool implements folder remarks through these steps:

1. Create/modify `Desktop.ini` file in the folder
2. Write `[.ShellClassInfo]` section and `InfoTip` property
3. Save file with UTF-16 encoding
4. Set `Desktop.ini` as hidden and system attributes
5. Set folder as read-only (makes Windows read `Desktop.ini`)

Reference: [Microsoft Official Documentation](https://learn.microsoft.com/en-us/windows/win32/shell/how-to-customize-folders-with-desktop-ini)

## Notes

- May take a few minutes to display in File Explorer after modification
- Some file managers may not support folder remarks
- The tool modifies system attributes of folders

## License

MIT License
28 changes: 24 additions & 4 deletions readme.md → README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
# Windows 文件夹备注工具
# Windows Folder Remark/Comment Tool - Windows 文件夹备注工具

一个通过修改 `Desktop.ini` 文件为 Windows 文件夹添加备注/注释的命令行工具。
**[English Documentation](README.en.md)** | [中文文档](README.md)

[![PyPI](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
[![en](https://img.shields.io/badge/lang-en-blue.svg)](README.en.md)
[![zh](https://img.shields.io/badge/lang-zh-red.svg)](README.md)

A lightweight CLI tool to add remarks/comments to Windows folders via Desktop.ini. No system residency, no data upload, safe and secure, use it when you need it. / 一个轻量级的命令行工具,通过 Desktop.ini 为 Windows 文件夹添加备注/评论。无系统驻留,无数据上传,安全放心,用完即走。

**Documentation**: [Full Documentation](https://piratf.github.io/windows-folder-remark/en/) | [完整文档](https://piratf.github.io/windows-folder-remark/zh/)

## ⭐ 支持

如果这个工具对你有帮助,请在 GitHub 上给个 Star!

## 工具优势

- **用完即走**:需要时运行,用完即退出,无系统驻留
- **安全放心**:完全本地运行,无数据上传,保护隐私
- **轻量便携**:单文件 exe 打包,无需安装,随处可用

## 特性

- 支持中文等多语言字符(UTF-16 编码)
- 支持中英文界面切换
- 命令行模式和交互模式
- 自动编码检测和修复
- 自动更新检查,保持最新版本
Expand Down Expand Up @@ -71,8 +91,8 @@ windows-folder-remark.exe
windows-folder-remark.exe --install
```

- **Windows 10**: 右键文件夹可直接看到「添加文件夹备注」
- **Windows 11**: 右键文件夹 → 点击「显示更多选项」→ 添加文件夹备注
- **Windows 10**右键文件夹可直接看到「添加文件夹备注」
- **Windows 11**右键文件夹 → 点击「显示更多选项」→ 添加文件夹备注

### 自动更新

Expand Down
11 changes: 11 additions & 0 deletions babel.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Babel extraction configuration
# https://babel.pocoo.org/en/latest/messages.html

# Extract translatable strings from Python files
[python: remark/**/*.py]

# Keyword list - recognize strings in these function calls as translatable
keywords = _, gettext, ngettext

# Encoding
encoding = utf-8
52 changes: 52 additions & 0 deletions docs/.vitepress/config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { defineConfig } from 'vitepress'

export default defineConfig({
title: 'Windows Folder Remark Tool',
description: 'A lightweight CLI tool to add remarks/comments to Windows folders via Desktop.ini',
base: '/windows-folder-remark/',
lang: 'en-US',

locales: {
root: {
label: 'English',
lang: 'en-US'
},
zh: {
label: '简体中文',
lang: 'zh-CN',
link: '/zh/'
}
},

themeConfig: {
nav: () => [
{ text: 'Guide', link: '/en/guide/' },
{ text: '中文', link: '/zh/' }
],

sidebar: {
'/en/': [
{
text: 'Guide',
items: [
{ text: 'Introduction', link: '/en/' },
{ text: 'Getting Started', link: '/en/guide/getting-started' },
{ text: 'Usage', link: '/en/guide/usage' },
{ text: 'API Reference', link: '/en/guide/api' }
]
}
],
'/zh/': [
{
text: '指南',
items: [
{ text: '介绍', link: '/zh/' },
{ text: '快速开始', link: '/zh/guide/getting-started' },
{ text: '使用方法', link: '/zh/guide/usage' },
{ text: 'API 参考', link: '/zh/guide/api' }
]
}
]
}
}
})
21 changes: 21 additions & 0 deletions docs/en/guide/api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# API Reference

## Command-line Arguments

| Argument | Short | Description |
|---|---|---|
| `--help` | `-h` | Show help information |
| `--install` | | Install right-click menu |
| `--uninstall` | | Uninstall right-click menu |
| `--update` | | Check for updates |
| `--view <path>` | | View folder remark |
| `--delete <path>` | | Delete folder remark |
| `--gui <path>` | | GUI mode |
| `--lang <lang>` | `-L` | Set language (en, zh) |

## Exit Codes

| Code | Description |
|---|---|
| 0 | Success |
| 1 | Error |
Loading