8000 Extracted the API of the Translation component into symfony/api by webmozart · Pull Request #6189 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Extracted the API of the Translation component into symfony/api #6189

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

webmozart
Copy link
Contributor

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: partially #6129
Todo: -
License of the code: MIT
Documentation PR: TODO

This PR implements the change suggested in #6129 for the Translation component. I think we should apply this change component by component so that we don't end up with one massive PR.

@stof
Copy link
Member
stof commented Dec 4, 2012

I still see an issue if we use a single package with the whole API: a package depending on the public interface of the Translation component would then dpeend on symfony/api instead of symfony/translation, which does not give any information about which part of the API it actually requires (and does not force composer to install an implementation of this api)

@webmozart
Copy link
Contributor Author

@stof First I thought the same. But in reality, if a package is only coupled to the interface, it does not depend on one specific implementation. We can take various approaches in this situation (even all of them):

  1. provide a very simplistic default implementation (like DefaultTranslator in the Validator component in [Validator] Integrated the Translator in the Validator component #6137)
  2. add our implementation (e.g. symfony/translation) to the composer section "suggest"

What you are pointing out is only relevant for people that use the components stand-alone. 1. allows these people to not even load the second component, if not needed. 2. tells them which implementation they may use, but leaves them the choice.

@stof
Copy link
Member
stof commented Dec 5, 2012

@bschussek Indeed it does not depend on a particular implementation. But it may require getting one implementation (it can be a required dependency to an interface). And you would still need to know which part of the API is used.

Actually, the way PHPCR uses the composer features is the best way to make composer handle most of the work:

{
    "name": "symfony/translation-api"
}
{
    "name": "symfony/translation",
    "require": {
        "symfony/translation-api": "2.2.*"
    },
    "provide": {
        "symfony/translation-implementation": "self.version"
    }
}
{
    "name": "behat/behat",
    "require": {
        "symfony/translation-implementation": "2.2.*"
    }
}

And then, another package providing a implementation of the translation api would mark it provides the symfony/translation-implementation package, so that composer can know that the requirement is fulfilled.

@stof
Copy link
Member
stof commented Dec 5, 2012

actually, we can even achieve it with a single symfony/api package for the interfaces as the repo shipping the interfaces does not need to depend on implementations

@webmozart
Copy link
Contributor Author

@stof I agree that this would be a good solution. Nevertheless, we need feedback from @fabpot, otherwise any further work is potentially worthless.

@fabpot
Copy link
Member
fabpot commented Mar 25, 2013

Closing this PR as I think we have enough on our plate for the 2.x series. This should be something we might revisit for Symfony 3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0