-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[2.1] Load translations by common way (using FilesLocator) #971
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
Comments
hiho! |
@Koc currently we load from (highest priority first):
To me 1 and 2 are equivalent (i.e. you should use one or the other but no make use of the different priorities they have - So the remaining question is where to look for other transaltions: before or after 3 (or should it be configurable) ? |
Imho translations from theme should have possibility override all other translations. Edit: I've tangled with priorities %). |
@Koc could you provide more details on your use case ? Wouldn't your theme be a bundle ? |
If it would be a bundle we should register it after all other bundles for overridion translations. But there is other situation: 2 themes with different translations (after compilation we got compiled translations only for one theme). It looks harder than I've thinked, |
@Koc is it a real life use case for two themes with different translations? |
I do have one use, I have a component which provides some translations. I did came up with a "better" solution, which to use the Filesystem::mirror() for copying the translations files using Bundle::boot() but its still a hack. For themes I'd rather use custom Translator, which falls back to the default when there is no translations available. Mainly because a theme can change at any time, and you'd don't want perform the cache warming again :) |
… translation loading paths (Seldaek) This PR was squashed before being merged into the 2.8 branch (closes #14561). Discussion ---------- [FrameworkBundle][DX] Add option to specify additional translation loading paths | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #971 | License | MIT | Doc PR | TODO Thanks to this PR, next time I want to just do: ``` translator: fallback: "%locale%" paths: ['%kernel.root_dir%/../vendor/internal/package/translations'] ``` I will be able to, and won't have to dig in docs, start building a translation loader before I realize it's not what I want, dig in the framework ext, and then have to write a compiler pass to inject my file to the translator resource paths. Commits ------- bba0a25 [FrameworkBundle][DX] Add option to specify additional translation loading paths
Now paths to files with translations adds when container compiles https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php#L407 . Sometimes needed change way to locate translation file, for example when there are themes, wich can override translations from bundle.
The text was updated successfully, but these errors were encountered: