Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Localized Crystal Reports

What is a good method to localize labels (column headings, field labels, headers/footers, etc) on Crystal Reports?

We are currently on XI R2 SP4 but are looking to migrate to 2008. It looks like 2008 offers better localization of the viewer UI. Does it have a content localization story?

like image 392
Aidan Ryan Avatar asked May 20 '09 11:05

Aidan Ryan


2 Answers

Found a way to for localization of values such as DateTimes in Crystal Reports.
For instance if date is Aug-2009 and culture is French then would display as août-2009.
All this WITHOUT switching the current Thread culture to French.

Relevant Code snippet (example):

            //Locale must be set BEFORE report is opened 
            if (this.IsEnglish)
            {
                ReportDoc.ReportClientDocument.PreferredViewingLocaleID =
                    CrystalDecisions.ReportAppServer.DataDefModel.CeLocale.ceLocaleEnglishCanada;
                ReportDoc.ReportClientDocument.LocaleID =
                    CrystalDecisions.ReportAppServer.DataDefModel.CeLocale.ceLocaleEnglishCanada;
                ReportDoc.ReportClientDocument.ProductLocaleID =
                    CrystalDecisions.ReportAppServer.DataDefModel.CeLocale.ceLocaleEnglishCanada;
            }
            else
            {
                ReportDoc.ReportClientDocument.PreferredViewingLocaleID =
                    CrystalDecisions.ReportAppServer.DataDefModel.CeLocale.ceLocaleFrenchCanada;
                ReportDoc.ReportClientDocument.LocaleID =
                    CrystalDecisions.ReportAppServer.DataDefModel.CeLocale.ceLocaleFrenchCanada;
                ReportDoc.ReportClientDocument.ProductLocaleID =
                    CrystalDecisions.ReportAppServer.DataDefModel.CeLocale.ceLocaleFrenchCanada;
            }

            //Load the report from file path 
            ReportDoc.Load(reportPath.ToString());
like image 69
sheir Avatar answered Oct 18 '22 06:10

sheir


The two options that I can think of are: 1) Have a separate report for each localized version (this gets ugly quick and I don't recommend it very highly) or 2) Have the report generated from an application (say a c# windows/web app) and then you can localize using .net's localization standards and setting all of the localized text (read in from resource files) in the code.

I am not certain about 2008 but we are also on XI R2. We have localized reports for each language but only because we * know * that we will only need three different localized versions.

like image 23
Jeremy Cron Avatar answered Oct 18 '22 06:10

Jeremy Cron