Three languages, one article: how to spot an outdated translation

Separate source and translation revisions make outdated language versions visible. An independent Python experiment shows one changed fact, partial readiness and the limits of a semantic checklist.

One changed detail across three similar panels: a conceptual metaphor for a source and translations that need comparison.

The Ukrainian article already contains a corrected fact, while the Russian and English texts still show the old value. All three files exist, their titles are filled in, and the pages could open without an error. Yet readers would receive different answers to the same question. Checking that translations exist does not catch this problem.

In “Article: how a personal journal becomes a product”, I considered the editorial package, preview and publication as separate stages of work. Here I narrow the question: how can each translation be linked to a particular source revision, making it clear that one language has been reviewed while another is still behind?

A small, independent experiment with Python and JSON is enough to explore this. It was actually run on Python 3.12.14: one fictional fact was changed, and state transitions and rejections were checked. The example uses no working platform code and publishes nothing. All teaching files appear below. The result helps define an editorial contract that can later be implemented in your application.

Two counters answer different questions

sourceRevision identifies the current revision of the Ukrainian content. translationRevision identifies the current revision of one translation. They do not need to be equal: the English wording might have been edited three times while the Ukrainian text stayed unchanged.

We therefore need another link, basedOnSourceRevision, identifying the source used to prepare the translation. An approval record must reference both a specific sourceRevision and a specific translationRevision. Otherwise, a “reviewed” label could accidentally survive a subsequent edit to the translation itself.

Field The question it answers
sourceRevision Which Ukrainian content is the current source?
translationRevision Which revision of this language version are we reading?
basedOnSourceRevision Which Ukrainian revision is this translation based on?
approval.sourceRevision + approval.translationRevision Which exact pair was reviewed?

This is the lab's chosen model. The numbers are local to one teaching article; they are not publication numbers, dates or global identifiers. The recorded dependency matters more than the counter's particular format. A single translated: true flag cannot express it: that flag does not identify which source was translated.

Four states instead of one shared green label

Calculate a state separately for each target language. Do not store it as another independent flag: it can be derived from the revisions and approval record. This reduces the number of fields that must be kept consistent during a change.

State Meaning in this example
missing The language version does not exist
stale It is based on an earlier source revision
needs_review It references the current source, but the exact pair has not been approved
current All required checks have been recorded for the current revision pair

current describes the editorial record. By itself, it proves neither the translation's truth nor permission to publish it. This name helps keep revision alignment separate from the readiness of a cover, schedule or public route.

Separate states preserve partial readiness. After RU is corrected, EN may remain stale. The work on RU need not be discarded, and the English version's remaining work should not disappear behind an article-wide status. The editor can see a specific next action for each language.

Decide which changes advance the revision

In this teaching model, public content consists of title, body and seoDescription. Changing any of these fields increments sourceRevision, even if the author considers it a minor clarification. This is a conservative policy: the code does not try to infer whether a punctuation change or short sentence altered the meaning.

The only field treated as metadata-only is the internal editorNote. Readers never see it. Changing this note does not alter the source text or make translations stale. Calling something “metadata” does not grant that exception: an SEO description can contain a number, condition or promise, so it belongs to content here.

A full editorial model would need equivalent decisions for summaries, alt text and captions. If a field makes a claim to the reader, changing it requires the relevant review of language versions. This small example implements only the three named public fields; it does not claim to cover the journal's entire schema.

Writing the exact same value again does not create a new revision. Editing a translation, or linking it to a newer source, increments its own translationRevision and removes the previous approval. Even when a Ukrainian change does not require different translated wording, that decision must be confirmed for the new pair.

Data that does not describe a real product

Create a new teaching directory and save the article's three files there. The target is Python 3.12; no external packages or pip install are needed. The standard library's json module reads and writes our local document. JSON supplies the data format; the code below defines the revision rules.

File sample.json:

{
  "sourceRevision": 1,
  "source": {
    "title": "Навчальний редактор",
    "body": "У вигаданому редакторі Paper Kite Demo чернетка зберігається кожні 5 хвилин.",
    "seoDescription": "Умовний приклад збереження чернетки в навчальному редакторі."
  },
  "editorNote": "Synthetic teaching data only.",
  "translations": {
    "ru": {
      "translationRevision": 1,
      "basedOnSourceRevision": 1,
      "content": {
        "title": "Учебный редактор",
        "body": "В вымышленном редакторе Paper Kite Demo черновик сохраняется каждые 5 минут.",
        "seoDescription": "Условный пример сохранения черновика в учебном редакторе."
      },
      "approval": null
    },
    "en": {
      "translationRevision": 1,
      "basedOnSourceRevision": 1,
      "content": {
        "title": "A teaching editor",
        "body": "The fictional Paper Kite Demo editor saves a draft every 5 minutes.",
        "seoDescription": "A hypothetical example of saving a draft in a teaching editor."
      },
      "approval": null
    }
  }
}

Paper Kite Demo is a fictional editor. Its five-minute interval was invented for the exercise, not observed in an installed package. The initial RU/EN texts carry the same meaning, but approval: null makes clear that having text does not replace a review record.

Check three things in each locale: the title promises the same teaching example, the body has the same interval and unit, and the SEO description adds no new result. Next we will change just one fact, the interval to ten minutes, and observe how that change affects the other versions.

Minimal operations on editorial state

File editorial.py:

"""A sequential local revision lab; no publishing or production import."""

import argparse
import json
import sys
from pathlib import Path

LOCALES = ("ru", "en")
PUBLIC_FIELDS = ("title", "body", "seoDescription")
CHECKS = ("facts", "commands", "scope", "metadata-links")


def status(document):
    result = {}
    for locale in LOCALES:
        translation = document["translations"].get(locale)
        if translation is None:
            result[locale] = "missing"
            continue
        approval = translation.get("approval")
        if translation["basedOnSourceRevision"] != document["sourceRevision"]:
            result[locale] = "stale"
        elif (
            approval is None
            or approval["sourceRevision"] != document["sourceRevision"]
            or approval["translationRevision"] != translation["translationRevision"]
            or set(approval["checks"]) != set(CHECKS)
        ):
            result[locale] = "needs_review"
        else:
            result[locale] = "current"
    return {"sourceRevision": document["sourceRevision"], "locales": result}


def check_text(field, value):
    if field not in PUBLIC_FIELDS or not isinstance(value, str) or not value.strip():
        raise ValueError("Choose a public field and a non-empty string.")


def change_source(document, field, value):
    check_text(field, value)
    if document["source"][field] != value:
        document["source"][field] = value
        document["sourceRevision"] += 1


def change_note(document, value):
    document["editorNote"] = value


def change_translation(document, locale, field, value, source_revision):
    check_text(field, value)
    if source_revision != document["sourceRevision"]:
        raise ValueError("The source revision changed; read it again.")
    if locale not in LOCALES or locale not in document["translations"]:
        raise ValueError("Choose an existing RU or EN teaching draft.")
    translation = document["translations"][locale]
    if (
        translation["content"][field] != value
        or translation["basedOnSourceRevision"] != source_revision
    ):
        translation["content"][field] = value
        translation["basedOnSourceRevision"] = source_revision
        translation["translationRevision"] += 1
        translation["approval"] = None


def approve(document, locale, source_revision, translation_revision, checks):
    translation = document["translations"].get(locale)
    if translation is None:
        raise ValueError("There is no translation to approve.")
    if (
        source_revision != document["sourceRevision"]
        or translation["basedOnSourceRevision"] != source_revision
        or translation_revision != translation["translationRevision"]
    ):
        raise ValueError("The reviewed revisions no longer match.")
    if set(checks) != set(CHECKS):
        raise ValueError("Complete all four semantic checks before approval.")
    translation["approval"] = {
        "sourceRevision": source_revision,
        "translationRevision": translation_revision,
        "checks": list(CHECKS),
    }


