frappe-core-translation
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "frappe-core-translation":https://skillpi.com/zh/skills/deepskill-bea8f5cd55eeba52ac1e1d506c1afd97d98277555c21c51842fb360a71adfeee。安装前核对上游来源和版本:https://github.com/Impertio-Studio/Frappe_Claude_Skill_Package。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
在 Frappe v14–v16 应用中实现翻译與國際化(i18n)的说明,涵盖 Python 的 _()、JavaScript 的 __()、CSV 翻译文件、bench 命令、字符串提取规则、惰性翻译 _lt()、PO/MO 文件(v15+)、RTL 支持與自定义应用翻译。提示避免使用会破坏字符串提取的 f-string、字符串拼接与模板字面量等错误做法。
介绍来源: third_party · Impertio-Studio · 3.0 参考来源
SkillPi 解读
- 能完成的任务
- 翻译待完成,请参阅来源文档。
- 实测状态
- 未测试
文件浏览
Frontmatter
name: frappe-core-translation
description: >
Use when implementing translations/i18n in Frappe v14-v16 apps.
Covers _() in Python, __() in JavaScript, CSV translation files,
bench commands, string extraction rules, lazy translation _lt(),
PO/MO files [v15+], RTL support, and custom app translations.
Prevents common mistakes with f-strings, concatenation, and template
literals that break string extraction.
Keywords: translation, i18n, _(), __(), _lt(), CSV, PO, gettext,, translate my app, multi-language, text not translated, wrong language, how to add translation.
bench get-untranslated, RTL, localization.
license: MIT
compatibility: "Claude Code, Claude.ai Projects, Claude API. Frappe v14-v16."
metadata:
author: OpenAEC-Foundation
version: "3.0"Frappe Translation / i18n
Deterministic patterns for translating Frappe apps across v14, v15, and v16.
Quick Reference
| Task | Python | JavaScript |
|---|---|---|
| Translate string | _("Hello") |
__("Hello") |
| With substitution | _("Hello {0}").format(name) |
__("Hello {0}", [name]) |
| With context | _("Change", context="Coins") |
__("Change", null, "Coins") |
| Lazy (module-level) | _lt("Pending") [v15+] |
N/A |
| Check RTL | frappe.utils.is_rtl() |
frappe.utils.is_rtl() |
Decision Tree
Need to translate a string?
├── In Python (.py)?
│ ├── Inside a function/method → _("text {0}").format(val)
│ ├── Module-level constant [v15+] → _lt("text")
│ └── Module-level constant [v14] → define inside function or use lazy
├── In JavaScript (.js)?
│ └── ALWAYS → __("text {0}", [val])
├── In Jinja template (.html)?
│ └── {{ _("text") }}
├── In Vue (.vue)?
│ └── __("text") in <script>, {{ __("text") }} in <template>
└── DocType label/description/option?
└── Auto-extracted — no _() needed
Where do translations live?
├── v14 → apps/{app}/{app}/translations/{lang}.csv
├── v15+ → apps/{app}/{app}/locale/{lang}/LC_MESSAGES/{app}.po
└── User overrides → Translation DocType (highest priority)
Need to extract untranslated strings?
├── v14 → bench --site {site} get-untranslated {lang} {output}
└── v15+ → bench generate-pot-file --app {app}
Translation Priority (Highest First)
| Priority | Source | Scope |
|---|---|---|
| 1 | Translation DocType (user overrides) | Per-site |
| 2 | MO files (locale/{lang}/.../{app}.mo) |
Per-app [v15+] |
| 3 | CSV files (translations/{lang}.csv) |
Per-app |
| 4 | Parent language (e.g., pt for pt-BR) |
Fallback |
Version Differences
| Feature | v14 | v15 | v16 |
|---|---|---|---|
_() / __() |
Yes | Yes | Yes |
_lt() lazy translation |
No | Yes | Yes |
| CSV translations | Yes | Yes (legacy) | Yes (legacy) |
| PO/MO (gettext) | No | Yes | Yes |
bench generate-pot-file |
No | Yes | Yes |
| Babel JS extractor | No | Yes | Yes |
Type hints on _() |
No | No | Yes |
Auto-Extracted Strings (No _() Needed)
These are extracted automatically by the framework:
- DocType labels and descriptions
- Select field options (each option line)
- Workflow states and actions
- Print Format labels
- Report column labels
- Notification subjects (not body)
- Dashboard chart labels
String Extraction Rules
| File Type | Extractor | What It Finds |
|---|---|---|
.py |
Babel (AST) | _("..."), _lt("...") calls |
.js |
Babel tokenizer [v15+] / regex [v14] | __("...") calls |
.html |
Regex | {{ _("...") }} in Jinja |
.vue |
Same as JS | __("...") in script/template |
.json |
DocType parser | Labels, descriptions, options |
CRITICAL: Extractors work on the AST/tokens. They CANNOT extract dynamically constructed strings. See Anti-Patterns.
Anti-Patterns (NEVER Do These)
| Pattern | Why It Breaks | Correct Form |
|---|---|---|
_(f"Hello {name}") |
f-string not extractable | _("Hello {0}").format(name) |
_("Hello " + name) |
Concatenation fragments | _("Hello {0}").format(name) |
_("Welcome %s") % name |
Old-style not extractable | _("Welcome {0}").format(name) |
__(`Hello ${name}`) | Template literal not extractable | __("Hello {0}", [name]) |
||
_(" Hello ") |
Leading/trailing spaces trimmed | _("Hello") |
_("item" if x else "items") |
Ternary inside _() | _("item") if x else _("items") |
_(variable) |
Variable not extractable | _("Known String") |
Full anti-pattern catalog with code examples: references/anti-patterns.md
CSV Translation File Format
Location: apps/{app}/{app}/translations/{lang}.csv
"source","translation","context"
"Hello","Hallo",""
"Change","Wisselgeld","Coins"
"Change","Wijziging","Amendment"
- ALWAYS use UTF-8 encoding (no BOM)
- ALWAYS quote all fields with double quotes
- Context column is optional but MUST be present (empty string if unused)
- No hooks registration needed — auto-discovered from
translations/directory
PO/MO Files [v15+]
Location: apps/{app}/{app}/locale/{lang}/LC_MESSAGES/{app}.po
# Generate POT template
bench generate-pot-file --app {app}
# Migrate existing CSV to PO
bench migrate-csv-to-po --app {app}
# Compile PO to MO (required for runtime)
bench compile-po-to-mo --app {app}
PO files follow standard GNU gettext format. Use any PO editor (Poedit, Weblate, Transifex).
Bench Commands
| Command | Version | Purpose |
|---|---|---|
bench --site {site} get-untranslated {lang} {output.csv} |
All | Export untranslated strings |
bench update-translations {lang} {untranslated.csv} {translated.csv} |
All | Import translations |
bench generate-pot-file --app {app} |
v15+ | Generate .pot template |
bench migrate-csv-to-po --app {app} |
v15+ | Convert CSV to PO format |
bench compile-po-to-mo --app {app} |
v15+ | Compile PO to binary MO |
RTL Support
Hardcoded RTL languages: ar (Arabic), he (Hebrew), fa (Persian/Farsi), ps (Pashto)
# Python
if frappe.utils.is_rtl():
# Apply RTL-specific logic
// JavaScript
if (frappe.utils.is_rtl()) {
// Apply RTL-specific logic
}
- Frappe auto-applies
dir="rtl"to the<html>element - ALWAYS use logical CSS properties (
margin-inline-startnotmargin-left) for RTL compatibility - Bootstrap RTL stylesheet is auto-loaded when RTL language is active
Custom App Translation Workflow
Adding translations to your custom app:
- Write translatable strings using
_()/__()with positional placeholders - Extract untranslated strings:
- v14:
bench --site {site} get-untranslated {lang} untranslated.csv - v15+:
bench generate-pot-file --app {app}
- v14:
- Translate the extracted strings (manually or via PO editor)
- Place translations:
- CSV:
apps/{app}/{app}/translations/{lang}.csv - PO:
apps/{app}/{app}/locale/{lang}/LC_MESSAGES/{app}.po
- CSV:
- Compile (v15+ PO only):
bench compile-po-to-mo --app {app} - Clear cache:
bench --site {site} clear-cache
Reference Files
| File | Contents |
|---|---|
| references/api-reference.md | Full Python _() and JS __() API with all signatures and edge cases |
| references/csv-and-bench.md | CSV format spec, bench commands, PO/MO workflow, custom app setup |
| references/anti-patterns.md | Complete anti-pattern catalog with failing and corrected examples |
版本历史
-
v3.1.1
GitHub ↗
原版更新说明
## What's new Expanded Keywords in all skill descriptions with user-friendly, non-technical discovery terms. Skills are now easier to find when users describe problems in plain language instead of technical terminology. Examples of added terms: - Symptom-based: "app is slow", "nothing shows", "container won't start" - Beginner-friendly: "how do I start", "what is", "getting started" - Error messages: literal error text users would paste - Alternative names: common synonyms and abbreviations No skill content was changed. Only the Keywords line in SKILL.md frontmatter was expanded.
-
v3.1.0
GitHub ↗
原版更新说明
## What's new - package.json with agents.skills[] manifest for external discovery (60 skills) - agents/openai.yaml for OpenAI Codex - GitHub topic agentskills added - SKILLS_LOG.md added to .gitignore - Em-dashes replaced with colons in 31 SKILL.md section headings Enables discovery via npx skills add, skills.sh, LobeHub, and other platforms.
-
v3.0.0
GitHub ↗
原版更新说明
## Summary - **60 deterministic skills** for Frappe Framework v14-v16 (up from 53 in v2.0) - **~95% surface area coverage** (up from ~85%) - 7 new skills + 12 existing skills extended with new reference files ## New Skills (7) | Skill | Category | Coverage | |-------|----------|----------| | `frappe-core-translation` | core | i18n, _(), __(), CSV/PO files, string extraction | | `frappe-core-utils` | core | 140+ date, number, string, validation functions | | `frappe-syntax-print` | syntax | Print formats, PDF generation, Letter Head | | `frappe-syntax-query-builder` | syntax | frappe.qb, joins, aggregation, cross-DB | | `frappe-impl-workspace` | impl | Workspace builder, number cards, charts | | `frappe-core-logging` | core | frappe.logger(), Error Log, Sentry integration | | `frappe-core-search` | core | Link search, global search, SQLiteSearch FTS5 | ## Extended Skills (12) 13 new reference files added to existing skills covering: Controls API, Tree View, Portal Generators, Print Format decision tree, Email system, Module/Workspace shipping, complete Document API, custom bench commands, request lifecycle, advanced debugging (VS Code DAP), Frappe Packages, data masking (v16+), and Python type stubs. ## Stats | Category | Count | |----------|:-----:| | syntax/ | 13 | | core/ | 11 | | impl/ | 14 | | errors/ | 7 | | ops/ | 8 | | agents/ | 5 | | testing/ | 2 | | **Total** | **60** | ## Install ```bash git clone https://github.com/OpenAEC-Foundation/Frappe_Claude_Skill_Package.git cp -r Frappe_Claude_Skill_Package/skills/source/* ~/.claude/skills/ ```
-
v2.0.0
GitHub ↗
原版更新说明
## Frappe Claude Skill Package v2.0.0 Massive upgrade from 28 ERPNext-specific skills to **53 Frappe Framework skills** covering ~85% of the Frappe surface area. ### What's New - **25 new skills** across 3 new categories (ops, testing, agents) - **28 existing skills** fully rewritten with fresh research - **Renamed** from `erpnext-*` to `frappe-*` (all skills are Frappe Framework, not ERPNext-specific) - **7 categories**: syntax (11), core (7), impl (13), errors (7), ops (8), agents (5), testing (2) ### New Categories - **ops/** — Bench CLI, deployment, backup, performance, upgrades, frontend build, cloud - **testing/** — Unit/integration tests, CI/CD with GitHub Actions - **3 new agents** — debugger, migrator, architect ### Key Improvements - All skills verified against official Frappe docs (March 2026) - v16 features documented: `extend_doctype_class`, data masking, type annotations - MIT license (was LGPL-3.0) - Deterministic language throughout (ALWAYS/NEVER) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
-
v1.1.0
GitHub ↗
原版更新说明
V16 compatibility update and documentation improvements. ## Added - USAGE.md with platform-specific guides (Claude.ai, Claude Code, API) - Complete README overhaul with quick start guide ## Changed - All 28 skills updated for ERPNext/Frappe V16 compatibility - Agent Skills now follow standard skill structure - Improved validation: 28/28 skills pass all checks ## Fixed - V16-specific syntax changes in 9 skills - Agent SKILL.md files now under 500 lines
此处仅展示最近 5 个版本。 在原站查看完整版本历史 ↗
当前收录版本
3.0
安全与评测信息
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 提供 Frappe v14-v16 翻译/i18n 的完整实现指南,涵盖 Python/JavaScript 翻译函数、CSV/PO 文件格式、bench 命令等核心内容
- 解决开发者在多语言应用开发中的实际痛点,具有明确的实用价值和广泛适用性
亮点
- 关键词覆盖全面且精准,包括 translation, i18n, _(), __(), _lt(), CSV, PO, gettext 等,能有效触发相关查询
亮点
- 文档结构清晰完整,包含 Quick Reference、Decision Tree、Version Differences、Anti-Patterns 等章节
- 提供了详细的步骤划分、端到端示例和完整的 frontmatter
亮点
- 提供了准确的 bench 命令、文件路径和代码示例,工具来源明确,参数正确
- 覆盖了主要异常情况和关键注意事项,如版本差异、反模式和编译要求
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。