mirror of
https://github.com/git/git.git
synced 2026-05-25 11:25:06 +02:00
3a14bcfec8
To simplify the location filtering process for l10n contributors when committing po/XX.po files, add filter attributes for selected PO files to the repository. This ensures all contributors automatically get the same filter configuration without manual setup in .git/info/attributes. The default filter (gettext-no-location) is applied to all .po files except: - Legacy, unmaintained PO files that still contain location comments. Leaving the filter off avoids index vs working-tree discrepancies for these files. The CI pipeline will report an error when future updates touch these legacy files. - Some PO files use a different filter that strips only line numbers from location comments while keeping filenames. Contributors still need to manually define the filter drivers via git-config as documented in po/README.md. Four PO files that use location filtering (po/ca.po, po/es.po, po/ga.po, po/ru.po) were batch-modified so their on-disk format matches the filter output (e.g. line wrapping), avoiding index vs working-tree mismatch. Additionally, po/README.md has been reorganized: the material on preparing location-less PO files for commit has been moved from "Updating a XX.po file" to a separate "Preparing a XX.po file for commit" section. This prevents AI agents from introducing unrelated operations when updating PO files. Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
36 lines
1.3 KiB
Plaintext
36 lines
1.3 KiB
Plaintext
# Git Attributes for PO Files
|
|
#
|
|
# This file configures Git filters to automatically strip location information
|
|
# from PO files when committing, producing cleaner diffs and saving repository
|
|
# space.
|
|
#
|
|
# Two filter types are used:
|
|
# 1. gettext-no-location: Strips both filenames and line numbers
|
|
# (e.g., removes "#: main.c:123" entirely)
|
|
# 2. gettext-no-line-number: Preserves filenames but removes line numbers, which
|
|
# requires gettext 0.20 or higher
|
|
# (e.g., "#: main.c:123" becomes "#: main.c")
|
|
#
|
|
# See `po/README.md` for instructions on setting up the required filter drivers.
|
|
|
|
# Default: Strip the whole location comments for all .po files
|
|
*.po filter=gettext-no-location
|
|
|
|
# Legacy, unmaintained PO files: filter disabled to avoid index vs
|
|
# working-tree mismatch (these files still have location comments).
|
|
el.po -filter
|
|
is.po -filter
|
|
it.po -filter
|
|
ko.po -filter
|
|
pl.po -filter
|
|
pt_PT.po -filter
|
|
|
|
# These files use gettext-no-line-number (keep filenames, strip line
|
|
# numbers). The choice is per l10n team preference. Requires gettext 0.20+.
|
|
# The only benefit is locating source files from location comments when
|
|
# the .po file is not updated from the POT via make po-update.
|
|
ca.po filter=gettext-no-line-number
|
|
id.po filter=gettext-no-line-number
|
|
zh_CN.po filter=gettext-no-line-number
|
|
zh_TW.po filter=gettext-no-line-number
|