Gå til hovedinnhold

YAML format (.yaml, .yml)

The YAML format reads YAML documents, extracts scalar string values as translatable blocks, and writes the translations back while preserving the surrounding structure, comments, and ordering. It suits Rails locale files, application configuration, and other key/value catalogues expressed in YAML.

By default only string scalars are extracted. You can also extract non-string scalars, restrict extraction to specific key paths with glob-style patterns, detect inline codes, and route values containing embedded markup (such as HTML) to a subfilter.

IDyaml
SourceBuilt-in
Extensions.yaml, .yml
MIME Typesapplication/yaml, text/yaml, application/x-yaml
CapabilitiesRead + Write

Parameters

ParameterTypeDefaultDescription
codeFinderRulesarrayRegex-mønstre som matcher innebygde koder i oversettbar tekst
extractNonStringsbooleanfalsePakk ut ikke-streng skalarverdier (boolske verdier, tall, null-verdier) som oversettbare blokker
keyPathPatternsarrayNår den ikke er tom, pakkes kun nøkler som samsvarer med ett av disse glob-mønstrene ut. Støtter * (enkelt nøkkel) og ** (hvilken som helst dybde).
subfilterstringDelfilter som skal brukes på skalarverdier (f.eks. 'html' for å behandle HTML i YAML-verdier)
useCodeFinderbooleanfalseAktiver regex-basert deteksjon av innebygd kode i strengverdier

Configure it live

Configuration
Loading form…

Examples

Extract a single locale subtree

Translate only the keys under the en branch of a Rails-style locale file.

keyPathPatterns:
- "en.**"

HTML inside values

Parse HTML markup within YAML scalar values.

subfilter: html

Processing notes

  • Document structure, key order, and comments are preserved across the read/write roundtrip.

Limitations

  • Only scalar values are translatable; mapping keys and sequence structure form the non-translatable skeleton.

← Back to the Format Reference