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
I was following the example and wondered why my IDE did not have any reference of the method setTranslatableLocale, I expected it to be declared in Gedmo\Translatable\Translatable. Indeed, the interface is empty and says // use now annotations instead of predefined methods, this interface is not necessary.
I find the interface and method definition necessary, because I don't want to have methods in my code which are required for a 3rd-party package, but have no contact the that package.
I find, the Idea to have the translatable feature is to have at minimum 2 languages, to translate from one to another language. Because of that, I find it unnecessary to fall back to a default locale when not using setTranslatableLocale (example), because we normally want to translate something, so we need the method anyway.
My suggestion is to add setTranslatableLocale to Gedmo\Translatable\Translatable.
The text was updated successfully, but these errors were encountered:
Each of the extensions has marker interfaces to identify objects in your application that use a feature, but it's not a requirement for your application to use any of those interfaces. Aside from some union object|MarkerInterfaces types in doc blocks, those marker interfaces are unused. Most of how this library works actually comes from the extended mapping metadata (be it annotations, attributes, or XML) and using that to handle things at runtime (looking at that example, the Article::setTranslatableLocale() method is really there for your application's use, but the library is going to use whatever field you've got the #[Gedmo\Locale] attribute set to when it needs to grab that value).
You're welcome to design interfaces for your own application's use that suit your needs, but changing those marker interfaces to have a required implementation would be a major design change in how this library is used.
@mbabker Indeed I already noticed that it works without implementing Gedmo\Translatable\Translatable to the entity, by only using attributes. But the example in the main branch is implementing the interface.
In that case may I suggest to let cleanup the example to leave out implements Translatable? This would have saved me experimentation and testing time.
(Of course maybe most people don't bother having extra boilerplate code which is not needed, but for those who want clean code, it would be nice.)
I was following the example and wondered why my IDE did not have any reference of the method
setTranslatableLocale
, I expected it to be declared inGedmo\Translatable\Translatable
. Indeed, the interface is empty and says// use now annotations instead of predefined methods, this interface is not necessary
.I find the interface and method definition necessary, because I don't want to have methods in my code which are required for a 3rd-party package, but have no contact the that package.
I find, the Idea to have the translatable feature is to have at minimum 2 languages, to translate from one to another language. Because of that, I find it unnecessary to fall back to a default locale when not using
setTranslatableLocale
(example), because we normally want to translate something, so we need the method anyway.My suggestion is to add
setTranslatableLocale
toGedmo\Translatable\Translatable
.The text was updated successfully, but these errors were encountered: