473,387 Members | 3,033 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Mult-language dialogs.

Need some advice on how I can selectively access values from a resource. If
I have a dialog and I turn "Localization" to true, nearly every value set in
InitializeComponents() is gathered as a value from a resource and casted to
the correct type.

For the most part, I need only the "text" property, sometimes the size
property and occasionally the location property. It is a waste of time and
space to run the rest of the values through the lookup. The overhead is
pretty immense. Best I can tell the compile size of InitiaizeComponents() +
default resouce is approximately 5 times larger with than without
localization.

I took a 1.8 meg UI intensive DLL, turned all these flags on which resulted
in a DLL that was 5.4 megs.

Any advice appreciated. Thanks.
Nov 17 '05 #1
2 1114
Dave,

Been there too. Furthermore the framework doesn't allow making
CultureInfos for some of the language-country combinations that
we require so we rolled our own resource management.

Source file, Xml easy to process with XmlReader :
<Xlation>
<Mnemonic>HelloWorld</Mnemonic>
<Text>Bonjour Monde</GuiText>
</Xlation>

This we store in our own ResourceManager (e.g. a HashTable)
Subclass the System.Windows.Forms.Form. In OnLoad or in the
constructure you recursively loop through the controls.
In our approach the *original* (design time) Text of a control
is taken as the Mnemonic for its translation. So a button text
"HelloWorld" would be translated into "Bonjour Monde".

In fact our approach is more sophisticated than that but I hope
you get the gist of it.

In our app, the code that loops through the controls also takes
care of translated tooltips configuring the help provider and has
an intelligent look at the control (e.g. you wouldn't want to
'translate' a text box or a datagrid for ex).
As for sizing controls, this is done automatically (if necessary)
using MeasureString after having translated the controls
(e.g. length of "Bye" vs. "Hasta la Vista"). Using Docking you
shouldn't have to worry too much about positioning but if this can be
a problem in complex screens (we have rolled our own positioning stuff
for multi-lingual data entry forms).

Size of the app doesn't grow and InitializeComponents remains unchanged
No satellite DLLs, maintaining the texts is easy; just edit the Xml.
So far we're quite happy with what we did.

HTH & Greetings,
Marius.

"Dave Harris" <Dave Ha****@discussions.microsoft.com> wrote in message
news:52**********************************@microsof t.com...
Need some advice on how I can selectively access values from a resource.
If
I have a dialog and I turn "Localization" to true, nearly every value set
in
InitializeComponents() is gathered as a value from a resource and casted
to
the correct type.

For the most part, I need only the "text" property, sometimes the size
property and occasionally the location property. It is a waste of time
and
space to run the rest of the values through the lookup. The overhead is
pretty immense. Best I can tell the compile size of InitiaizeComponents()
+
default resouce is approximately 5 times larger with than without
localization.

I took a 1.8 meg UI intensive DLL, turned all these flags on which
resulted
in a DLL that was 5.4 megs.

Any advice appreciated. Thanks.

Nov 17 '05 #2
Dave,

Been there too. Furthermore the framework doesn't allow making
CultureInfos for some of the language-country combinations that
we require so we rolled our own resource management.

Source file, Xml easy to process with XmlReader :
<Xlation>
<Mnemonic>HelloWorld</Mnemonic>
<Text>Bonjour Monde</GuiText>
</Xlation>

This we store in our own ResourceManager (e.g. a HashTable)
Subclass the System.Windows.Forms.Form. In OnLoad or in the
constructure you recursively loop through the controls.
In our approach the *original* (design time) Text of a control
is taken as the Mnemonic for its translation. So a button text
"HelloWorld" would be translated into "Bonjour Monde".

In fact our approach is more sophisticated than that but I hope
you get the gist of it.

In our app, the code that loops through the controls also takes
care of translated tooltips configuring the help provider and has
an intelligent look at the control (e.g. you wouldn't want to
'translate' a text box or a datagrid for ex).
As for sizing controls, this is done automatically (if necessary)
using MeasureString after having translated the controls
(e.g. length of "Bye" vs. "Hasta la Vista"). Using Docking you
shouldn't have to worry too much about positioning but if this can be
a problem in complex screens (we have rolled our own positioning stuff
for multi-lingual data entry forms).

Size of the app doesn't grow and InitializeComponents remains unchanged
No satellite DLLs, maintaining the texts is easy; just edit the Xml.
So far we're quite happy with what we did.

HTH & Greetings,
Marius.

"Dave Harris" <Dave Ha****@discussions.microsoft.com> wrote in message
news:52**********************************@microsof t.com...
Need some advice on how I can selectively access values from a resource.
If
I have a dialog and I turn "Localization" to true, nearly every value set
in
InitializeComponents() is gathered as a value from a resource and casted
to
the correct type.

For the most part, I need only the "text" property, sometimes the size
property and occasionally the location property. It is a waste of time
and
space to run the rest of the values through the lookup. The overhead is
pretty immense. Best I can tell the compile size of InitiaizeComponents()
+
default resouce is approximately 5 times larger with than without
localization.

I took a 1.8 meg UI intensive DLL, turned all these flags on which
resulted
in a DLL that was 5.4 megs.

Any advice appreciated. Thanks.

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Bart Nessux | last post by:
In Python, I can do something like this: a,b,c = 1,2,3 How might I do this with PHP? Thanks, Bart
2
by: D Barry | last post by:
Greetings: I am trying to conceive what risks might be created by running multiple SQL servers within a domain under a single domain account, as opposed to 1) running under the local service...
2
by: drdeadpan | last post by:
Hi all, Is this legal ? SELECT a.col1,b.col2,c.col3 FROM tab1 a WITH (UPDLOCK) , tab2 b, tab3 c WHERE a.col1 = b.col1 and b.col2 = c.col1 WIll the above cause a UPDLOCK on tab1 and...
5
by: Rose | last post by:
I want to use the javascript dom to reference the field of a record in a multi-record html form when that field has been changed. How do I reference the field? I have a JavaScript function coded...
19
by: William Wisnieski | last post by:
Hello Everyone, I have a main form with a datasheet subform that I use to query by form. After the user selects two criteria on the main form and clicks the cmdShowResults button on the main...
44
by: gokkog | last post by:
Hi there, There's a classic hash function to hash strings, where MULT is defined as "31": //from programming pearls unsigned int hash(char *ptr) { unsigned int h = 0; unsigned char *p =...
3
by: GaryDean | last post by:
I have serveral applications now running that are using the MembershipProvider classes and they are each using their own security tables in SQL Server 2005 instead of the express databases - they...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.