symfony-bundle icon indicating copy to clipboard operation
symfony-bundle copied to clipboard

Feature Request: Option to skip source-file information

Open arneee opened this issue 4 years ago • 2 comments

Hi,

it would be great if the file-source item in the translation file could be skipped by the extract command. Maybe make it configurable via the translation.yaml.

Background: When changing translations, I like to review all changes in the xliff files before committing them to git. The problem is that if I've been working on same pages and files, the changeset is always huge since a lot of line numbers change. That makes it really hard to see what translations were added, removed or changed.

I don't have any use for the file-source information.

arneee avatar Mar 15 '20 20:03 arneee

Hi @arneee I think this could be linked to #404 maybe?

Some huge changes are planned in php-translation foundation in order to fix a bunch of bugs at the same time, including #404. I let your issue open for now and we'll see later if it's still a needed change.

odolbeau avatar Mar 16 '20 09:03 odolbeau

We've been struggling with this for a few years, too. It's a huge pain for code reviews, merge requests, merge conflicts, etc... We do not have any use for the information as well, because we follow file and key naming conventions that give enough context.

Quick Tip: we added a bash command as a pre-commit hook:

sed -i '/category="file-source"/d' $(find translations -name '*.xlf')

This will remove any line that contains category="file-source". If you want to go even further and strip all notes:

sed -i '/<\/\?notes\?/d' $(find translations -name '*.xlf')

Remember to stage the changes again so that they will be part of the commit:

git update-index --again

barthy-koeln avatar Nov 17 '20 09:11 barthy-koeln