0
Requested

Remove "Studio" and "Module" from ADAM translations

jeremy.morton 4 years ago in ADAM Core updated by petra.tant 4 years ago 3

The way ADAM currently does translations is confusing and very suboptimal. It routes translations based on "Studio" and "Module", as well as "Name". Therefore, if you want to re-use an existing translation in a new studio, or in an extension to an Action in your own class (and therefore your own namespace), that translation will no longer work and the only way to fix it is to create a new redundant translation for your label.


For example, if you extend "Adam.Web.Extensions.Providers.Actions.Download" and add it to one of the action menus, you will see "Download.Label" as the menu entry text instead of "Download", indicating that because the module has changed, it can no longer pick up the translation for that label.


It would be better if "Studio" and "Module" were removed, making all translations global and allowing any code to use them on "Name" alone. If the translation is studio specific, it could simply be prefixed with "StudioName_" and if it wasn't it wouldn't be.

localization customization configurability

Dear Jeremy,


As I remember the reason for studio and module is to allow optimization for translation caching. Translations are cached. When the cache doesn't contain an item, it will load all translations of the studio and module that the requested translation belongs to. This way one call to the database is done and other translations, that will probably be asked for shortly after, are cached. This should improve performance. I hope the ADAM team will correct me if I'm wrong.

That explains why Studio and Module are important and why I would advise against removing them. But that doesn't help your current issue. The following should:


When overriding the Download action, you might consider overriding the method CreateTranslator (in ActionBase). That reads:

protected virtual Translator CreateTranslator()

{

return Translator.GetAssemblyTranslator(this.GetType(), "Actions");

}

Overriding it to:

protected virtual Translator CreateTranslator()

{

return Translator.GetAssemblyTranslator(typeof(Adam.Web.Extensions.Providers.Actions.Download), "Actions");

}

That should do the trick and prevent you from creating new translations.

Furthermore: a lot of controls have this virtual method. So most controls should allow you to use the original translator.

Next to that, there might also be good reason to actually use different translations ;-)


Hope this helps,

Nik

Seems like it would give a very minor performance boost at best, for the sake of requiring an obscure override to get translations that seem like they should happen automatically.