You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By default EasyAdmin uses the EasyAdminBundle translation domain, which provides the translations for all basic UI elements for multiple locales. While this is great, I can not find a way to use another translation than the current defined locale for those "native" UI elements.
What I want to do
My website currently supports multiple locales, but I only want to provide the EasyAdmin bundle in english. I have the following Symfony configuration set up, such that I have English as a fallback for all translations.
I then have a translation file for english (EasyAdminBundle.en.yaml) but for french there is no file, so Symfony falls back to the default - which is en. However the "native" elements (like the edit or create button) keep using the french translation, because this bundle provides some translations for this language.
So is there currently a way to exclude these translations or force EasyAdmin to use a specific language for all translations? Something like the following would be nice.
Using a different translation domain only works for the elements I added manually. EasyAdmin always uses the EasyAdminBundle domain for its own UI elements. For example the following code will not be sufficient:
Providing a locale when calling the translation method
Symfonys translation method provides a parameter for the locale. The problem here is the same as above: while this works well for all my custom translations, EasyAdmin will obviously not use this locale.
I tried to override the TranslatableMessage object, in the hope that the bundle will use my override instead of the original class but this also does not seem to work.
I tried to set up a service, that checks the current locale and changes it for the current request. However this is no suitable, because my other service rely on the locale to be "correctly" set, which would not be the case anymore if I change the locale. I know that in a perfect project I could simply change the locale from lets say fr_FR to en_FR should to the trick, but in my case the locale for the request must be kept as is.
One really ugly option would be to to simply delete the french translation file from my project from vendor/easycorp/easyadmin-bundle/src/Resources/translations/EasyAdminBundle.fr.php. Another option would be to simply copy the content of the english translation file and paste it in a file for fr but this also would be quite ugly and I would really prefer to not do it that way...
Any help or ideas would be really appreciated!
The text was updated successfully, but these errors were encountered:
Short description
By default EasyAdmin uses the
EasyAdminBundle
translation domain, which provides the translations for all basic UI elements for multiple locales. While this is great, I can not find a way to use another translation than the current defined locale for those "native" UI elements.What I want to do
My website currently supports multiple locales, but I only want to provide the EasyAdmin bundle in english. I have the following Symfony configuration set up, such that I have English as a fallback for all translations.
I then have a translation file for english (
EasyAdminBundle.en.yaml
) but for french there is no file, so Symfony falls back to the default - which isen
. However the "native" elements (like the edit or create button) keep using the french translation, because this bundle provides some translations for this language.So is there currently a way to exclude these translations or force EasyAdmin to use a specific language for all translations? Something like the following would be nice.
What does not work/what I tried
Use a different translation domain
Using a different translation domain only works for the elements I added manually. EasyAdmin always uses the
EasyAdminBundle
domain for its own UI elements. For example the following code will not be sufficient:Providing a locale when calling the translation method
Symfonys translation method provides a parameter for the locale. The problem here is the same as above: while this works well for all my custom translations, EasyAdmin will obviously not use this locale.
Overriding the
TranslatableMessage
I tried to override the
TranslatableMessage
object, in the hope that the bundle will use my override instead of the original class but this also does not seem to work.Changing the locale in the request
I tried to set up a service, that checks the current locale and changes it for the current request. However this is no suitable, because my other service rely on the locale to be "correctly" set, which would not be the case anymore if I change the locale. I know that in a perfect project I could simply change the locale from lets say
fr_FR
toen_FR
should to the trick, but in my case the locale for the request must be kept as is.What would work theoretically
One really ugly option would be to to simply delete the french translation file from my project from
vendor/easycorp/easyadmin-bundle/src/Resources/translations/EasyAdminBundle.fr.php
. Another option would be to simply copy the content of the english translation file and paste it in a file forfr
but this also would be quite ugly and I would really prefer to not do it that way...Any help or ideas would be really appreciated!
The text was updated successfully, but these errors were encountered: