Subject: Re: [RFC PATCH 1/2] l10n: add .gitattributes to simplify location filtering

From: Junio C Hamano <[email-masked]>
Date: Thu, 05 Feb 2026 12:07:57 -0800

Jiang Xin <[email-masked]> writes:

> To simplify the location filtering process for l10n contributors when
> committing po/XX.po files, add the filter attributes for .po files to
> the repository. This ensures all contributors automatically get the
> same filter configuration without manual setup in .git/info/attributes.
>
> Contributors still need to manually define the filter drivers using
> git-config as documented in po/README.md.
>
> Signed-off-by: Jiang Xin <[email-masked]>
> ---
>  po/.gitattributes | 37 +++++++++++++++++++++++++++++++++++++
>  po/README.md      | 19 +++++++++++--------
>  2 files changed, 48 insertions(+), 8 deletions(-)
>  create mode 100644 po/.gitattributes

OK.  It is slightly sad that two camps cannot agree on a single
filter, which may allow us to just do

	*.po	filter=one-single-filter-agreed-upon

but I guess this is a good start.  And having sample configuration
lines that can readily be cut-and-pasted to help the contributors is
very good.

> +The filter configuration is defined in the "po/.gitattributes" file.
> +
> +Then define the driver for the filter. Most languages use the
> +"gettext-no-file-no-location" clean filter, which strips out both filenames and
> +locations from the comments. To set this up, run the following command:
>  
>  ```shell
> -git config --global filter.gettext-no-location.clean \
> +git config --global filter.gettext-no-file-no-location.clean \
>             "msgcat --no-location -"
>  ```
>  
> -For users who have gettext version 0.20 or higher, it is also possible
> -to define a clean filter to preserve filenames but not locations:
> +Some languages use the "gettext-no-location" clean filter, which preserves
> +filenames but not locations. For these, install gettext version 0.20 or higher
> +and setup the driver as below:
>  
>  ```shell
>  git config --global filter.gettext-no-location.clean \