Skip to content

Commit 71bfd92

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. Also update `git-po-helper` command examples to include the `--pot-file=build` option. 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 71bfd92

File tree

1 file changed

+291
-3
lines changed

1 file changed

+291
-3
lines changed

po/README.md

Lines changed: 291 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,8 @@ L10n coordinator will check your contributions using a helper program
227227
(see "PO helper" section below):
228228

229229
```shell
230-
git-po-helper check-po po/XX.po
231-
git-po-helper check-commits <rev-list-opts>
230+
git-po-helper check-po --pot-file=build po/XX.po
231+
git-po-helper check-commits --pot-file=build <rev-list-opts>
232232
```
233233

234234

@@ -430,7 +430,7 @@ There are some conventions that l10n contributors must follow:
430430
your commit:
431431

432432
```shell
433-
git-po-helper check-po <XX.po>
433+
git-po-helper check-po --pot-file=build <XX.po>
434434
```
435435

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

0 commit comments

Comments
 (0)