Multilingual support in Kentico CMS Martin Hejtmanek CTO Kentico Software s.r.o. martinh@kentico.com http://devnet.kentico.com/Blogs/MartinHejtmanek.aspx Agenda 1) How to configure multilingual site 2) Default culture and combine options 3) Managing multilingual content 4) Displaying multilingual content 5) Multilingual URLs and aliases 6) How the content is stored in the database 7) Resource strings and localization How to configure multilingual • Every web site is multilingual by default – It only has a single language allowed • Just allow additional cultures • Choose the default language – In site properties • And translate the content in CMSDesk Default culture / Combine • Default culture = main web site language • Combine with default culture (Settings) – When enabled, all non-translated documents are available from default culture = partially translated web site with complete content CZ, combine = HOME (CZ) Products (CZ) Disclaimer (EN) – When disabled, only translated documents are available CZ, not Products (CZ) = HOME (CZ) = combine no cross-language content Managing the content • With multiple cultures, CMSDesk provides culture selector (switches the language context) • Content tree always displays all documents – Even non-translated ones, priority: Current culture -> Default culture -> Any other culture • Editor switches between languages – Gets reported when the translation is missing Not translated – Can copy content from another language Displaying the content • By default, all web controls use current culture • You can configure the culture in control properties • Priorities of languages – Specific culture – Default culture (only with combine) – Any other first found culture (only for all option, nondeterministic) • ##ALL## or TreeProvider.ALL_CULTURES = All languages • ALL + Combine = Specific -> Default -> Any – 1 language per document • ALL + Not combine = All cultures of all documents Multilingual URLs and aliases • Node alias path (default document alias) – Same for all cultures, culture presented is based on the cookie value • Document URL path (main document URL if defined) – Specific per culture, specific URL targets specific culture • Document aliases – Alias for all cultures, culture is presented based on the cookie value – Alias for specific culture, specific alias targets specific culture • Priority of URLs – URL path – Node alias path – Aliases How the content is stored • Document joined from several tables (TreeNode class) – CMS_Tree – Location in the tree and basic cultureinvariant properties – CMS_Document – Culture specific properties – Coupled table – Custom fields from table defined on document type creation – COM_SKU – If a product is available for the document from E-commerce COM_SKU CMS_Tree CMS_Document CONTENT_News One language (same product for all culture versions of the document) TreeNode CMS_Document All language versions CONTENT_News Resource strings / localization • Administration UI – Always based Preferred UI culture of the user • Live site UI – Always based on current visitor culture (matching the culture of the content) • For RTL languages, the RTL class is added to the <body> tag • Resource strings – In SQL DB – Manage from admin UI – In ~/CMSResources/*[.<culturecode>].resx – http://www.kentico.com/Download/LocalizationPacks.aspx • When the resource string in particular culture is not found, default language is displayed Using localization • API – ResHelper.GetString(keyName) • Localization macros - {$keyName$} • In-place localization macros – {$=Hello|cscz=Ahoj$} • Localized transformations – Either use localization API or define localized transformation – cms.news.default – cms.news.default_cs-cz – Specific transformation for Czech Questions & Answers • Now is the time for your Q&A http://www.kentico.com http://devnet.kentico.com