Testing user preferred language of SharePoint site
Summary
Are you testing SharePoint multi-lingual features? And want a quick way to switch languages on a site for a particular user or yourself; this can be useful when testing the modern multi-lingual features in SharePoint if you want to check the quality of the pages translated.
This script changes the MUI setting for a user within the User Information List to update the user with the appropriate language tag.
# SharePoint online site URL
$siteUrl = "https://contoso.sharepoint.com/sites/electronics"
# Connect to SharePoint online site
Connect-PnPOnline -Url $siteUrl -Interactive
# Get user details from User Information List to check what is my current language
$item = Get-PnPListItem -List "User Information List" -Id 7 # 7 is Me
# -OR- #
$userEmail = "paul.bullock@mytenant.co.uk"
$CamlQuery = @"
<View>
<Query>
<Where>
<Eq>
<FieldRef Name='EMail' />
<Value Type='Text'>$userEmail</Value>
</Eq>
</Where>
</Query>
</View>
"@
$item = Get-PnPListItem -List "User Information List" -Query $CamlQuery
# Language Reference: https://capacreative.co.uk/resources/reference-sharepoint-online-languages-ids/
$newLang = "cy-GB" #"en-GB"
# Making the language change
Set-PnPListItem -List "User Information List" -Id 7 -Values @{"MUILanguages" = $newLang}
# Disconnect SharePoint online connection
Disconnect-PnPOnline
Check out the PnP PowerShell to learn more at: https://aka.ms/pnp/powershell
The way you login into PnP PowerShell has changed please read PnP Management Shell EntraID app is deleted : what should I do ?
Source Credit
Article first appeared on Testing user preferred language of SharePoint site | CaPa Creative Ltd
Contributors
Author(s) |
---|
Paul Bullock |
Adam Wójcik |
Ganesh Sanap |
Disclaimer
THESE SAMPLES ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.