Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:masterfromdeguif:issue-29962
Apr 6, 2019

Conversation

@deguif
Copy link
Contributor

@deguifdeguif commentedApr 6, 2019
edited
Loading

QA
Branch?master
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass??
Fixed tickets#29962
LicenseMIT
Doc PR

This code

$catalogue =newMessageCatalogue('fr');$dumper =newPoFileDumper();$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_1msgid "key.one"msgstr "First key"# Comment 1# Comment 2#, fuzzy,another#: src/file_1 src/file_2msgid "key.second"msgstr "Second key"

ndavoust reacted with thumbs up emoji
@lyrixxlyrixx changed the titleAdd comments when dumping po files[Translator] Add comments when dumping po filesApr 6, 2019
@Nyholm
Copy link
Member

I like this PR. Thank you
👍


Just and FYI:

In xliff we havenotes andtarget-attributes. Here we introducesources,comments andflags.

We maybe should have 4 standard thing keys that are shared over all dumpers/loaders.

@fabpot
Copy link
Member

Looks like the tests are broken by the features introduced in this PR.@deguif Can you have a look?

@deguif
Copy link
ContributorAuthor

Please don't merge, I will rebase it once#30919 will get merged.

fabpot added a commit that referenced this pull requestApr 6, 2019
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
@fabpot
Copy link
Member

@deguif You can rebase this one now.

@deguif
Copy link
ContributorAuthor

@fabpot this should be mergeable, test failures are not related.

@fabpot
Copy link
Member

Thank you@deguif.

@fabpotfabpot merged commit31b3a55 intosymfony:masterApr 6, 2019
fabpot added a commit that referenced this pull requestApr 6, 2019
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_1msgid "key.one"msgstr "First key"# Comment 1# Comment 2#, fuzzy,another#: src/file_1 src/file_2msgid "key.second"msgstr "Second key"```Commits-------31b3a55 Add comments when dumping po files
@nicolas-grekasnicolas-grekas added this to thenext milestoneApr 6, 2019
fabpot added a commit that referenced this pull requestApr 29, 2019
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
@nicolas-grekasnicolas-grekas modified the milestones:next,4.3Apr 30, 2019
fabpot added a commit that referenced this pull requestMay 7, 2019
…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
@fabpotfabpot mentioned this pull requestMay 9, 2019
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

4.3

Development

Successfully merging this pull request may close these issues.

6 participants

@deguif@Nyholm@fabpot@nicolas-grekas@lyrixx@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp