Displayformat of a date value in diffirent languages
Hello,
in my application there are several templates for different languages.
Depending on the language I'm using the appropriate language file. For
system variable "page x of y" this seems to work.
Now I have a DBText with the following displayformat: mmmm d, yyyy
The name of the month remains in the same basic language all the time, no
matter which language file is being used...
What is the problem and how can I fix it?
Best regards,
Mark
in my application there are several templates for different languages.
Depending on the language I'm using the appropriate language file. For
system variable "page x of y" this seems to work.
Now I have a DBText with the following displayformat: mmmm d, yyyy
The name of the month remains in the same basic language all the time, no
matter which language file is being used...
What is the problem and how can I fix it?
Best regards,
Mark
This discussion has been closed.
Comments
This works in most cases, but just now I had a customer on the phone, who
has the problem, that the display value of that system variable remains in
the basic language all the time, no matter what language he choses. That's
the second case with this problem.
On my machine and in most other cases this seems to work properly.
So also here the question: what is the problem and how can I fix it?
1. SystemVariable
The descriptions are based on the Report.LanguageID. There are no known
issues with this feature. Make sure the customer has the correct language
modules installed on the system. If the report is loaded from a file or
database, you can use the Report.Template.On
2. FormatSettings
In ppUtils.pas, there is a global ppFormatSettings: TFormSettings (which is
a Delphi record structure). The format settings are initialized with the
current windows locale. You can override them via code. For example:
uses
ppUtils;
ppFormatSettings.ShortDateFormat := 'some format string'
-
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Ofcourse the customer has the correct language modules installed - he sent
me a screenshot. It's being done by our setup.
So far I'm setting Report.Language at run time depending on the selected
language. Report.LanguageID is being changed automatically, once I change
the Language property.
Once I load a report, the Language property seems to be set to "lgDefault",
while LanguageID remains at the value it had before loading, i.e. it remains
unchanged in that case.
Is it necessary to set the language at runtime at all? If I set
Report.Language to the appropriate value before saving, the saved value
seems to be loaded instead of "lgDefault" (that's the value all my reports
are saved with at the moment, as I am setting the language at runtime). But
if I save it with the report, the whole menus etc. seem to get mixed up:
some parts are in englisch (the saved language), some are in german (the
default language)... Btw.: is there a way to set the language for the GUI
and the content separately?
However: within the designer I need the GUI in the default language only, on
other places within the application, where the designed report is being
used, I need the mentioned things (SystemVariables etc.) in the language
defined for that report...
What is the correct way to handle it? The way I do it works for 99% of the
customers (myself included), but two of them have the described problem.
Hm, how does that make sense? If the language property of a report is being
changed, the purpose is to have everything in the said language. Content of
DataAware objects and also all the "fixed" text parts need to be translated
/ provided by the end user, that's clear. Everything he cannot affect
(SystemVariables, DisplayFormat / DisplayValue etc.) should be provided in
the selected language automatically. While this is supposed to work for
SystemVariables, it isn't supposed to work for DisplayFormats apparently,
which is quite illogical... At least day names and month names should be in
the selected language...
Report.Language is the old property - it still works. Report.LanguageID is
the new property - it is string value rather than an enumerated type, to
better enable developers to add new languages. Have a look at ppProd.pas the
methods SetLanguage and SetLanguageID. SetLanguage calls SetLanguageID.
SetLanguageID calls the global ppResourceManager which is the responsible
for loading the language modules. There are no known issues with the Report
Language feature.
I will add the following to the requested feature list:
1. Ability for UI to have different language from the Report layout
2. Add new Report.FormatSettings property that is automatically updated when
Report.LanguageID changes. Use Report.FormatSettings for display formats
rather than ppFormatSettings.
Thanks for the feedback.
-
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
thanks for adding it to the requested features list!
So you suggest using Report.LanguageID instead of Report.Language?
My first impression is that it's more complicated, because one has to know
what the exact string is. I mean how am I going to know, that for lgFrench,
the string "French (France)" has to be used etc.?
It can well be, that there are no known issues with the report language
feature, but theoretically it could also be, that I have discovered one now
Of course I would be doing anything wrong, but to fix this I need your help,
apparently.
That's why I asked, how / when the language of a report should be changed,
i.e. in a certain event, after a certain event etc. Aside from all this it's
strange, that it works for the most customers (also on my machine here), but
it doesn't only for two.
Best regards,
Mark
You can still use Report.Language if you prefer.
If you are loading reports from file/database templates the
Report.LanguageID/Language property value is saved/loaded with the report.
To override the value, use the Report.Template.OnLoadEnd event. I do notice
there is patch available for RB 14.08 that corrects an issue with loading
templates, the fix is included in RB 15.0.
-
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com