Skip to main content
Home  › ... Razor

CmsContext Tutorials

Tutorial HomeCmsContext

Interface ICmsCulture

With this object you can get general information about the culture.

Output

The .CurrentCode attribute:

The current code culture is: en-us
<h3>The .CurrentCode attribute:</h3>
The current code culture is: 
<strong>
  @CmsContext.Culture.CurrentCode
</strong>

Output

The .DefaultCode attribute:

The default culture for the system is: en-us
<h3>The .DefaultCode attribute:</h3>
The default culture for the system is: 
<strong>
  @if (Text.Has(CmsContext.Culture.DefaultCode)) {
  @CmsContext.Culture.DefaultCode
  } else {
  <p>
    The system is single language and the response is an empty string.
  </p>}
</strong>

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.Razor14
@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>
    </div>
  </div>

  <h3>The .CurrentCode attribute:</h3>
  The current code culture is: 
  <strong>
    @CmsContext.Culture.CurrentCode
  </strong>


  <h3>The .DefaultCode attribute:</h3>
  The default culture for the system is: 
  <strong>
    @if (Text.Has(CmsContext.Culture.DefaultCode)) {
    @CmsContext.Culture.DefaultCode
    } else {
    <p>
      The system is single language and the response is an empty string.
    </p>}
  </strong>


@* Footer *@
@Html.Partial("../Shared/Layout/FooterWithSource.cshtml", new { Sys = Sys })