Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
152 changes: 152 additions & 0 deletions .agents/skills/prh-terminology/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
---
name: prh-terminology
description: "Manage the translation terminology dictionary prh.yml for consistent Angular-ja documentation. Use before adopting a translation for a new technical term, when checking existing terminology rules, and when adding, changing, or removing rules in prh.yml."
---

# prh-terminology: Terminology dictionary management

Maintain the Angular-ja project's translation terminology dictionary in `prh.yml` so that Japanese technical terms stay consistent across all Angular documentation translations.

**Rule**: Never guess terminology. Check `prh.yml` (and apply this skill) before adopting a translation for a new technical term. Typical moments:

- Before any translation work: check the existing rules for the terms in the file.
- For a new technical term: decide a consistent Japanese form.
- For katakana standardization: verify long vowel marks and spelling.
- After translating: add rules so the chosen form is enforced project-wide.

## prh.yml structure overview

The `prh.yml` file uses the prh (Proofreading Helper) format to enforce consistent terminology:

```yaml
version: 1
imports:
- path: ./node_modules/prh/prh-rules/files/markdown.yml
rules:
- expected: 正しい表記 # Preferred term
pattern: # Terms to replace
- 間違った表記1
- 間違った表記2
options: # Optional settings
wordBoundary: true # Match whole words only
```

## Rule categories

### 1. 言い換え (Paraphrasing rules)

Standardizes Japanese technical expressions.

- "依存性の注入" (preferred) vs "依存関係の注入" (to replace)
- "変更検知" (preferred) vs "変更検出" (to replace)

### 2. カタカナ語 (Katakana rules)

Enforces consistent katakana spelling and English preservation.

- **Long vowel consistency**: "サーバー" not "サーバ"
- **English preservation**: "Promise" not "プロミス"
- **Regex patterns**: `/pattern(?!suffix)/` to match specific cases

## How to add or modify rules

### Simple paraphrasing rule

```yaml
- expected: 推奨される表記
pattern:
- 置き換える表記1
- 置き換える表記2
```

### Katakana consistency rule

```yaml
- expected: サーバー
pattern: /サーバ(?!ー)/ # Matches "サーバ" not followed by "ー"
```

### English preservation rule

```yaml
- expected: Promise
pattern: プロミス
```

### Complex regex rule

```yaml
- expected: ため
pattern: /(行|作)?為(?!替)/
regexpMustEmpty: $1 # Captured group must be empty
```

### Word boundary rule

```yaml
- expected: Service Worker
pattern:
- サービスワーカー
options:
wordBoundary: true # Match whole words only
```

## Management procedures

### Add a new rule

1. **Identify category**: paraphrasing or katakana.
2. **Determine the preferred form**: based on project standards.
3. **List incorrect forms**: common variations to replace.
4. **Add appropriate options**: `wordBoundary`, regex patterns.

### Modify an existing rule

1. **Locate the existing rule**: search by expected term.
2. **Update patterns**: add or remove incorrect forms.
3. **Adjust options**: modify regex or boundary settings.
4. **Test impact**: consider existing translations.

### Remove a rule

1. **Verify necessity**: confirm the rule is no longer needed.
2. **Check dependencies**: ensure no conflicts with existing translations.
3. **Document the reason**: give a clear justification for the removal.

## Angular-specific terminology guidelines

### Technical terms (keep in English)

- Component, Directive, Service, Pipe
- Promise, Observable, Signal
- Router, Guard, Resolver

### Japanese translations (standardize)

- "依存性の注入" for Dependency Injection
- "変更検知" for Change Detection
- "遅延読み込み" for Lazy Loading

### Katakana consistency

- Long vowel marks: アプリケーション, サーバー, ユーザー
- Short forms: ブラウザ (not ブラウザー)

## Validation process

After modifying `prh.yml`:

1. **Test with prh**: verify the syntax is valid.
2. **Run textlint** (`pnpm lint`): check integration with linting.
3. **Test on sample files**: verify the rules work correctly.
4. **Document changes**: update the rule rationale.

## Best practices

1. **Consistency first**: align with existing project terminology.
2. **Community input**: consider Angular-ja community preferences.
3. **Technical accuracy**: maintain precision in technical terms.
4. **Readability**: balance consistency with natural Japanese.
5. **Incremental changes**: add rules gradually to avoid disruption.

Always test rule changes against existing translations to ensure they improve consistency without introducing errors.
66 changes: 66 additions & 0 deletions .agents/skills/translate-file/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
name: translate-file
description: "Translate English Angular documentation file to Japanese following strict project standards. Use when translating new .en.md/.en.ts/.en.json files into Japanese with line-count preservation, anchor IDs, and terminology consistency."
---

Translate the file the user specifies (a path under `adev-ja/`) from English to Japanese following the angular-ja project's strict translation standards.

You are an expert Japanese technical translator specializing in Angular documentation translation. Follow the same approach as the project's AI translation tool with two-stage processing: translation → proofreading.

## Critical Translation Rules

**NEVER wrap the entire text in code blocks.** Always maintain original formatting.

**Structural Requirements:**
- **Maintain EXACT line count** - input and output must have identical number of lines
- **Preserve markdown structure absolutely** - never change heading levels, list markers, or indentation
- **Keep empty lines as empty lines** - preserve all whitespace and spacing
- **Maintain list hierarchy and markers** (*, -, +, 1., etc.)
- **Preserve code blocks unchanged** - never translate content inside code blocks
- **Keep URLs, filenames, and identifiers untranslated**
- **Preserve HTML tags and special symbols exactly**

**AI Translation tool**
- For Markdown files, use the translator tool: `tools/translator`.

**Heading ID Rules:**
- For headings **below h1 level** (`<h2>` and lower), add anchor IDs based on original English heading
- Convert original heading to lowercase and remove all symbols except hyphens
- Format: `## Japanese Translation {#original-heading-lowercase}`
- Examples:
- `## How to use Angular` → `## Angularの使い方 {#how-to-use-angular}`
- `### `foo.bar`` → `### `foo.bar` {#foobar}` (remove all non-hyphen symbols)
- **h1 level headings get NO anchor IDs**

**Special Content Rules:**
- **Never change special prefixes**: NOTE/TIP/HELPFUL/IMPORTANT/QUESTION/TLDR/CRITICAL remain in English
- Correct: `NOTE: これは重要な情報です。`
- Incorrect: `注: これは重要な情報です。`
- **No spaces around English words**: `Angularの使い方` not `Angular の使い方`
- **Preserve all Angular terminology**: component, directive, service, pipe, etc.

**Quality Standards:**
- Follow textlint rules for Japanese technical writing
- Use appropriate katakana for foreign terms per Ministry of Education guidelines
- Maintain consistency with existing project translations
- Ensure all cross-references and internal links remain functional

**CRITICAL: Use the `prh-terminology` skill for Terminology**
- **BEFORE translating**: Follow the `prh-terminology` skill to check existing terminology rules in `prh.yml`
- **When encountering new terms**: Follow the same skill for a consistent translation approach
- **For uncertain katakana**: Check long vowel marks and standardization with the same skill
- **After translation**: Add new terminology rules per the same skill if needed
- The skill ensures all translations follow the project's terminology dictionary

**File Management Rules:**
- **Original content preservation**: Translated Japanese file has ALWAYS corresponding `<name>.en.<ext>` file to preserve original content snapshot
- **Structure matching**: Translated file MUST have the same line count and document structure to the original file
- **Diff compatibility**: This enables easy comparison and tracking of changes between versions

**Processing Approach:**
1. **Block-based translation**: Process content in heading-based blocks like the AI tool
2. **Two-stage validation**: Translate first, then apply textlint-based corrections
3. **Preserve technical accuracy** while making content accessible to Japanese developers
4. **Maintain line correspondence** for easy diff tracking between .en.md and .md files

Always translate only the requested content, returning the translated text without additional explanations or wrapper text.
Loading
Loading