def main(argv=None):
    parser = argparse.ArgumentParser(description=__doc__)
    actions = parser.add_subparsers(dest="action", required=True)
    for action in ("status", "source", "note", "translation", "approve"):
        command = actions.add_parser(action)
        command.add_argument("file", type=Path)
        if action in ("translation", "approve"):
            command.add_argument("locale", choices=LOCALES)
            command.add_argument("--source-revision", type=int, required=True)
        if action in ("source", "translation"):
            command.add_argument("field", choices=PUBLIC_FIELDS)
            command.add_argument("value")
        elif action == "note":
            command.add_argument("value")
        elif action == "approve":
            command.add_argument("--translation-revision", type=int, required=True)
            command.add_argument("--check", action="append", choices=CHECKS, default=[])
    args = parser.parse_args(argv)

    try:
        document = json.loads(args.file.read_text(encoding="utf-8"))
        if args.action == "source":
            change_source(document, args.field, args.value)
        elif args.action == "note":
            change_note(document, args.value)
        elif args.action == "translation":
            change_translation(document, args.locale, args.field, args.value, args.source_revision)
        elif args.action == "approve":
            approve(document, args.locale, args.source_revision, args.translation_revision, args.check)
        report = status(document)
        if args.action != "status":
            args.file.write_text(json.dumps(document, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
        print(json.dumps(report, ensure_ascii=False, sort_keys=True))
        return 0
    except (OSError, ValueError, KeyError, TypeError) as error:
        print(str(error), file=sys.stderr)
        return 2


if __name__ == "__main__":
    raise SystemExit(main())

The source, translation, note and approve commands change the local document; status only reads it. The argument interface uses the standard argparse module. Every successfully processed command prints the current language states. Exit code 0 means that the operation ran; it does not mean that every translation is current.

To edit a translation, the operator supplies the source revision they read. To approve it, they supply both revisions. If the document now contains different values, the command rejects the request instead of silently approving a newer revision. Checks precede the approval write; an earlier decision is never automatically transferred to new text.

The status function first checks the source dependency. An older approval therefore remains in the data as a previous record, but no longer produces current after the Ukrainian content changes. Editing the translation itself clears its approval directly. Both paths make the necessary review work visible to anyone reading the state.

A complete test of the rules and their limits

File test_editorial.py:

import copy
import json
import unittest
from pathlib import Path

from editorial import CHECKS, approve, change_note, change_source, change_translation, status


class EditorialTest(unittest.TestCase):
    def setUp(self):
        self.document = json.loads(Path(__file__).with_name("sample.json").read_text(encoding="utf-8"))
        for locale in ("ru", "en"):
            approve(self.document, locale, 1, 1, CHECKS)

    def test_source_change_marks_both_translations_stale(self):
        change_source(self.document, "body", "A new synthetic fact.")
        self.assertEqual(status(self.document), {
            "sourceRevision": 2, "locales": {"ru": "stale", "en": "stale"},
        })

    def test_one_reviewed_translation_does_not_hide_the_other_stale_locale(self):
        change_source(self.document, "body", "A new synthetic fact.")
        change_translation(self.document, "ru", "body", "Новый условный факт.", 2)
        self.assertEqual(status(self.document)["locales"], {"ru": "needs_review", "en": "stale"})
        approve(self.document, "ru", 2, 2, CHECKS)
        self.assertEqual(status(self.document)["locales"], {"ru": "current", "en": "stale"})

    def test_old_source_cannot_receive_new_approval(self):
        change_source(self.document, "body", "A new synthetic fact.")
        before = copy.deepcopy(self.document)
        with self.assertRaises(ValueError):
            approve(self.document, "en", 1, 1, CHECKS)
        self.assertEqual(self.document, before)

    def test_translation_edit_invalidates_its_own_previous_approval(self):
        change_translation(self.document, "ru", "title", "Новый заголовок", 1)
        self.assertEqual(status(self.document)["locales"]["ru"], "needs_review")
        with self.assertRaises(ValueError):
            approve(self.document, "ru", 1, 1, CHECKS)
        approve(self.document, "ru", 1, 2, CHECKS)
        self.assertEqual(status(self.document)["locales"]["ru"], "current")

    def test_editor_note_is_metadata_only_but_seo_description_is_content(self):
        before = status(self.document)
        change_note(self.document, "Review after lunch.")
        self.assertEqual(status(self.document), before)
        change_source(self.document, "seoDescription", "A changed public promise.")
        self.assertEqual(status(self.document)["locales"], {"ru": "stale", "en": "stale"})

    def test_incomplete_checklist_is_rejected_without_changing_the_draft(self):
        change_translation(self.document, "ru", "title", "Новый заголовок", 1)
        before = copy.deepcopy(self.document)
        with self.assertRaises(ValueError):
            approve(self.document, "ru", 1, 2, ["facts"])
        self.assertEqual(self.document, before)

    def test_missing_translation_is_visible(self):
        del self.document["translations"]["en"]
        self.assertEqual(status(self.document)["locales"]["en"], "missing")

    def test_declared_checks_do_not_prove_semantic_truth(self):
        change_translation(self.document, "en", "body", "The fictional editor saves every 999 minutes.", 1)
        approve(self.document, "en", 1, 2, CHECKS)
        self.assertEqual(status(self.document)["locales"]["en"], "current")
        self.assertIn("999", self.document["translations"]["en"]["content"]["body"])
        self.assertIn("5", self.document["source"]["body"])

    def test_identical_edits_do_not_create_new_revisions(self):
        before = copy.deepcopy(self.document)
        change_source(self.document, "body", self.document["source"]["body"])
        change_translation(self.document, "ru", "body", self.document["translations"]["ru"]["content"]["body"], 1)
        self.assertEqual(self.document, before)


if __name__ == "__main__":
    unittest.main()

The tests use standard unittest. They cover a source change, partial readiness, rejection of an old pair, loss of approval after a translation edit, the internal-note and SEO policy, an incomplete checklist, a missing locale, and an identical repeated edit.

One test deliberately leaves an incorrect value of 999 in the translation and supplies every check flag. It confirms a key limitation: the program accepts the operator's declaration but does not understand the sentence. The expected current in that test does not mean the translation is correct. It demonstrates why editorial review cannot disappear behind counters.

After creating all three files, run this in their directory:

python3 --version
python3 -m unittest -v test_editorial.py
ARTICLE_LOCALES_WORKDIR="$(mktemp -d "${TMPDIR:-/tmp}/article-locales.XXXXXX")"
ARTICLE_LOCALES_FILE="$ARTICLE_LOCALES_WORKDIR/article.json"
cp sample.json "$ARTICLE_LOCALES_FILE"
python3 editorial.py status "$ARTICLE_LOCALES_FILE"

The working JSON is copied into a new temporary directory. The original sample.json stays unchanged, so the next experiment can start from the same data without clearing someone else's files. The first status command reports needs_review for both translations.

Change one fact and keep the outstanding work visible

First compare the initial texts and approve both languages. A --check flag declares that you performed a particular check; it does not invoke a translator or semantic analyzer. For these short examples, read all three fields in each language.

python3 editorial.py approve "$ARTICLE_LOCALES_FILE" ru \
    --source-revision 1 --translation-revision 1 \
    --check facts --check commands --check scope --check metadata-links
python3 editorial.py approve "$ARTICLE_LOCALES_FILE" en \
    --source-revision 1 --translation-revision 1 \
    --check facts --check commands --check scope --check metadata-links
python3 editorial.py source "$ARTICLE_LOCALES_FILE" body \
    'У вигаданому редакторі Paper Kite Demo чернетка зберігається кожні 10 хвилин.'

After the last command, sourceRevision is 2 and both target languages are stale. Their own revisions are still 1. This is expected: a Ukrainian edit should not silently rewrite the Russian or English text or invent another approval.

Now test a rejection by trying to approve EN again against the old pair. The shell explicitly handles the expected nonzero exit so that the file can then be compared.

cp "$ARTICLE_LOCALES_FILE" "$ARTICLE_LOCALES_WORKDIR/before-rejection.json"
if python3 editorial.py approve "$ARTICLE_LOCALES_FILE" en \
    --source-revision 1 --translation-revision 1 \
    --check facts --check commands --check scope --check metadata-links; then
    printf '%s\n' 'Unexpected approval: inspect the example.' >&2
    exit 1
else
    ARTICLE_LOCALES_EXIT=$?
fi
test "$ARTICLE_LOCALES_EXIT" -eq 2
cmp "$ARTICLE_LOCALES_WORKDIR/before-rejection.json" "$ARTICLE_LOCALES_FILE"

In the executed run, that command returned 2, and comparison confirmed that the document was unchanged. This is one particular rejection of old revisions. It does not imply that every disk error or interrupted write is guaranteed to leave the file intact.

Next, correct RU, reread the content with the value ten, and record approval. Then add an internal note about the remaining work:

python3 editorial.py translation "$ARTICLE_LOCALES_FILE" ru body \
    'В вымышленном редакторе Paper Kite Demo черновик сохраняется каждые 10 минут.' \
    --source-revision 2
python3 editorial.py approve "$ARTICLE_LOCALES_FILE" ru \
    --source-revision 2 --translation-revision 2 \
    --check facts --check commands --check scope --check metadata-links
python3 editorial.py note "$ARTICLE_LOCALES_FILE" \
    'The Russian version is reviewed; the English version is pending.'

This is the actual short report after RU approval:

{"locales": {"en": "stale", "ru": "current"}, "sourceRevision": 2}

The internal note written by the next command preserved those states and sourceRevision: 2. It neither corrects EN nor makes it ready. The last step is to update and review the English version:

python3 editorial.py translation "$ARTICLE_LOCALES_FILE" en body \
    'The fictional Paper Kite Demo editor saves a draft every 10 minutes.' \
    --source-revision 2
python3 editorial.py approve "$ARTICLE_LOCALES_FILE" en \
    --source-revision 2 --translation-revision 2 \
    --check facts --check commands --check scope --check metadata-links
python3 editorial.py status "$ARTICLE_LOCALES_FILE"

The final document marked both languages current. Their approval records referenced source revision 2 and their own revision 2. Nine unit tests ran in this teaching experiment. A separate CLI sequence also rejected an incomplete checklist and an edit based on an old source revision. These are results of this local example, not an audit of platform readiness.

What a person actually needs to check

The first checklist item, facts, covers numbers, units, versions, dates, conditions and negation. “Every ten minutes” cannot be translated as “within ten minutes”: the number matches, but the behavior is different. In a technical article, that distinction may matter more than stylistic accuracy.

commands means checking code, arguments, paths and expected statuses. Our short fictional body contains no commands; that absence is what the reviewer confirms. In a real technical article, translating an explanation must not silently change the example or introduce a command absent from the source.

scope checks the limits of a conclusion. If UK describes one teaching run, RU/EN must not turn it into a universal guarantee or a new personal experience attributed to the author. metadata-links covers whether the title, SEO promise and links still refer to the same material. That requires reading, even when the texts are short.

These flags are a compact record of work performed. If they are set automatically without review, the system will consistently store false attestations. The 999 test remains in the example specifically to make that boundary visible and testable.

What the experiment does not cover

The script is intended for its own well-formed JSON and sequential local execution. It is not a validator for arbitrary external formats, an editorial database or a user audit system. Directly editing the JSON can bypass the counter rules. A working process needs all changes to pass through a defined owner of revisions.

Checking the supplied number helps detect a revision that has already changed, but the file has no locking against simultaneous writers. Two processes could read the same state before writing. A multiuser implementation needs a separate guarantee that the check and update form one operation; this experiment does not establish that guarantee.

The result is specific: changing a source fact makes both outdated translations visible, approval references exact revisions, and language readiness can be considered separately. A person remains responsible for semantic agreement. The program helps preserve the relationship between the versions that have already been reviewed.

  1. Editorial Draft, review, publication: a state model for one article
  2. Editorial An article package for three languages: from the author's chat to the CMS
  3. API API languages and links: one article across three routes
  4. Editorial Correcting an article without broken links or silently rewriting history