Custom localized strings in widget

Vote:
 

I have created a widget for edit-mode using this guide: http://tedgustaf.com/blog/2014/6/create-an-episerver-widget-for-edit-mode/. The widget is deployed as a module to appdata/Modules along with a set of aspx pages. The widget contains a button that opens one of the aspx pages.

In accordance to the guide, I have created a language file, which is located in appdata/Modules/MyWidget/Resources/LanguageFiles. Like in the guide, the language file contains a "title" tag which is displayed as the header to the widget. This works! Now I would like to use LocalizationService.Current.GetString() from the aspx page (opened from the button) to display localized strings. I have added a localized string to the language file, but can't get it to work. I have tried placing the string in different places with no luck. Currently my language file looks like:



  
    
      
        My title
        
            Some text
        
      
    
  

With this file, both LocalizationService.Current.GetString("/gadgets/MyWidget/dialogs/mystring") and LocalizationService.Current.GetString("/dialogs/mystring") won't work.

What is the correct place for the custom localized string in my language file and how do I refer to it? I have tried listing all strings with LocalizationService.Current.GetAllStrings() but no matter where I place the string in the file, "myString" is not among them.

#121123
May 02, 2015 12:40
Vote:
 

Instead of keeping the language file in appdata/Modules/MyWidget/Resources/LanguageFiles, I moved it to wwwroot/Resources/LanguageFiles. Now I am able to get the translated strings by LocalizationService.Current.GetString("/gadgets/MyWidget/dialogs/mystring"). I don't like that the language files for my module will have to be copied this folder, though. It should be separated from the main EPiServer functionality (a.k.a. what is found under wwwroot). Is there a way to keep it separate?

#121375
May 07, 2015 15:51
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.