Mono Support Language parameter for WebParts 

Viewed 29878 time(s), 5 post(s), 8/20/2014 1:45:43 PM - by Zoomicon
8/20/2014 1:45:44 PM
2793 Reputation 345 Total posts

can a WebPart in a Greek say page take a hardcoded parameter for the language it will use?

e.g. in the blog list page there is a sidebar with recent posts and in non-English pages (can check which ones are non-English by parsing the URL for /lng/xx-XX that is different from /lng/en-US easily, or check the "lng" URL parameter that your rewrite rules use if I've understood correctly from recent discussion we had in this forum) we want to show both the list of recent posts for the localized blog and an extra section under it with the list of recent posts from the English blog

to do that we'd pass a hardcoded language parameter to that WebPart, but is there such a thing?

1
8/27/2014 8:36:13 AM
15993 Reputation 2214 Total posts

Right now all WebParts that are language aware take the current thread language and do the rewriting automatically. You could try to change the functionality of the current WebPart to fix the language or to dynamically switch language depending on your rules.

In order to extend the functionality for e.g. Blog post list you need:

- Inherit from the "~\MonoX\ModuleGallery\Blog\BlogList.ascx"
- override the "Hashtable ParseTemplateTags(BlogEntity blog)" method
- after calling the base.ParseTemplateTags(blog); you need to find the "<# Link #>" tag and amend the URL for that blog post.

Let me know if you need more information regarding the implementation for this WebPart or any other.

Regards

2
9/6/2014 8:51:07 PM
2793 Reputation 345 Total posts

it would be nice if a language (override) parameter was added to your base webpart in the future

3
9/8/2014 10:51:33 AM
2218 Reputation 300 Total posts

Hello Zoomicon,

Can you please post this suggestion to the RoadMap forum so that we can keep a track of all suggestions. Thanks.

Regards

4
9/11/2014 9:57:08 AM
2793 Reputation 345 Total posts

Hi, posted the suggestion regarding the language override parameter for webparts below, together with another related suggestion (on how to include/exclude content from the page based on current language or other state like whether user is logged in or not, or some generic test condition, or combination of more of one checks using AND [with possibly some way to define if you prefer OR or XOR instead])

http://www.mono-software.com/Mono/Pages/Discussion/dtopic/XIBURLpYTUOLOKOjACs3tQ/Language-override-parameter-for-WebParts/

5
This is a demo site for MonoX. Please visit Mono Software for more info.