How to get the locale of a page

This is a community-contributed tutorial.
Jan 8, 2024
  • Get the page object if you don't alredy have it $c = \Page::getByPath("/path/to/page", "ACTIVE");

  • Get the site tree it belongs to $siteTree = \Core::make("site")->getSiteTreeByID($c->getSiteTreeID());

  • Get the tree's locale object with its methods $pageLocaleObject = $siteTree->getLocale();

  • Finally, for the juicy details:

    • $pageLocale = $siteTree->getLocale()->getLocale(); - "en_GB"
    • $pageLanguage = $siteTree->getLocale()->getLanguage(); - "en"
    • $pageLanguageText = $siteTree->getLocale()->getLanguageText(); - "English"
Recent Tutorials
Setting addon/theme version compatibility in the marketplace
Jan 9, 2024

For developers worn out with setting the latest addon or theme version manually across too many core versions, here is a JavaScript bookmarklet to do it for you.

How to get the locale of a page
Jan 8, 2024
By mandako.

Now, why don't we just have a getLocale() method on Page objects beats me, but here's how you work around it

Using a Redis Server
Jun 16, 2023
By mlocati.

How to configure Concrete to use one or more Redis servers to persist the cache.

Using the Concrete Migration Tool Addon
Apr 27, 2023

How to use the Concrete CMS Migration Tool

How To Add Page Last Updated To Your Concrete CMS Pages
Mar 7, 2023

Concrete CMS has a page attribute you can add to a global area called "Page Date Modified." Here's how to add it

How To Exclude Subpages from Navigation
Dec 24, 2022

How to exclude subpages from navigation - useful for a news or blog link in your main navigation where you don't want all the subpages to appear in a drop down menu.


Let us know by posting here.