UNPKG

i18n-ai-translate

Version:

AI-powered localization CLI, Node library, and GitHub Action. Translate i18next JSON, Gettext PO, Java .properties, and iOS .strings with ChatGPT, Claude, Gemini, or local Ollama models.

31 lines (30 loc) 985 B
import type FormatAdapter from "./format_adapter"; type PlaceholderMap = { /** Native tokens, one per arg slot (1-based index → tokens[i-1]). */ tokens: string[]; /** Whether tokens were positional (`%1$@`) or bare (`%@`). */ positional: boolean; }; /** * One chunk of the source file. `raw` chunks (comments, whitespace, * keys, `=`, quotes, `;`) are reproduced verbatim; `value` chunks hold * a single translatable string's inner content so it can be swapped. */ type StringsChunk = { kind: "raw"; text: string; } | { kind: "value"; key: string; /** Original escaped inner text (without the surrounding quotes). */ rawValue: string; /** Placeholder-stripped value; "unchanged" sentinel on write. */ normalizedValue: string; placeholders: PlaceholderMap; }; type StringsSidecar = { kind: "strings"; chunks: StringsChunk[]; }; declare const StringsAdapter: FormatAdapter<StringsSidecar>; export default StringsAdapter;