CsvTranslation
loreline.translation.CsvTranslation (Class)
Converts CSV/TSV file content into a Loreline translation file body.
Requires a header row. Recognized columns (case-insensitive):
- "key" (required, used as
#key in the synthesized .lor)
- "source" / "en" / "original" (optional, used as
// <source> reference)
- the column whose header equals
locale = the translation,
so a single multi-locale CSV (key, source, en, fr, es, de) can serve
every locale.
Fallback: if no column header matches locale, the last column is used as
the translation (legacy 2-column shape key, value).
Quoting follows RFC 4180: values containing the separator, quotes, or newlines
must be wrapped in double-quotes; literal quotes are doubled ("").
The locale-column value must be valid Loreline body content. It is
written verbatim into the synthesised .lor and re-parsed by Loreline.
See the full rules in loreline.translation.TranslationFormats.
Static Members
Generates a CSV file body for the given source script and locale.
The output has three columns: key, source, <locale>. If existing
is provided, entries already present there are preserved as the
translation value; otherwise the translation defaults to the source text.
Private Members
Escape a field for CSV/TSV output per RFC 4180. Wraps the value in
double-quotes if it contains the separator, a quote, or a newline; and
doubles any literal " to "" inside the wrapped value.