-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle][Translations] Fix translation commands #24590
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
[FrameworkBundle][Translations] Fix translation commands #24590
Conversation
435e87d
to
b81a384
Compare
$transPaths = array($kernel->getRootDir().'/Resources/'); | ||
$transPaths = array( | ||
$kernel->getRootDir().'/Resources/', | ||
$kernel->getProjectDir().'/', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is one problem here. These paths are used to generate views
and translations
folders paths (see L275 & L295). With Flex, views
is renamed by templates
, so translations could be extracted but translation keys used in templates won't be extracted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I propose you a simple solution in PR.
Translation paths are already collected by framework extension. Couldn't we inject them in the command instead of discovering them twice? |
@chalasr I think is a better solution but the current implementation has probably implemented for specific reason. |
@baptistedonaux At time it has been introduced (#10368), a Later, a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -33,7 +33,7 @@ | |||
</service> | |||
|
|||
<service id="translation.loader.yml" class="Symfony\Component\Translation\Loader\YamlFileLoader" public="true"> | |||
<tag name="translation.loader" alias="yml" /> | |||
<tag name="translation.loader" alias="yaml" legacy-alias="yml" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, is that another bugfix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. It allow to find .yml
and .yaml
files for translations. I let this in this PR because I think it is part of the command fix
Hi, thanks for your review. So what needs to be done ? Should I update the code to get the paths from the |
Probably the best way. @chalasr , your opinion ? |
From me this is OK regarding commands, it just looks into |
Search for translations also in the new translations dir at the project root Search for .yaml file as well as .yml
b81a384
to
8278199
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now the %kernel.project_dir%/translations/
dir has been abandoned in favor of (symfony/recipes#249) so this should be updated accordingly, but that's still in discussion in symfony/recipes#253. Let's wait
I should close this PR in favor of #25065, seems to be more updated and better implemented |
Hmm, not sure how right now ... I know 4.0 structure + flex is compatible since 3.3, but the solucion here is a little tricky. IMO 3.4 is a better place to migrate to the new structure as there we have the default paths and the new overriding conventions related to |
Supporting the new directory structure starting from 3.4 makes sense to me. |
So, shall we close this PR? |
Yea, closing in favor of #25065 which is more advanced. |
Fine for me too. What about https://github.com/symfony/symfony/pull/24590/files#diff-ace3ed7f9c8dd7ded3aa562e3c25fa92R36 |
Hi,
I'm not sure about the target branch, but this bug seems to be present since we have the new
translations
directory in the project root.This add the search for a
translations
directory in the project root, and enable to have translations with.yaml
extension, for now only.yml
is working.Please tell me how can I test this.