Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
References in PO translation files #29962
The PO translation file format supports references, so that one can easily see where the message is used in the source files. This can be very helpful when translating.
The PoFileDumper does not support references. It would be really nice if this could be implemented.
The format is:
This PR was merged into the 4.3-dev branch. Discussion ---------- [Translator] Add comments when dumping po files | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | ? <!-- please add some, will be required by reviewers --> | Fixed tickets | #29962 | License | MIT | Doc PR | This code ```php $catalogue = new MessageCatalogue('fr'); $dumper = new PoFileDumper(); $catalogue->set('key.one', 'First key', 'custom'); $catalogue->setMetadata('key.one', ['sources' => 'src/file_1', 'comments' => 'Comment', 'flags' => 'fuzzy'], 'custom'); $catalogue->set('key.second', 'Second key', 'custom'); $catalogue->setMetadata('key.second', ['sources' => ['src/file_1', 'src/file_2'], 'comments' => ['Comment 1', 'Comment 2'], 'flags' => ['fuzzy', 'another']], 'custom'); $dumper->dump($catalogue, [ 'path' => 'xxx', ]); ``` Will produces this output: ``` msgid "" msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: fr\n" # Comment #, fuzzy #: src/file_1 msgid "key.one" msgstr "First key" # Comment 1 # Comment 2 #, fuzzy,another #: src/file_1 src/file_2 msgid "key.second" msgstr "Second key" ``` Commits ------- 31b3a55 Add comments when dumping po files