Visual Studio Developer Center > Visual Studio Forums > Crystal Reports for Visual Studio > Multilingual - Translate the CrustalReportViewer...
Ask a questionAsk a question
 

AnswerMultilingual - Translate the CrustalReportViewer...

  • Thursday, November 16, 2006 9:37 AManders_sms Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    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?

Answers

  • Wednesday, November 22, 2006 12:13 PManders_sms Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    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

All Replies

  • Thursday, November 16, 2006 7:27 PMAntón Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    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
  • Friday, November 17, 2006 7:30 AManders_sms Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    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.
  • Wednesday, November 22, 2006 12:13 PManders_sms Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    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

  • Thursday, December 07, 2006 4:09 PMCOMA1111 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    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

  • Friday, December 08, 2006 8:06 AManders_sms Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    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.
  • Friday, December 08, 2006 1:22 PMCOMA1111 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    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

  • Tuesday, June 19, 2007 2:57 PMib00042 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    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

  • Tuesday, June 19, 2007 5:01 PMCOMA1111 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    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;

     

     

  • Monday, July 02, 2007 4:05 PMib00042 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    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


  • Friday, July 06, 2007 12:12 PMCOMA1111 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    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;

    }