Translations in gadget

Vote:
 

We are developing a a gadget for EPiServer with the aim to publish it through EPiServer nuget feed. When looking into translating texts in the the gadget we started looking into the i18n setup described here http://joelabrahamsson.com/localization-in-widgets-used-as-episerver-gadgets-or-property-editors/

But if we are to pack a xml-file with the translations in the nuget pack can we always put it in the Resources/Languagesfiles? This can be configured i each site differently so how to make sure that the translations are included correctly?

Is there a way to have these files inside the modules/_protected/gadgetfolder instead or how is this kind of things handled in the best way when having it as a nuget package? We tried putting the files in different folders of the module but if the file is not correctly placed the whole edit ui stops working.

#178445
May 11, 2017 8:46
Vote:
 

I will favour Valdis solution for generalization purposes, https://github.com/valdisiljuconoks/LocalizationProvider

/K

#178449
May 11, 2017 9:23
Vote:
 

But it feels a bit wrong to include this whole other plugin to EPiServer just to be able to have translated texts in a widget. The idea is to have this package as selfcontained as possible so that when installing this it would not require more than a specific EPiServer version. Adding dependency to a another plugin might constrain the ability to update this package to support versions of EPiServer that the other plugin might not yet have support for (if that will happen)

#178457
May 11, 2017 11:46
Vote:
 

I would include the xml file as an embedded resource.

If the values has to be modified to site specific values, you could add a new xml-file with the same keys to override the values from the module.

#178459
May 11, 2017 12:23
Vote:
 

Excellent! The embedded resource solution fits very well. After setup like Marijas answer in this thread (https://world.episerver.com/forum/developer-forum/Episerver-7-CMS/Thread-Container/2013/1/Embedded-language-file-for-Add-on/) it works perfectly. Thanks for the input!

#178462
May 11, 2017 12:39
Vote:
 

Happy to help, especially since you are putting it on the nuget feed :-)

#178463
May 11, 2017 12:41
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.