Create Communication Sites with a specific primary language using PnP PowerShell

Do you want to create a Communication Site in another language? This post will show you how by creating a site with the primary language set to a language other than English using PnP PowerShell.

Before creating these, it is important to know that once you have chosen the primary language for the site, this cannot be changed - so it needs to be right.

I will be using the Microsoft Patterns and Practices library: PnP-PowerShell. If you haven’t heard of this or use this before - I highly recommend taking a look at the Microsoft documentation for this library: SharePoint PnP Cmdlets | Microsoft Docs

This script is an example of creating a new communication site, with Welsh as the default language using the PnP-PowerShell commands:

$adminUrl = "https://<tenant>-admin.sharepoint.com"
$newSiteUrl = "https://<tenant>.sharepoint.com/sites/Pensaerniaeth" 
$ownerEmail = "<your.name@your.email.com>"

$siteTitle = "Pensaerniaeth"                # Translates to "Architecture" - Bing Translator
$siteTemplate = "SITEPAGEPUBLISHING#0"      # Communication Site Template
$lcid = 1106                                
$timeZone = 2                               # London (https://capa.ltd/sp-timezones)

Connect-PnPOnline -Url $adminUrl -NoTelemetry
New-PnPTenantSite -Template $siteTemplate -Title $siteTitle -Url $newSiteUrl `
        -Lcid $lcid -Owner $ownerEmail -TimeZone $timeZone

Write-Host "Script Complete! :)" -ForegroundColor Green

To make it easier to find the IDs, we have created the following reference pages, to help you find the Ids for your region:

Result script:

Image of new communication site with an arrow pointing to the welsh language as a default

Image of new communication site with an arrow pointing to the welsh language as a default

In the PowerShell script, you may notice that cmdlet requires a number for the “-LCID” to specify the language you want to use for the primary language. The Microsoft documentation does not clearly give the LCID for each language when you are trying to create a site in another language.

I have written a Locale Ids page on this site, to refer to for all the languages that SharePoint supports (at the time of writing this post) so you can refer to the Locale IDs in the above script for other languages.

Or you can generate this yourself, by running:

# script to get the installed languages in SharePoint Online
Connect-PnPOnline -Url "https://<mytenant>.sharepoint.com"
(Get-PnPWeb -Includes RegionalSettings.InstalledLanguages).RegionalSettings.InstalledLanguages

New options

New features are coming to the site creation process that will allow you to select the language at first creation. When this is available this will give you another option; to use a self-service site creation process at the time of creating your Communication Site.

Screenshot from a conference that shows the new language options e.g. Welsh

Screenshot from a conference that shows the new language options e.g. Welsh

The above Screenshot shows an Office 365 group creation screen, however the announcement also indicates this will be available for communication sites.

Note: I will write another post when this has been released to one of our tenants and provide a link from this post.

This blog post is part of a series, check out this post “Series: Creating a multi-lingual Intranet using Communication Sites” for more related content.

Useful References

Note: In this post, I am using Welsh translated from Microsoft Bing/Translator Text API, I don’t speak Welsh so I rely on the accuracy of the translator services, if you find some Welsh words inaccurate or offensive, please let me know immediately by posting a comment or DM via Twitter and I will correct the content. Thank you.

This should will get you going… Enjoy!