Multilingual - Translate the CrustalReportViewer...
- Hello, I need to translate the CrystalReportViewer (Win Forms) to Norwegian.
In order to do this I have to translate the Language Resource File "Viewer.txt", compile it and distribute it with the application, correct?
My porblem is that I cannot find the Viewer.txt Language Resource File in Norwegian, which is ok, I can translate the English one. But, where can i find the English version...?
Anyone?
回答
- Found a solution to the whole thing at last:
1. Create a working directory, e.g., C:\crystalresources, and copy the file "C:\Program Files\Common Files\Business Objects\2.7\Managed\CrystalDecisions.Windows.Forms.dll" (or wherever it is located) to the created directory
2. Run Visual Studio .NET 2005 Command Prompt from the start menu, and change the current directory (I assume in all the following snippets that you are located in C:\crystalresources):
cd C:\crystalresources
3. Disassemble the assembly. Don't extract the code, we are interested only in the resources.
ildasm CrystalDecisions.Windows.Forms.dll /OUT=CrystalDecisions.Windows.Forms.il /ITEM=
4. Convert the resources to the XML format.
resgen CrystalDecisions.Windows.Forms.CRViewerSys.resources CrystalDecisions.Windows.Forms.CRViewerSys.resx
5. You may delete all files in C:\crystalresources except the .resx
7. Run the resgen utility to compile the .txt files.
resgen /compile CrystalDecisions.Windows.Forms.CRViewerSys.resx,CrystalDecisions.Windows.Forms.resources
8. Run the al.exe utility to create a DLL form the resource file (.resources). Here it is important to define your Locale, in the example below I have no for norway. (/culture:no)
al.exe /t:lib /embed:CrystalDecisions.Windows.Forms.resources /culture:no /out:CrystalDecisions.Windows.Forms.custom_resources.dll
9. Place the language resource file (.dll) in a subdirectory where your application is located. For Norwegian it would be "no".
10. Thats it.... Norwegian texts!
Info gotten from these locations:
http://marian.ideaz.sk/crystal/
http://support.businessobjects.com/documentation/product_guides/cr_net/vs_2005/html/crtsktutorialsothermultilingualcompilingcustom.htm
すべての返信
- If you work with the Crystal Reports version distributed with Visual Studio, you don't have the resource files.You can download them in this link.
http://diamond.businessobjects.com/system/files/LanguageResourceFiles.zip - Hi Anton, thanks for your reply.
I have downloaded those resource files before, and it does not contain an English version... that's my problem... I don't know German etc...
Need one in English that I can translate and compile. - Found a solution to the whole thing at last:
1. Create a working directory, e.g., C:\crystalresources, and copy the file "C:\Program Files\Common Files\Business Objects\2.7\Managed\CrystalDecisions.Windows.Forms.dll" (or wherever it is located) to the created directory
2. Run Visual Studio .NET 2005 Command Prompt from the start menu, and change the current directory (I assume in all the following snippets that you are located in C:\crystalresources):
cd C:\crystalresources
3. Disassemble the assembly. Don't extract the code, we are interested only in the resources.
ildasm CrystalDecisions.Windows.Forms.dll /OUT=CrystalDecisions.Windows.Forms.il /ITEM=
4. Convert the resources to the XML format.
resgen CrystalDecisions.Windows.Forms.CRViewerSys.resources CrystalDecisions.Windows.Forms.CRViewerSys.resx
5. You may delete all files in C:\crystalresources except the .resx
7. Run the resgen utility to compile the .txt files.
resgen /compile CrystalDecisions.Windows.Forms.CRViewerSys.resx,CrystalDecisions.Windows.Forms.resources
8. Run the al.exe utility to create a DLL form the resource file (.resources). Here it is important to define your Locale, in the example below I have no for norway. (/culture:no)
al.exe /t:lib /embed:CrystalDecisions.Windows.Forms.resources /culture:no /out:CrystalDecisions.Windows.Forms.custom_resources.dll
9. Place the language resource file (.dll) in a subdirectory where your application is located. For Norwegian it would be "no".
10. Thats it.... Norwegian texts!
Info gotten from these locations:
http://marian.ideaz.sk/crystal/
http://support.businessobjects.com/documentation/product_guides/cr_net/vs_2005/html/crtsktutorialsothermultilingualcompilingcustom.htm I generated the custom dll very well, but how can I integrate this dll to my project? How the viewer detect the change of language? Does the viewer will select his language according to the language of the form?
Thanks
- Selecting the language in the Regional and Language Options in the control panel is supposed to be working. But that didn't really work for me. Only a few strings was translate, e.g. tooltips was still in english.
Adding this code on the form load worked:
CultureInfo ci = new CultureInfo("nb-NO");
Thread.CurrentThread.CurrentCulture = ci;
Thread.CurrentThread.CurrentUICulture = ci;
This ensures that the current culture is norwegian, and all texts are in norwegian! You have to change it to what ever you need of course. Thanks anders.... It's working for me... I added "Application.CurrentCulture = new CultureInfo("FR-CA");" to the main...
Now Trying to do the same thing in web... do you have an idea?
thanks
Hi,
I would like to know if you are speaking about the fields of a report or if you are speaking about the viewer, where the report can be seen filled?
I'm trying to generate a resource file to the fields of the reports, that change based on the regional settings.
If you could help me, please let me know.
Thanks.
R
We are speaking about the tooltip et labels of the viewer.
But if you want to change fields of your reports according to your regional settings, you need to access your report and change the value of your fields.
((
TextObject)ReportDocument.ReportDefinition.Sections["YourSection"].ReportObjects["YourField"]).Text = yourResourceValue;thanks, your help was great!
Now I have other problem, if I have a subreport object in a section, how can I change the fields?
I was trying to access them directly based on the section, but I can't, my goal was making a recursive function to translate reports, but the subreport is a ReportObject not a ReportDocument, and I can't cast, I need to create one, but it doesn't exist, only within the main report.
Thanks for your help.
R
Here's the way thaht i used to set sub report fileds.
protected
void SetSubReportTextField(string subReport, string field, string value){
((
TextObject)ReportDocument.Subreports[subReport].ReportDefinition.Sections[0].ReportObjects[field]).Text = value;}

