From 2a0f0bcd19e8b25c55e724e9b171933fb220c953 Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Thu, 13 Oct 2022 23:08:52 +0200 Subject: [PATCH] lang: Add git diff filter instructions for po files --- .gitattributes | 3 ++- lang/README.md | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.gitattributes b/.gitattributes index 29fc24623..70b033a98 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,2 @@ -lang/po/*.po text eol=crlf +lang/po/*.po text eol=crlf diff=po +lang/po/*.pot text diff=po diff --git a/lang/README.md b/lang/README.md index 0e1a474a7..e3fdfa0cc 100644 --- a/lang/README.md +++ b/lang/README.md @@ -91,6 +91,19 @@ The new language needs to be explicitly added to the list of bundled languages i At this point the new language should be picked-up normally. See [how to build an internationalized firmware](#building-an-internationalized-firmware) and use ``lang-check.py`` for [previewing the translation](#typo-or-incorrect-translation-in-existing-text) without having to perform a complete rebuild. +### Diffing translations + +po/pot files contain file+line annotations for each translation which are convenient while translating but result in unwieldy diffs. + +To alleviate the problem when using git you can add the following snippet to your ``~/.config/git/config`` or ``~/.gitconfig`` file to automatically remove position changes using the ``msgcat`` utility: + +``` +[diff "po"] + textconv = msgcat --no-location --sort-output +``` + +This requires ``gettext`` to be installed. + ## Internal details TODO