Conversation
- 使用 gettext + babel 实现国际化 - 支持英文和中文 - 自动检测系统语言 - 支持命令行参数 --lang 手动指定语言 - 添加 README.md (英文) 和 README.zh-CN.md (中文) - 配置 polint 检查翻译文件质量 - 添加 pre-commit hooks 自动提取和检查翻译 - 支持通过 python -m remark.cli 运行模块
- Track messages.pot file for translation completeness checking - Use pybabel update --check instead of custom script - Rename README.zh-CN.md to README.zh.md (W3C standard) - Update language badges in README files - Add i18n completeness check to pre-commit hooks
- 新增 _get_windows_locale() 函数,使用 ctypes 调用 Windows API - 优先使用 GetUserDefaultLocaleName 获取用户默认区域设置 - 改进 get_system_language() 处理各种 locale 格式 - 添加 i18n 单元测试(31 个测试用例) - 修复 --lang 参数帮助文本(zh_CN -> zh)
主要更改: - remark.spec: 添加 locale_datas 收集 .mo 文件到打包 - remark/i18n.py: 修复 _get_locale_dir() 路径解析,打包后使用 sys._MEIPASS/locale - remark/cli/commands.py: 在 main() 中强制设置控制台编码为 UTF-8
- Bump version from 2.0.5 to 2.0.6 - Add 'comment' keyword to pyproject.toml for SEO - Update README with dual-language H1 title - Add badges (Python version, License) - Add Star Us section - Enhance description with remark/comment keywords - Update GitHub About description via gh CLI - Add 12 topics: windows, folder, remark, comment, desktop, command-line, utility, python, portable, cli, automation, tool
- Add VitePress configuration with English and Chinese locales - Create documentation structure: /en/ and /zh/ - Add getting started, usage, and API reference pages - Add documentation links to README.md - Update .gitignore to exclude node_modules
- Rename README.zh.md to README.en.md (English version) - Update README.md to be the primary Chinese version with English summary - Update language switch badges to point to README.md and README.en.md - Add GitHub Actions workflow to deploy VitePress site to GitHub Pages
Modify get_system_language() to check LANG environment variable first before Windows API. This allows tests to reliably control language by setting LANG environment variable in conftest.py. Also update test_windows_platform_priority to clear LANG env var to properly test Windows API fallback behavior.
Add explicit set_language("zh") call in pytest_configure to ensure
all tests use Chinese translations. This fixes test failures where
tests expected Chinese output but got English.
Move sys import to the beginning of pytest_configure function to avoid UnboundLocalError.
Add an autouse fixture that calls set_language("zh") before each test.
This ensures the translator is initialized to Chinese even if modules
were imported before pytest_configure ran.
Move set_language("zh") call to module level in conftest.py,
executing before any test modules are imported. This ensures
the translator is initialized to Chinese globally.
Also change autouse fixture scope to session for efficiency.
Add debug output in conftest.py to help diagnose why translation files are not being loaded correctly in CI.
- Remove .mo files from .gitignore to allow them in repository - Add locale/zh/LC_MESSAGES/messages.mo to enable translations in CI - This fixes the issue where tests in CI were outputting English instead of Chinese due to missing translation files The .mo file is compiled from .po source using pybabel compile. Including compiled files in the repository ensures translations work in all environments without requiring build tools.
- 移除 "约 12MB" 等具体版本号信息 - 移除 "隐私优先" 等不够具体的描述 - 统一修改为: - "无系统驻留,无数据上传,安全放心,用完即走" (中文) - "No system residency, no data upload, safe and secure, use it when you need it" (英文) 修改文件: - README.md - README.en.md - docs/zh/index.md - docs/en/index.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
为 Windows 文件夹备注工具添加完整的多语言支持 (i18n) 并优化 SEO,支持中文和英文两种语言。同时建设 VitePress 双语文档站点并部署到 GitHub Pages。
主要功能
更改内容
新增文件
locale/zh/LC_MESSAGES/messages.po- 中文翻译源文件messages.pot- 翻译模板文件tests/unit/test_i18n.py- i18n 单元测试(31 个测试用例)docs/- VitePress 双语文档站点.github/workflows/deploy-docs.yml- GitHub Pages 部署工作流README.en.md- 英文版 READMEpackage.json/package-lock.json- VitePress 依赖修改文件
remark/i18n.py- 新增 i18n 核心模块remark/cli/commands.py- 添加 --lang 参数和 UTF-8 编码设置README.md- 主版本(中文为主,含英文摘要)pyproject.toml- 添加 comment 关键词remark.spec- 添加 locale 数据文件到打包配置SEO 优化
版本变更
使用示例
```bash
自动检测系统语言
windows-folder-remark.exe
手动指定中文
windows-folder-remark.exe --lang zh
手动指定英文
windows-folder-remark.exe --lang en
```