SlideShare a Scribd company logo
Sitecore MVC Forms
Localization
About
Tobias Studer

Senior Application Engineer @ Unic

@studert
Kevin Brechbühl

Senior Application Architect @ Unic

Sitecore Technology MVP 2015

@aquasonic

Blog: http://ctor.io
Agenda
• ASP.NET MVC Forms Translations
• Localization with Sitecore
• DisplayNames with Sitecore
• Serverside Validation with Sitecore
• Clientside Validation with Sitecore
• Summary
• Q&A
ASP.NET MVC Forms
Translations
• View Models with Data Annotations
• Define label with [Display]
• Define validators with e.g. [Required]
• Ways of translations
• Default validation message or property name
• Statically set a message/name
• Use .NET resource files for translation
<Talk code to me>
Localization with Sitecore
• Sitecore Dictionaries
• Key/Phrase pair as a Sitecore item
• Translate.Text(string key)
DisplayNames with Sitecore
• Ways of translations
• Pass translation to @Html.LabelFor(…)
• Create a custom attribute
• Create a custom ModelMetadataProvider
<Talk code to me>
Serverside Validation with
Sitecore
• Using custom attribute
• Use a custom attribute for each validator
• Inherit from the default ValidationAttribute
• Override: FormatErrorMessage()
• Pros: Supports placeholders and default .NET messages
• Cons: Own class for each validator
<Talk code to me>
Clientside Validation with
Sitecore
• Create custom adapters
• Register them on startup
• Add JavaScript dependencies

Microsoft.jQuery.Unobtrusive.Validation

jQuery.Validation

jQuery
<Talk code to me>
But wait, isn’t
there…
Yes, there is!
The Ultimate Solution
• Add serverside translations to your
custom adapters
• Override: Validate()
• Replace ModelValidationResult
message
<Talk code to me>
Summary
• Create a ModelMetadataProvider to
translate labels
• Create DataAnnotationsModelValidators
to translate validation errors on the client and
the server
• Create ValidationAttributes if you need
custom validation which support placeholders
to translate validation errors
Resources
https://github.com/SUGCH/SitecoreMVCFormsLocalization
Q&A
Thank y u

More Related Content

What's hot

What's hot (20)

Getting Started With the TFS Object Model
Getting Started With the TFS Object ModelGetting Started With the TFS Object Model
Getting Started With the TFS Object Model
 
Cf ppt vsr
Cf ppt vsrCf ppt vsr
Cf ppt vsr
 
sell idea
sell ideasell idea
sell idea
 
SPSNL16 - Building Office 365 and SharePoint solutions using modern developer...
SPSNL16 - Building Office 365 and SharePoint solutions using modern developer...SPSNL16 - Building Office 365 and SharePoint solutions using modern developer...
SPSNL16 - Building Office 365 and SharePoint solutions using modern developer...
 
Sitecore MVC: What it is and why it's important
Sitecore MVC: What it is and why it's importantSitecore MVC: What it is and why it's important
Sitecore MVC: What it is and why it's important
 
Building solutions with the Office Graph (Unity Connect Amsterdam 2015)
Building solutions with the Office Graph (Unity Connect Amsterdam 2015)Building solutions with the Office Graph (Unity Connect Amsterdam 2015)
Building solutions with the Office Graph (Unity Connect Amsterdam 2015)
 
London React August - GraphQL at The Financial Times - Viktor Charypar
London React August - GraphQL at The Financial Times - Viktor CharyparLondon React August - GraphQL at The Financial Times - Viktor Charypar
London React August - GraphQL at The Financial Times - Viktor Charypar
 
Serverless Computing With Azure Functions
Serverless Computing With Azure FunctionsServerless Computing With Azure Functions
Serverless Computing With Azure Functions
 
«The Grail: React based Isomorph apps framework»​
«The Grail: React based Isomorph apps framework»​«The Grail: React based Isomorph apps framework»​
«The Grail: React based Isomorph apps framework»​
 
Introduction to BreezeJs
Introduction to BreezeJsIntroduction to BreezeJs
Introduction to BreezeJs
 
Apps for SharePoint 2013
Apps for SharePoint 2013Apps for SharePoint 2013
Apps for SharePoint 2013
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVC
 
Continuous Delivery is Not a Commodity
Continuous Delivery is Not a CommodityContinuous Delivery is Not a Commodity
Continuous Delivery is Not a Commodity
 
Forge - DevCon 2016: Developing & Deploying Secure, Scalable Applications on ...
Forge - DevCon 2016: Developing & Deploying Secure, Scalable Applications on ...Forge - DevCon 2016: Developing & Deploying Secure, Scalable Applications on ...
Forge - DevCon 2016: Developing & Deploying Secure, Scalable Applications on ...
 
«I knew there had to be a better way to build mobile app»​
«I knew there had to be a better way to build mobile app»​«I knew there had to be a better way to build mobile app»​
«I knew there had to be a better way to build mobile app»​
 
Come riprogettare le attuali farm solution di share point con il nuovo modell...
Come riprogettare le attuali farm solution di share point con il nuovo modell...Come riprogettare le attuali farm solution di share point con il nuovo modell...
Come riprogettare le attuali farm solution di share point con il nuovo modell...
 
