120 likes | 376 Vues
Multilingual support in Kentico CMS. Martin Hejtmanek CTO Kentico Software s.r.o . martinh@kentico.com http://devnet.kentico.com/Blogs/Martin-Hejtmanek.aspx. Agenda. How to configure multilingual site Default culture and combine options Managing multilingual content
E N D
Multilingual support in Kentico CMS Martin Hejtmanek CTO Kentico Software s.r.o.martinh@kentico.comhttp://devnet.kentico.com/Blogs/Martin-Hejtmanek.aspx
Agenda • How to configure multilingual site • Default culture and combine options • Managing multilingual content • Displaying multilingual content • Multilingual URLs and aliases • How the content is stored in the database • 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 • When disabled, only translated documents are available = no cross-language content CZ, combine HOME (CZ) Products (CZ) Disclaimer (EN) = CZ, not combine HOME (CZ) Products (CZ) =
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 • Can copy content from another language Not translated
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 • All languages per document
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 culture-invariant 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 (same product for all culture versions of the document) COM_SKU CMS_Tree CMS_Document CONTENT_News One language TreeNode CMS_Document CONTENT_News All language versions
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/Localization-Packs.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|cs-cz=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