#2 CmsContext.Culture – Current Language etc.
Requirements
Resources
Interface ICmsCulture
With this object you can get general information about the culture.
On the new RazorPro
it's on MyContext.Culture
.
On the older Razor14
or Razor12
it's on CmsContext.Culture
.
Output
-
.CurrentCode
Current code culture is: en-us -
.DefaultCode
en-us
#2 CmsContext.Culture – Current Language etc.
Source Code of this file
Below you'll see the source code of the file. Note that we're just showing the main part, and hiding some parts of the file which are not relevant for understanding the essentials. Click to expand the code
@inherits Custom.Hybrid.RazorTyped @using ToSic.Razor.Blade; <!-- unimportant stuff, hidden --> <div @Sys.PageParts.InfoWrapper()> @Html.Partial("../shared/DefaultInfoSection.cshtml") <div @Sys.PageParts.InfoIntro()> <h2>Interface ICmsCulture</h2> <p> With this object you can get general information about the culture. </p> <p>On the new <code>RazorPro</code> it's on <code>MyContext.Culture</code>.</p> <p>On the older <code>Razor14</code> or <code>Razor12</code> it's on <code>CmsContext.Culture</code>.</p> </div> </div> <ol> <li> <code>.CurrentCode</code> Current code culture is: <strong>@MyContext.Culture.CurrentCode</strong> </li> <li> <code>.DefaultCode</code> @if (Text.Has(MyContext.Culture.DefaultCode)) { <strong>@MyContext.Culture.DefaultCode</strong> } else { <p> The system is single language and the response is an empty string. </p> } </li> </ol> @* Snippet for the old v14 code, which shouldn't run but should be shown. This is a bit of a hack, but it works <ol> <li> <code>.CurrentCode</code> Current code culture is: <strong>@CmsContext.Culture.CurrentCode</strong> </li> <li> <code>.DefaultCode</code> @if (Text.Has(CmsContext.Culture.DefaultCode)) { <strong>@CmsContext.Culture.DefaultCode</strong> } else { <p> The system is single language and the response is an empty string. </p> } </li> </ol> *@ @* Footer *@ @Html.Partial("../Shared/Layout/FooterWithSource.cshtml", new { Sys = Sys })