Monday, March 26, 2012

Multi Language Report Function

I have written a function which translates text based upon the language the
user chooses to see the report in (it can also be passed in as a data driven
parm for static runs) Anyway ... my question is this ... since I am new to RS
and new to Vb .Net I was wondering if someone out there can look at what I am
trying to do and suggest a better way ... since I dont want to have to code a
function like this for 25+ fields to be translated and in 4+ languages. I
think when you see the function I wrote you will get the idea and perhaps be
able to suggest an efficient way to translate all fields at once or perhaps
"generic" function (which I tried to code too with nested CASE statements but
abandoned). Anyway ... here is the newbie's (my) solution - dont laugh :-)
This is what I code in the text box for the expression ===>
=Code.TranslateTitle(Parameters!pm_language_code.value)
HERE IS THE FUNCTION
Function TranslateTitle ( ByVal Language_Code As String ) As String
Select Language_Code
Case "EN"
Return "Detailed Report : "
Case "FR"
Return "Rapport Détaillé : "
Case "DE"
Return "Ausführlicher Report : "
Case "NL"
Return "Gedetailleerd Rapport : "
Case Else
Return "Detailed Report : "
End Select
End Function
This works just fine ... but I have 25+ fields with translations !!!
Thanks in advanceHi,
You can use resource files just as in ASP.NET applications.
You can reference these resource dll files within a function written as a
custom code.
Eralper
http://www.kodyaz.com
"MJ Taft" wrote:
> I have written a function which translates text based upon the language the
> user chooses to see the report in (it can also be passed in as a data driven
> parm for static runs) Anyway ... my question is this ... since I am new to RS
> and new to Vb .Net I was wondering if someone out there can look at what I am
> trying to do and suggest a better way ... since I dont want to have to code a
> function like this for 25+ fields to be translated and in 4+ languages. I
> think when you see the function I wrote you will get the idea and perhaps be
> able to suggest an efficient way to translate all fields at once or perhaps
> "generic" function (which I tried to code too with nested CASE statements but
> abandoned). Anyway ... here is the newbie's (my) solution - dont laugh :-)
> This is what I code in the text box for the expression ===>
> =Code.TranslateTitle(Parameters!pm_language_code.value)
> HERE IS THE FUNCTION
> Function TranslateTitle ( ByVal Language_Code As String ) As String
> Select Language_Code
> Case "EN"
> Return "Detailed Report : "
> Case "FR"
> Return "Rapport Détaillé : "
> Case "DE"
> Return "Ausführlicher Report : "
> Case "NL"
> Return "Gedetailleerd Rapport : "
> Case Else
> Return "Detailed Report : "
> End Select
> End Function
> This works just fine ... but I have 25+ fields with translations !!!
> Thanks in advance|||Thanks for your response however I dont know asp .net - in fact ... just got
a book to learn it. So I dont know how to do what you are suggesting here.
Could you be more specific? Point to a simple example maybe?
"eralper" wrote:
> Hi,
> You can use resource files just as in ASP.NET applications.
> You can reference these resource dll files within a function written as a
> custom code.
> Eralper
> http://www.kodyaz.com
> "MJ Taft" wrote:
> > I have written a function which translates text based upon the language the
> > user chooses to see the report in (it can also be passed in as a data driven
> > parm for static runs) Anyway ... my question is this ... since I am new to RS
> > and new to Vb .Net I was wondering if someone out there can look at what I am
> > trying to do and suggest a better way ... since I dont want to have to code a
> > function like this for 25+ fields to be translated and in 4+ languages. I
> > think when you see the function I wrote you will get the idea and perhaps be
> > able to suggest an efficient way to translate all fields at once or perhaps
> > "generic" function (which I tried to code too with nested CASE statements but
> > abandoned). Anyway ... here is the newbie's (my) solution - dont laugh :-)
> >
> > This is what I code in the text box for the expression ===>
> >
> > =Code.TranslateTitle(Parameters!pm_language_code.value)
> >
> > HERE IS THE FUNCTION
> >
> > Function TranslateTitle ( ByVal Language_Code As String ) As String
> > Select Language_Code
> > Case "EN"
> > Return "Detailed Report : "
> > Case "FR"
> > Return "Rapport Détaillé : "
> > Case "DE"
> > Return "Ausführlicher Report : "
> > Case "NL"
> > Return "Gedetailleerd Rapport : "
> > Case Else
> > Return "Detailed Report : "
> > End Select
> > End Function
> >
> > This works just fine ... but I have 25+ fields with translations !!!
> >
> > Thanks in advance

No comments:

Post a Comment