Revit 2017.1.1
I have read the Localization web-page. This page has link to Walkthrough: Creating Managed Satellite DLLs article. That article describes how to create the assembly on the base of Visual Studio Add-in template. But my Visual Studio 2015 hasn't such template.
> In Solution Explorer, right-click Resource1.resx and then click Properties.
> In the Properties window, change Build Action from Embedded Resource to None.
> At the command prompt, type AL.exe /embed:Resource1.resources /culture:en-US /out:Add-In Name.resources.dll.
> Replace Add-In Name by using the name of your add-in. For example, if your add-in project is named MyAddin, then the /out: switch would be
> /out:MyAddin.resources.dll. The /out: name must match the name of your project; otherwise, the resource DLL will not be found.
Ok... I switched the Build Action and called the utilities:
cd /D "D:\projects\vs\Revit\CodeExamples\Transactions"
resgen TransactionExample.resx
AL.exe /embed:TransactionExample.resources /culture:en /out:TransactionExample.resources.dll
After compilation of my add-in, I created en subdirectory in the output directory and copied the TransactionExample.resources.dll into that folder.
This is my manifest file:
<?xml version="1.0" encoding="utf-8" standalone="no"?> <RevitAddIns> <AddIn Type="Command"> <Assembly>Transactions\Transactions.dll</Assembly> <AddInId>{C857093F-594E-4384-9FA3-5897D874C0FD}</AddInId> <FullClassName>Revit.CodeExamples.Transactions.TransactionExample</FullClassName> <Text>@Text</Text> <VendorId>@VendorId</VendorId> <VendorDescription>@VendorDescription</VendorDescription> <VisibilityMode>NotVisibleInFamily</VisibilityMode> <Discipline>Structure</Discipline> <AvailabilityClassName>Revit.CodeExamples.Transactions.TransactionExampleAvailability</AvailabilityClassName> <LongDescription>@LongDescription</LongDescription> <TooltipImage>@zero</TooltipImage> <LargeImage>@zero</LargeImage> </AddIn> </RevitAddIns>
But Revit doesn't display the text from resources for /language ENU key. Look the attached screens, please. Why does it happen?
Usually, when I create localized resources I don't switch Embedded Resource to None, and IDE creates resources automatically. But Revit doesn't see these localized resources also. Therefore I tried to use focuses with resgen.exe and al.exe. as recommends Autodesk...
My project code source is attached too.
Dear Andrey,
Thank you for your interesting query.
I have not worked with localised resources.
The first thought that comes to mind is:
This may be an issue with .NET functionality not working automatically as expected unless the assembly DLL lives in the same folder as or a subfolder of Revit.exe.
Have you checked that possibility?
I hope this helps.
I look forward to discovering and documenting a solution to this.
I am sure that would be useful for others as well.
Best regards,
Jeremy
I created new special HelloWorld project for demonstration of this problem and published it on Bitbucket here. At the Russian forum Revit API (here) I described a problem in more detail. After all my experiments I began to think that it never worked in Revit and was never checked by anybody, even by those who wrote documentation. I nevertheless hope that I am mistaken...
> This may be an issue with .NET functionality not working automatically as expected unless the assembly DLL lives in the same folder as or a subfolder of Revit.exe.
>
> Have you checked that possibility?
It didn't help me. I tried to do it with my HelloWorld project. I placed the output (the HelloWorld directory with its content) into the "C:\Program Files\Autodesk\Revit 2017\AddIns\" directory.
Also I edited my "C:\Users\developer\AppData\Roaming\Autodesk\Revit\Addins\2017\HelloWorld.addin" file:
<?xml version="1.0" encoding="utf-8" standalone="no"?> <RevitAddIns> <AddIn Type="Command"> <Assembly>C:\Program Files\Autodesk\Revit 2017\AddIns\HelloWorld\HelloWorld.dll</Assembly> <AddInId>{39E8DC8B-DC8F-44A5-ABC9-39442B5031ED}</AddInId> <FullClassName>HelloWorld.ExternalCommand</FullClassName> <Text>@Text</Text> <VendorId>@VendorId</VendorId> <VendorDescription>@VendorDescription</VendorDescription> <VisibilityMode>NotVisibleInFamily</VisibilityMode> <Discipline>Structure</Discipline> <Discipline>Architecture</Discipline> <AvailabilityClassName>HelloWorld.ExternalCommandAvailability</AvailabilityClassName> <LongDescription>@LongDescription</LongDescription> <TooltipImage>@TooltipImage</TooltipImage> <LargeImage>@LargeImage</LargeImage> </AddIn> </RevitAddIns>
But it didn't solve the problem.