frappe-core-translation

Guidance for implementing translations and internationalization (i18n) in Frappe v14–v16 apps, covering Python _(), JavaScript __(), CSV translation files, bench commands, string extraction rules, lazy translation _lt(), PO/MO files (v15+), RTL support, and custom app translations. Warns against practices that break string extraction such as f-strings, string concatenation, and template literals.

Last repository push
GitHub Stars
211
Forks
61
Issues / PRs
4

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "frappe-core-translation" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-bea8f5cd55eeba52ac1e1d506c1afd97d98277555c21c51842fb360a71adfeee. Verify the upstream source and version against https://github.com/Impertio-Studio/Frappe_Claude_Skill_Package before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

github.com

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Guidance for implementing translations and internationalization (i18n) in Frappe v14–v16 apps, covering Python _(), JavaScript __(), CSV translation files, bench commands, string extraction rules, lazy translation _lt(), PO/MO files (v15+), RTL support, and custom app translations. Warns against practices that break string extraction such as f-strings, string concatenation, and template literals.

0 Downloads

Introduction source: third_party · Impertio-Studio · 3.0 Reference

SkillPi interpretation

Tasks
Deterministic patterns for translating Frappe apps across v14, v15, and v16.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
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-start not margin-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:

  1. Write translatable strings using _() / __() with positional placeholders
  2. Extract untranslated strings:
    • v14: bench --site {site} get-untranslated {lang} untranslated.csv
    • v15+: bench generate-pot-file --app {app}
  3. Translate the extracted strings (manually or via PO editor)
  4. Place translations:
    • CSV: apps/{app}/{app}/translations/{lang}.csv
    • PO: apps/{app}/{app}/locale/{lang}/LC_MESSAGES/{app}.po
  5. Compile (v15+ PO only): bench compile-po-to-mo --app {app}
  6. 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

Version history

  1. v3.1.1 GitHub ↗
    Original release notes

    ## 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.

  2. v3.1.0 GitHub ↗
    Original release notes

    ## 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.

  3. v3.0.0 GitHub ↗
    Original release notes

    ## 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/ ```

  4. v2.0.0 GitHub ↗
    Original release notes

    ## 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)

  5. v1.1.0 GitHub ↗
    Original release notes

    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

Only the five most recent versions are shown. View full version history at the source ↗

Current listing version

3.0

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value88/100

Highlights

  • 提供 Frappe v14-v16 翻译/i18n 的完整实现指南,涵盖 Python/JavaScript 翻译函数、CSV/PO 文件格式、bench 命令等核心内容
  • 解决开发者在多语言应用开发中的实际痛点,具有明确的实用价值和广泛适用性
Trigger Precision95/100

Highlights

  • 关键词覆盖全面且精准,包括 translation, i18n, _(), __(), _lt(), CSV, PO, gettext 等,能有效触发相关查询
Structure and Standards92/100

Highlights

  • 文档结构清晰完整,包含 Quick Reference、Decision Tree、Version Differences、Anti-Patterns 等章节
  • 提供了详细的步骤划分、端到端示例和完整的 frontmatter
Execution Reliability89/100

Highlights

  • 提供了准确的 bench 命令、文件路径和代码示例,工具来源明确,参数正确
  • 覆盖了主要异常情况和关键注意事项,如版本差异、反模式和编译要求
Evidence Verifiability (mean of the first four)91/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.