Skip to content

Commit 97d720c

Browse files
committed
l10n: README: document AI assistant guidelines
Add guidelines for using AI tools as optional assistants in Git localization work, while emphasizing human translators remain in control. Example usage in prompts to AI assistants: - "Update translations in `po/XX.po` following the guidelines in @po/README.md" - "Review all translations in `po/XX.po` following the guidelines in @po/README.md" Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
1 parent 00d6cbf commit 97d720c

File tree

1 file changed

+282
-0
lines changed

1 file changed

+282
-0
lines changed

po/README.md

Lines changed: 282 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,5 +459,287 @@ additional conventions:
459459
```
460460

461461

462+
## Artificial Intelligence (AI) as Translation Assistant
463+
464+
This section provides guidance for human translators who choose to use AI tools
465+
as assistants in their localization work. The use of AI is entirely optional.
466+
Many successful translation teams work effectively without it.
467+
468+
469+
### Human translators remain in control
470+
471+
Translation of Git is a human-driven community effort. Language team leaders and
472+
contributors are responsible for:
473+
474+
- Understanding the technical context of Git commands and messages
475+
- Making linguistic and cultural adaptation decisions for their target language
476+
- Maintaining translation quality and consistency within their language team
477+
- Ensuring translations follow Git l10n conventions and community standards
478+
- Building and maintaining language-specific glossaries
479+
- Reviewing and approving all changes before submission
480+
481+
AI tools, if used, serve only to accelerate routine tasks. While they may assist
482+
with decisions, judgment, and understanding of context, it remains the human
483+
translators' responsibility to monitor these AI-generated decisions, judgement,
484+
and understanding, and countermand them as needed.
485+
486+
487+
### When AI assistance may be helpful
488+
489+
AI tools can help speed up certain mechanical aspects of translation work:
490+
491+
- Generating first-draft translations for new or updated messages
492+
- Identifying untranslated or fuzzy entries across large PO files
493+
- Checking consistency with existing translations and glossary terms
494+
- Detecting technical errors (missing placeholders, formatting issues)
495+
- Reviewing translations against quality criteria
496+
497+
However, AI-generated output should always be treated as rough drafts requiring
498+
human review, editing, and approval by someone who understands both the
499+
technical context and the target language.
500+
501+
502+
### Preparing your translation environment for effective AI use
503+
504+
If you choose to use AI assistance, investing time in preparation will
505+
significantly improve the quality of AI-generated suggestions:
506+
507+
- **Maintain a glossary**: Add a "Git glossary for XX translators" section in
508+
the header comments of your `po/XX.po` file (before the first `msgid`). List
509+
key Git terms with their approved translations. AI tools can read and follow
510+
this glossary. See `po/zh_CN.po` for an example of this practice.
511+
512+
- **Choose appropriate AI coding tools**: Evaluate and use models and tools
513+
that work best for your target language. Different AI models have varying
514+
levels of proficiency across languages. Test multiple tools to find which
515+
produces the most natural and accurate translations for your language.
516+
517+
518+
### Technical guidelines for AI tools
519+
520+
The following sections provide technical specifications for AI tools that
521+
assist with Git translation. These guidelines ensure AI-generated suggestions
522+
are technically correct and follow Git l10n conventions. Human translators
523+
should be familiar with these requirements to effectively review AI output.
524+
525+
526+
#### Scope and context
527+
528+
- Primary files: `po/XX.po` for translations, `po/git.pot` for the source
529+
template (generated on demand; see "Dynamically generated POT files").
530+
- Source language: English. Target language: derived from the language code in
531+
the `po/XX.po` filename based on ISO 639 and ISO 3166.
532+
- Glossary: Git l10n teams may add glossary sections (e.g. "Git glossary for
533+
Chinese translators") in the header comments of `po/XX.po` immediately before
534+
the first `msgid` entry. If a glossary exists, read it and keep terminology
535+
consistent.
536+
537+
538+
#### Quality checklist
539+
540+
- Accuracy: faithfully conveys the original meaning; no omissions or distortions.
541+
- Terminology: uses correct, consistent terms per glossary or domain standards.
542+
- Grammar and fluency: grammatically correct and reads naturally.
543+
- Placeholders: preserves variables (e.g. `%s`, `{name}`, `$1`) exactly. If
544+
reordering is needed for the target language, use positional parameters as
545+
described below.
546+
- Plurals and gender: handles plural forms, gender, and agreement correctly.
547+
- Context fit: suitable for UI space, tone, and usage (e.g. error vs. tooltip).
548+
- Cultural appropriateness: avoids offensive or ambiguous content.
549+
- Consistency: matches prior translations of the same source string.
550+
- Technical integrity: do not translate code, paths, commands, brand names, or
551+
proper nouns.
552+
- Readability: clear, concise, and user-friendly.
553+
554+
555+
#### Locating untranslated, fuzzy, and obsolete entries
556+
557+
Use GNU gettext tools to parse PO structure reliably (safe for multi-line
558+
`msgid`/`msgstr`):
559+
560+
- Untranslated entries:
561+
562+
```shell
563+
msgattrib --untranslated --no-obsolete po/XX.po
564+
```
565+
566+
- Fuzzy entries:
567+
568+
```shell
569+
msgattrib --only-fuzzy --no-obsolete po/XX.po
570+
```
571+
572+
- Obsolete entries (marked with `#~`):
573+
574+
```shell
575+
msgattrib --obsolete --no-wrap po/XX.po
576+
```
577+
578+
If you only want the message IDs, you can pipe to:
579+
580+
```shell
581+
msgattrib --untranslated --no-obsolete po/XX.po | sed -n '/^msgid /,/^$/p'
582+
```
583+
584+
```shell
585+
msgattrib --only-fuzzy --no-obsolete po/XX.po | sed -n '/^msgid /,/^$/p'
586+
```
587+
588+
589+
#### Translation workflow (`po/XX.po`)
590+
591+
When asked to update translations, follow the steps in this section in order
592+
and reference this section in your plan before making edits.
593+
594+
- Generate `po/git.pot` from source code (see "Dynamically generated POT files").
595+
- Update `po/XX.po` with the new template.
596+
- Translate new entries identified by `msgattrib --untranslated` (see above).
597+
- Fix fuzzy entries identified by `msgattrib --only-fuzzy` (see above) by
598+
re-translating and removing the `fuzzy` tag after updating `msgstr`.
599+
- For entries with `msgid_plural`, consult [Plural forms](#plural-forms) to
600+
supply all required `msgstr[n]` forms based on the `Plural-Forms` header.
601+
- Apply the quality checklist to every translation.
602+
603+
604+
#### Review workflow
605+
606+
Review workflow has two modes: direct review against local `po/XX.po`, and
607+
review based on a patch.
608+
609+
610+
##### Full file review
611+
612+
- When explicitly asked to review all translated content, review `po/XX.po`
613+
in chunks (see [Handling large inputs](#handling-large-inputs) for splitting).
614+
- Apply the quality checklist to each message you review.
615+
- Unless otherwise specified, update `po/XX.po` directly; if a summary is
616+
requested, provide a consolidated report of the issues.
617+
618+
619+
##### Patch review
620+
621+
- Review requests may come as patches of `po/XX.po`:
622+
- Workspace changes: `git diff HEAD -- po/XX.po`
623+
- Changes since a commit-ish: `git diff <commit-ish> -- po/XX.po`
624+
- Changes in a specific commit: `git show <commit-ish> -- po/XX.po`
625+
- For large patches, follow the split guidance in
626+
[Handling large inputs](#handling-large-inputs) when splitting.
627+
- When diff context is incomplete (truncated `msgid` or `msgstr`), use file
628+
viewing tools to pull nearby context for accurate review.
629+
- Apply the same quality checklist as in full file reviews.
630+
- If the patch is based on workspace changes, update `po/XX.po` directly
631+
unless a summary is requested.
632+
- If the patch is from a specific commit, report issues or apply fixes when
633+
comparing against the current `po/XX.po` in the workspace.
634+
635+
636+
#### Handling large inputs
637+
638+
When a `po/XX.po` file or a patch is too large for LLM context, split it into
639+
chunks while keeping `msgid` and `msgstr` pairs intact. This includes plural
640+
forms: `msgid`, `msgid_plural`, `msgstr[0]`, `msgstr[1]`, and any additional
641+
plural indices required by the language.
642+
643+
For `po/XX.po`, split on the line immediately before each `msgid` entry. This
644+
guarantees no chunk begins with an unpaired `msgid`. Use
645+
`grep -n '^msgid' po/XX.po` to locate split points, and group the file into
646+
chunks of no more than 200 `msgid` entries (about 50K bytes each).
647+
648+
For patch files, check the patch size first:
649+
650+
- If the patch is <= 100KB, do not split.
651+
- If the patch is > 100KB, split it using the same rule as for `po/XX.po`:
652+
split on the line immediately before each `msgid` entry so message pairs
653+
stay together.
654+
655+
656+
#### Plural forms
657+
658+
This section defines how translators should handle `msgid_plural` entries,
659+
including how many `msgstr[n]` forms are required and how to index them. It
660+
provides the canonical example and points to the `Plural-Forms` header for the
661+
language-specific rule set.
662+
663+
For entries with `msgid_plural`, provide plural forms:
664+
665+
```po
666+
msgid "..."
667+
msgid_plural "..."
668+
msgstr[0] "..."
669+
msgstr[1] "..."
670+
```
671+
672+
Use `msgstr[0]`/`msgstr[1]` as required. If the language has more plural forms,
673+
follow the `Plural-Forms` header in `po/XX.po` to determine the required number
674+
of `msgstr[n]` entries.
675+
676+
677+
#### Placeholder reordering
678+
679+
When a translation reorders placeholders, mark them with positional parameter
680+
syntax (`%n$`) so each argument maps to the correct source value. Keep the
681+
width/precision modifiers intact and place the position specifier before them.
682+
683+
Example:
684+
685+
```po
686+
msgid "missing environment variable '%s' for configuration '%.*s'"
687+
msgstr "配置 '%3$.*2$s' 缺少环境变量 '%1$s'"
688+
```
689+
690+
Here the translation swaps the two placeholders. `%1$s` still refers to the
691+
first argument (`%s`), while `%3$.*2$s` refers to the third string argument
692+
with the precision taken from the second argument (`%.*s`).
693+
694+
695+
### Integrating AI tools into your workflow
696+
697+
If you decide to use AI assistance, here's how to integrate it responsibly:
698+
699+
700+
#### For AI tool developers and users
701+
702+
When building or configuring AI-assisted translation tools:
703+
704+
- Use the quality checklist (above) to score or filter draft suggestions
705+
- Apply the `msgattrib` + `sed` commands to extract relevant entries for processing
706+
- Ensure AI tools read and respect glossary terms from the `po/XX.po` header
707+
- Configure tools to follow the technical workflows documented above
708+
709+
710+
#### Human oversight is mandatory
711+
712+
**Never submit AI-generated translations without human review.** The human
713+
translator must:
714+
715+
- Verify technical accuracy (correct placeholders, plural forms, formatting)
716+
- Ensure linguistic quality (natural phrasing, appropriate terminology)
717+
- Check cultural appropriateness for the target audience
718+
- Confirm consistency with the language team's established style
719+
- Take full responsibility for the final translation
720+
721+
Example usage in prompts to AI assistants:
722+
723+
- "Update translations in `po/XX.po` following the guidelines in @po/README.md"
724+
- "Review all translations in `po/XX.po` following the guidelines in @po/README.md"
725+
726+
727+
### Summary: AI as a tool, humans as translators
728+
729+
AI can accelerate translation work, but it is not a substitute for human
730+
translators. The Git localization community values:
731+
732+
- **Human expertise**: Deep understanding of Git's technical context and the
733+
cultural nuances of each target language
734+
- **Community standards**: Consistency across releases and alignment with
735+
language team conventions
736+
- **Accountability**: Human translators who stand behind their work and respond
737+
to feedback from users
738+
739+
If you choose to use AI tools, they should enhance these human contributions,
740+
not replace them. The best results come from combining AI efficiency with human
741+
judgment, cultural insight, and community engagement.
742+
743+
462744
[git-po-helper/README]: https://github.com/git-l10n/git-po-helper#readme
463745
[Documentation/SubmittingPatches]: Documentation/SubmittingPatches

0 commit comments

Comments
 (0)