Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Translation] added <tool> element metadata to XliffFileDumper #15225

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

Closed
wants to merge 1 commit into from

Conversation

timwhitlock
Copy link

Q A
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #15190
License MIT
Doc PR

'tool-id' => 'symfony',
'tool-name' => get_class($this),
);
$this->toolMeta = array_merge( $required, $meta );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would remove the spaces

@OskarStark
Copy link
Contributor

i like your PR, but can you explain a little bit for what this is useful?

*
* @param array attributes supported by the <tool> element
*/
protected function setToolMetadata( array $meta ){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why making it protected ? IT should be private IMO

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@OskarStark The purpose is for translation software when presented with a file to know that Symfony generated it. Knowing this means the software can process it differently to how it might by default. I could elaborate on that, but in general if a file format provides a generator declaration, I see no reason not to use it. Also other projects using the Translation component may have their own requirement for declaring themselves.

@stof making the method private is fine for the Symfony case, but I was under the impression that Components were supposed to be portable. As shown in the test case, a supposed XliffExtendedFileDumper sets its own tool signature, hence why I made it protected.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@timwhitlock we start with marking methods private and only open them if someone with a good use case asks for it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@timwhitlock making things protected is generally the worse extension point ever (it hurts maintenance a lot because we need to maintain BC on them). It is better to design proper extension point where needed than allowing to hack into the internal logic by exposing it. Inheritance is most of the time not the proper extension point.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tend to agree with @stof, instead of introducing a new method here we can override those value via $options

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per my initial comment I thought the maintainers would prefer to decide on best practice. I'm not experienced in contributing to Symfony, as evidenced by this discussion. If anyone maintaining the Translation component is interested in implementing this properly then great. Either way, feel free to close my PR. I'm afraid I don't have the time to rework it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@timwhitlock no worry, we are here to work together :)

@fabpot
Copy link
Member

fabpot commented Aug 1, 2015

@timwhitlock Can you finish this PR?

@timwhitlock
Copy link
Author

As I said above, I don't have time to rework. I'd close, but unsure of protocol.

@aitboudad
Copy link
Contributor

I can work on it next week

@aitboudad
Copy link
Contributor

closed in favor of #15551

@aitboudad aitboudad closed this Aug 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants