-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Translator] Add comments when dumping po files #30909
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I like this PR. Thank you Just and FYI: In xliff we have We maybe should have 4 standard thing keys that are shared over all dumpers/loaders. |
Looks like the tests are broken by the features introduced in this PR. @deguif Can you have a look? |
Please don't merge, I will rebase it once #30919 will get merged. |
This PR was merged into the 3.4 branch. Discussion ---------- [Translator] Fix wrong dump for PO files | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | When working on #30909 I encountered this bug. Currently the tests were passing, because the po fixture file contained only one translation. Commits ------- b54abfc Fix wrong dump for PO files
@deguif You can rebase this one now. |
@fabpot this should be mergeable, test failures are not related. |
Thank you @deguif. |
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
This PR was merged into the 4.3-dev branch. Discussion ---------- [Translator] Add sources when dumping qt files | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | This PR implements similar functionality as #30909, but for Qt files. Currently, only the Qt element `location` is supported, so only `sources` metadata is included in the dump. Commits ------- ff7577d Add sources when dumping qt files
…php files (Stadly) This PR was squashed before being merged into the 4.3-dev branch (closes #31249). Discussion ---------- [Translator] Set sources when extracting strings from php files | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Set metadata about filenames and line numbers when extracting translatable strings from php files. This PR complements #30909 and #31248, as those PRs implement support for dumping the filenames and line numbers to Po and Qt file formats. Commits ------- f05d4e4 [Translator] Set sources when extracting strings from php files
This code
Will produces this output: