473,418 Members | 2,092 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,418 software developers and data experts.

Translating WinForm menu items dynamically

I have database containing translations.
I'm creating VS 2005 WinForms application which should use this database to
translate menu items to user language.

I replaced lines in myform.designer.cs like

Text = "File";

to call my translating routine

Text = Translator.GetMessage("File");

Now designer cannot open my Winform anymore.
How to design such forms ?

I tried also to generate localized code but this does not allow to translate
at runtime.

Andrus.
Oct 10 '07 #1
5 4970
Hi,

"Andrus" <ko********@hot.eewrote in message
news:Oa**************@TK2MSFTNGP02.phx.gbl...
>I have database containing translations.
I'm creating VS 2005 WinForms application which should use this database
to
translate menu items to user language.

I replaced lines in myform.designer.cs like

Text = "File";

to call my translating routine

Text = Translator.GetMessage("File");

Now designer cannot open my Winform anymore.
How to design such forms ?
You should do this dynamically. At runtime. When the form is opening you can
read the text and change the menu as desired.

Additionally you should take a look at the localization features provided by
the framework.
Oct 10 '07 #2
You should do this dynamically. At runtime. When the form is opening you
can read the text and change the menu as desired.

Additionally you should take a look at the localization features provided
by the framework.
Thank you.
So I think I have two possibilities:

1. In form constructor, loop over menu and label controls in form and change
their Text properies to current UI language.
Where to find sample code for this ?

2. At application startup, check if dictionary table in database is changed.
If table is changed, generate satellite assemblies dynamically from
database.
Should I distribute resgen.exe and al.exe with my application and invoke
them from application to create new resources ?
How to force application to use same resource file in all forms ? Or should
I distribute separate resource file for every form and for every language
with my application ?
Where to find sample code to dynamic resource file generation ?

Which is better solution ?

Andrus.
Oct 10 '07 #3
Andrus,

I am curious why you need to access the database to do this. Are the
items being changed that often that you need to do this? If anything, I
would think that the translations would be done once, and then never again
(except for new items) in which case, you would just distribute a new
satellite assembly.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Andrus" <ko********@hot.eewrote in message
news:Of**************@TK2MSFTNGP02.phx.gbl...
>You should do this dynamically. At runtime. When the form is opening you
can read the text and change the menu as desired.

Additionally you should take a look at the localization features provided
by the framework.

Thank you.
So I think I have two possibilities:

1. In form constructor, loop over menu and label controls in form and
change their Text properies to current UI language.
Where to find sample code for this ?

2. At application startup, check if dictionary table in database is
changed.
If table is changed, generate satellite assemblies dynamically from
database.
Should I distribute resgen.exe and al.exe with my application and invoke
them from application to create new resources ?
How to force application to use same resource file in all forms ? Or
should I distribute separate resource file for every form and for every
language with my application ?
Where to find sample code to dynamic resource file generation ?

Which is better solution ?

Andrus.

Oct 10 '07 #4
Hi,

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote in
message news:Or**************@TK2MSFTNGP05.phx.gbl...
Andrus,

I am curious why you need to access the database to do this. Are the
items being changed that often that you need to do this? If anything, I
would think that the translations would be done once, and then never again
(except for new items) in which case, you would just distribute a new
satellite assembly.
It might be the case that depending of the user running the app the language
change. I'm working in a project where we had such a requirement (it was
discarded at the end).
Oct 10 '07 #5
My translations are all in database.
I must use them to translate reports (rdlc files) at runtime. Reports can be
customize by end user and every report should be automatically translated to
various languages.
So this translation remains to be done in runtime and i use database for
this.
I have most translations already done in database.

I need to push those translations to my application form controls Text and
ToolTip properties.

Using satellite assemblies requires to edit every assembly in every form
manually using resource
editor and using copy base from translation database.
This is huge work.
So I'm looking for a way to automate it.

Andrus.
I am curious why you need to access the database to do this. Are the
items being changed that often that you need to do this? If anything, I
would think that the translations would be done once, and then never again
(except for new items) in which case, you would just distribute a new
satellite assembly.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Andrus" <ko********@hot.eewrote in message
news:Of**************@TK2MSFTNGP02.phx.gbl...
>>You should do this dynamically. At runtime. When the form is opening you
can read the text and change the menu as desired.

Additionally you should take a look at the localization features
provided by the framework.

Thank you.
So I think I have two possibilities:

1. In form constructor, loop over menu and label controls in form and
change their Text properies to current UI language.
Where to find sample code for this ?

2. At application startup, check if dictionary table in database is
changed.
If table is changed, generate satellite assemblies dynamically from
database.
Should I distribute resgen.exe and al.exe with my application and invoke
them from application to create new resources ?
How to force application to use same resource file in all forms ? Or
should I distribute separate resource file for every form and for every
language with my application ?
Where to find sample code to dynamic resource file generation ?

Which is better solution ?

Andrus.


Oct 11 '07 #6

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

Similar topics

0
by: Humpty Dumpty | last post by:
Hi folks, here's a challenge: I have a dynamically created cascading menu in Tkinter that can be quite large because it is created from a file. I tried using lazy creation so only the menu item...
6
by: Sandy | last post by:
Hello - I have a book that illustrates pulling menu items from a Sql Server table into an ascx via a stored procedure. Is this something that is done in the real world? I do like the effect...
4
by: paula | last post by:
I've got a problem with asp.net i am trying to make a menu control. and have searched the web for serveral controls but they don't work correctly. I am pretty new to asp.net building. What am i...
10
by: tmaster | last post by:
When I try to dynamically add a second sub menu item to this ContextMenu item, I get an error 'Specified argument was out of the range of valid values'. Private Sub mnuTopics_Show_Select(ByVal...
2
by: jack | last post by:
Hello, I need to dynamically add menu items to an existing menu on an MDI form. In the form load, when I create the menu items then add it to the menu control using the Add method, the entire...
2
by: dorrit.Riemenschneider | last post by:
Hi, I develop a sharepoint webpart with ASP.Net 2.0 and therefore override CreateChildControls(). In CreateChildControls() I create dynamically a menu with items (and sub items) from a database....
0
by: Puja | last post by:
hi all, I have asp.net menu control on my page. I want to hide some menu and sub-menu items dynamically depending on user. (i.e after user is logged in) is there any property like ...
3
by: =?Utf-8?B?ZWFndWlsYXI=?= | last post by:
Hi, I am trying to dynamically generate a menu, based on entries on a text or xml file. The text file contains the "tree" after which the menu will need to be created. Something like the...
1
by: =?Utf-8?B?anAybXNmdA==?= | last post by:
I've got one Context Menu named mi_EasterEggs with three (3) menu items: * mi_FontArial * mi_FontCourier * mi_RawData All menu items have their Visible properties set to False when the form...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.