I have a function that uses the SharePoint api so the method SPUtility.GetLocalizedString is exposed.
I have also identified the uint language numbers 1033 (english) and 1036 (french) for use as one of the parameters.
[System.Reflection.Assembly]::Load("Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c")
$en = 1033
$fr = 1036
$str = "$Resources:docliblist"
$resx = "core"
$locstr = [Microsoft.SharePoint.Utilities.SPUtility]::GetLocalizedString($str, $resx, $en)
$locstr
$locstr = [Microsoft.SharePoint.Utilities.SPUtility]::GetLocalizedString ("$Resources:doclibList", "core", $fr)
$locstr
When I run the function, $locstr is empty. Not null, just empty.
Also, when I use the function this way:
$str = "$Resources:core, docliblist"
$locstr = [Microsoft.SharePoint.Utilities.SPUtility]::GetLocalizedString($str, $null, $en)
I get a returned value of ‘docliblist’
Now, while I can just take out what I need from the resx file and put into my own config file, I am perplexed as to why this isnt working. If anyone has any advice I would appreciate it.
Thanks.
*Edit
What was the point of you changing the quotation marks?
If
$Resourcesisn’t a powershell variable you need to escape'$'. Try it this way: