FB_init

Tuesday, December 09, 2008

PowerShell and SharePoint: Feature localization

I needed to find out how many SharePoint Features are not localized in the solution.
So I created a PowerShell script that searches for feature.xml and other manifest files. Then it checks for Description or Title without the $ character (localized Descriptions and Titles begin with $Resources: )

Here it is:

$Dir = get-childitem c:\VivaOMengo -recurse -Include feature.xml
$SDir = $Dir | Select-String -CaseSensitive -Pattern "Description=""" | Select-String -NotMatch -Pattern "Description=""\$" | Select-String -NotMatch -Pattern "Description="""""
$Dir | Select-String -Pattern "Description=""" | Select-String -NotMatch -Pattern "Description=""\$" | Select-String -NotMatch -Pattern "Description=""""" > c:\VivaOMengo\nonlocfeatDesc.txt
Write-Host 'Feature.xml files containing non-loc Description: ' $SDir.count

$SDirT = $Dir | Select-String -CaseSensitive -Pattern "Title=""" | Select-String -NotMatch -Pattern "Title=""\$" | Select-String -NotMatch -Pattern "Title="""""
$Dir | Select-String -Pattern "Title=""" | Select-String -NotMatch -Pattern "Title=""\$" | Select-String -NotMatch -Pattern "Title=""""" > c:\VivaOMengo\nonlocfeatTitle.txt
Write-Host 'Feature.xml files containing non-loc Title: ' $SDirT.count

$DirM = get-childitem D:\projects\main_1\src\Channel\portal -recurse -Include *.xml
$DirM = $DirM | where { $_ -match "WSPBuild" } | where { $_ -notMatch "feature.xml" }

$SDirM = $DirM | Select-String -CaseSensitive -Pattern "Description=""" | Select-String -NotMatch -Pattern "Description=""\$" | Select-String -NotMatch -Pattern "Description="""""
$DirM | Select-String -Pattern "Description=""" | Select-String -NotMatch -Pattern "Description=""\$" | Select-String -NotMatch -Pattern "Description=""""" > c:\VivaOMengo\nonlocmaniDesc.txt
Write-Host 'Other manifest files containing non-loc Description: ' $SDirM.count

$SDirTM = $DirM | Select-String -CaseSensitive -Pattern "Title=""" | Select-String -NotMatch -Pattern "Title=""\$" | Select-String -NotMatch -Pattern "Title="""""
$DirM | Select-String -Pattern "Title=""" | Select-String -NotMatch -Pattern "Title=""\$" | Select-String -NotMatch -Pattern "Title=""""" > c:\VivaOMengo\nonlocmaniTitle.txt
Write-Host 'Other manifest files containing non-loc Title: ' $SDirTM.count

No comments: