Translation on AdminMenu plugin

Vote:
 

Hello developers!
Hopefully someone can help me with this one. I’ve developed a custom AdminMenu plugin thats uses EPiServers built in language support. It works fine until I change the user interface language to another language then english. Then my plugin doesn’t get translated to the new language, it remains in english. Although all of the standard admin interface is translated correctly. If it matters my plugin is using this solution, http://labs.episerver.com/en/Blogs/Johano/Dates/2008/6/EPiServer-PlugIns-in-one-single-dll/.

What do I need to do so my AdminMenu plugin gets translated? Any guidelines?

#37653
Mar 16, 2010 9:42
Vote:
 

Have you set the Languagepath in the gui plugin attribute and have the lang files set up correctly?

#37687
Mar 16, 2010 15:23
Vote:
 

Hi Per, thanks for your reply.

I dont use LanguagePath in GUIPlugIn. Do I have to?
All my english translations loads perfectly. The lang file is placed in the lang directory.
The problem is that it always loads the english translation.

#37690
Mar 16, 2010 17:03
Vote:
 

Hi

Yes, you need to set LanguagePath. Otherwise we don't know where in the language files to look for translations. If LanguagePath isn't set we will use the DisplayName and Description properties on the plugin attribute in the UI.

Regards

Per Gunsarfs
EPiServer Development Team

#37702
Mar 17, 2010 9:01
Vote:
 

Hmm but there seems to be a bug in the language handling. When I switch langauge from english to swedish the heading (in admin menu) of my plugin changes to the swedish alternative but all labels etc in the actual aspx file is still in english.

If i change the languagepathroot in the langfile for english so it's not correct I get the language error that the path cannot be found for language "en" but Im running swedish.

#37703
Mar 17, 2010 9:23
Vote:
 

Glad that some else have found the same problem, thanks Per.
This is exacly what I ment, it always reads the english translation.

Can someone on EPi confirm that this is a bug? Or provide a solution?

Regards,
Jonas Andersson

#37708
Mar 17, 2010 11:08
Vote:
 

 I've found a solution and its a simple one. To get the translations working correctly I did this.

protected override void OnPreInit(EventArgs e) {

string lang = EPiServerProfile.Current.Language;

UserInterfaceLanguage.Instance.SetCulture(lang);

base.OnPreInit(e);

}

#37710
Edited, Mar 17, 2010 11:20
Vote:
 

Good that you found a solution, although you shouldn't need that code.

Was wondering if it could be because your plugins aren't using our base classes (PageBase or UserControlBase depending on the type). The language detection is done in the base classes, and if you don't inherite from those you'd need to set it up yourself.

Regards

Per Gunsarfs

#37714
Mar 17, 2010 12:24
Vote:
 

Hi Per,
Im inheriting from SystemPageBase, because I want the same look and feel as the rest of the admin interface.
SystemPageBase inherits from PageBase so it cant be that, or could it?

public partial class VideoQueueAdmin : SystemPageBase { ....... }

#37715
Mar 17, 2010 12:51
Vote:
 

Yes, SystemPageBase inherits from PageBase, so that should just fine.

It's strange, because our built in plugins don't do anything magical to get the translation to work, so I can't think of anything else you might have missed. The built in admin plugins translate correctly right?

Regards

Per Gunsarfs

#37717
Mar 17, 2010 12:58
Vote:
 

Hi Per,
Yes everything else in the admin interface translates correctly.

/Jonas

#37719
Mar 17, 2010 13:02