Skip to content

Custom Instructions

You can inject custom prompting instructions for the translation task. This can be used to insert additional instructions, glossary or other guidance to improve the overall translation quality.

.github/workflows/ct.yml
uses: pelikhan/action-continuous-translation@v0
with:
instructions: Use a casual tone.
.github/workflows/ct.yml
uses: pelikhan/action-continuous-translation@v0
with:
instructions_file: ./instructions.txt

You can also specify translation instructions directly in the frontmatter of individual documents. This is useful when different documents require specific translation approaches.

example.md
---
title: "My Document"
translator:
instructions: |
Use formal tone and preserve all technical terms in English.
---
# My Document Content
This document will be translated using the instructions specified in the frontmatter.

The translator types are defined types.ts. It is removed from the frontmatter before the translation starts, so it does not affect the final output.

Configuration Types
export interface TranslatorConfiguration {
instructions?: string;
}
export interface FrontmatterWithTranslator {
translator?: TranslatorConfiguration;
}

Instructions are applied in the following priority order:

  1. instructions parameter (highest priority)
  2. instructions_file parameter
  3. translator.instructions from document frontmatter (lowest priority)

If multiple methods are used, only the highest priority one will be applied.