In the mean time series (part 6): "Products" module - simple implementation with enabled localization

In the mean time series (part 6): "Products" module - simple implementation with enabled localization

November 11, 2008 0 Comments

The content you're reading is getting on in years
This post is on the older side and its content may be out of date.
Be sure to visit our blogs homepage for our latest news, updates and information.

Once again, I will post a ridiculously short and simple post. In this post I will demonstrate how to enable localization on products module. The idea is, of course, that we can have different versions of products depending on the culture/language end user selected.

NOTE #1: Since this post is a part of the sequential series, at the very least, you should read the introductory post and set up the project as it was explained there.

NOTE #2: Localization feature is not available in the Sitefinity Community version.

Enabling localization on products module

In order to enable localization on products module, we will have to do two things:

  • Enable localization for the site itself
  • Enable localization for the products module

To enable localization for the site, open your web.config file and navigate to the following element:

telerik/localization

and change the persistenceMode to PathPrefix (any value other than none, will turn on the localization). While at the topic, let me segue to the list of possible values for the PersistanceMode property (NOTE: this list applies only to Sitefinity 3.5 and higher):

  • None – Localization is disabled.
  • PathPrefix - The language code is inserted as folder in the URL right after application root.
  • QueryString - The language code is appended in the query string of the request.
  • BrowserSettings - Language code is not explicitly persisted and always the first match from browser preferred languages is used. AutoSetClientLanguage property must be true when this mode is selected.
  • DomainName - The language is set per domain. This option could be used when you have different language versions and different domain for every language version. For instance the site has English and German versions, two domains could be used: myENsite.com and myGERsite.com.
  • DomainExtension - The language code comes from the top level domain, if it is a country domain (.uk, .it, .es...), otherwise the default language is used.

So, the localization element with enabled localization for site, English as default language and English and Croatian as supported languages would look like this:

<localization defaultProvider="Sitefinity" persistenceMode="PathPrefix" defaultCulture="en" cultures="en, hr"
The, second thing we need to do is to enable localization for our products module. To do so, we will need to set the allowLocalization property to true in products provider. Navigate to

telerik/cmsEngine/providers


element in web.config and make sure that this line has allowLocalization property set to true:
<add name="Products" allowLocalization="true" allowWorkflow="true" urlRewriteFormat="[Name].aspx" urlWhitespaceChar="_" visible="False" defaultMetaField="Name" securityProviderName="" allowVersioning="False" applicationName="/Products" versioningProviderName="" commentsModeration="true" connectionStringName="GenericContentConnection" type="Telerik.Cms.Engine.Data.Providers.DefaultProvider, Telerik.Cms.Engine.Data" /> 
And you are done. You will be able to localize your products from now on.

The code for this sample you can download from here.
progress-logo

The Progress Guys

View all posts from The Progress Guys on the Progress blog. Connect with us about all things application development and deployment, data integration and digital business.

Comments
Comments are disabled in preview mode.
Topics
 
 
Latest Stories in
Your Inbox
Subscribe
More From Progress
d12fcc0bdb669b804e7f71198c9619a7
5 Questions Automakers Should Ask to Improve Asset Uptime
Download Whitepaper
 
SF_MQ_WCM
2018 Gartner Magic Quadrant Web Content Management (WCM)
Download Whitepaper
 
What-Serverless-Means-For-Enterprice-Apps-Kinvey
What Serverless Means for Enterprise Apps
Watch Webinar