MSDN Sessions 032817 - Azure Functions
MSDN Sessions 032817 - Azure FunctionsMSDN Sessions 032817 - Azure Functions
MSDN Sessions 032817 - Azure Functions
 
7 Cool Things to Demo in Acumatica 5.0
7 Cool Things to Demo in Acumatica 5.07 Cool Things to Demo in Acumatica 5.0
7 Cool Things to Demo in Acumatica 5.0
 
Scribe insight 05 dynamics ax
Scribe insight 05   dynamics axScribe insight 05   dynamics ax
Scribe insight 05 dynamics ax
 
Apps for SharePoint
Apps for SharePointApps for SharePoint
Apps for SharePoint
 

Similar to Sitecore MVC Forms Localization

SharePoint Saturday The Conference DC - How the client object model saved the...
SharePoint Saturday The Conference DC - How the client object model saved the...SharePoint Saturday The Conference DC - How the client object model saved the...
SharePoint Saturday The Conference DC - How the client object model saved the...
Liam Cleary [MVP]
 
From server generated pages to client app in a micro-services world
From server generated pages to client app in a micro-services worldFrom server generated pages to client app in a micro-services world
From server generated pages to client app in a micro-services world
Assaf Gannon
 

Similar to Sitecore MVC Forms Localization (20)

Entity framework core v3 from sql to no sql
Entity framework core v3 from sql to no sqlEntity framework core v3 from sql to no sql
Entity framework core v3 from sql to no sql
 
Sitecore MVC Advanced
Sitecore MVC AdvancedSitecore MVC Advanced
Sitecore MVC Advanced
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVC Introduction to ASP.NET MVC
Introduction to ASP.NET MVC
 
ASP.NET MVC 3
ASP.NET MVC 3ASP.NET MVC 3
ASP.NET MVC 3
 
09 Asp.Net MVC Data Validation.pptx
09 Asp.Net MVC Data Validation.pptx09 Asp.Net MVC Data Validation.pptx
09 Asp.Net MVC Data Validation.pptx
 
Mvc4
Mvc4Mvc4
Mvc4
 
SharePoint Saturday The Conference DC - How the client object model saved the...
SharePoint Saturday The Conference DC - How the client object model saved the...SharePoint Saturday The Conference DC - How the client object model saved the...
SharePoint Saturday The Conference DC - How the client object model saved the...
 
Blazor certification training - Dot Net Tricks
Blazor certification training - Dot Net TricksBlazor certification training - Dot Net Tricks
Blazor certification training - Dot Net Tricks
 
Asp.Net MVC 5 in Arabic
Asp.Net MVC 5 in ArabicAsp.Net MVC 5 in Arabic
Asp.Net MVC 5 in Arabic
 
Become a Full Stack Web Developer (.NET) - Thisiswali
Become a Full Stack Web Developer (.NET) - ThisiswaliBecome a Full Stack Web Developer (.NET) - Thisiswali
Become a Full Stack Web Developer (.NET) - Thisiswali
 
Migrate an Existing Application to Microsoft Azure
Migrate an Existing Application to Microsoft AzureMigrate an Existing Application to Microsoft Azure
Migrate an Existing Application to Microsoft Azure
 
Mvc fundamental
Mvc fundamentalMvc fundamental
Mvc fundamental
 
Sharepoint 2010 content
Sharepoint 2010 contentSharepoint 2010 content
Sharepoint 2010 content
 
ASP.NET MVC 4
ASP.NET MVC 4ASP.NET MVC 4
ASP.NET MVC 4
 
From server generated pages to client app in a micro-services world
From server generated pages to client app in a micro-services worldFrom server generated pages to client app in a micro-services world
From server generated pages to client app in a micro-services world
 
Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013
 
Sitecore mvc
Sitecore mvcSitecore mvc
Sitecore mvc
 
2011 NetUG HH: ASP.NET MVC & HTML 5
2011 NetUG HH: ASP.NET MVC & HTML 52011 NetUG HH: ASP.NET MVC & HTML 5
2011 NetUG HH: ASP.NET MVC & HTML 5
 
Azure Functions Real World Examples
Azure Functions Real World Examples Azure Functions Real World Examples
Azure Functions Real World Examples
 
Appcelerator Alloy Deep Dive - tiTokyo 2013
Appcelerator Alloy Deep Dive - tiTokyo 2013Appcelerator Alloy Deep Dive - tiTokyo 2013
Appcelerator Alloy Deep Dive - tiTokyo 2013
 

Recently uploaded

Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Peter Udo Diehl
 

Recently uploaded (20)

To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
НАДІЯ ФЕДЮШКО БАЦ «Професійне зростання QA спеціаліста»
НАДІЯ ФЕДЮШКО БАЦ  «Професійне зростання QA спеціаліста»НАДІЯ ФЕДЮШКО БАЦ  «Професійне зростання QA спеціаліста»
НАДІЯ ФЕДЮШКО БАЦ «Професійне зростання QA спеціаліста»
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 

Sitecore MVC Forms Localization