views:

983

answers:

3

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?

+1  A: 

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.

Jeremy Cron
#2 would be using the RDC to scan through each text field and replace with localized text?
Aidan Ryan
Yes - I've never done it though so i'm not sure what kind of headaches are involved.
Jeremy Cron
What do you think about a UFL that returns localized strings? Would calling that from each label field be a performance issue?
Aidan Ryan
A: 

A client asked me to do develop a localization strategy for them. I've been meaning to write an article on it. Thanks to you, I've done just that. http://www.cogniza.com/blog/?p=55

Edit:

I was able to use an embedded subreport (in the report-header section) that referenced a database of localization values. I would have added that to my posting, but it was quite complex.

Another option is to create a user-function library (UFL) that handles this tasks. Store the data in a database or XML file. Most likely, however, you will lose the ContentLocale functionality.

Craig
Summarizing the idea in case of link rot: create a Custom Function that returns a localized string by checking the Crystal XI ContentLocale variable.
Aidan Ryan
I don't like the idea of placing the actual translations into the custom function itself. This will create headaches when outsourcing translations.
Aidan Ryan
+1  A: 

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());
sheir