473,698 Members | 1,888 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.GetM essage("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 4984
Hi,

"Andrus" <ko********@hot .eewrote in message
news:Oa******** ******@TK2MSFTN GP02.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.GetM essage("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.co m

"Andrus" <ko********@hot .eewrote in message
news:Of******** ******@TK2MSFTN GP02.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.c omwrote in
message news:Or******** ******@TK2MSFTN GP05.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.co m

"Andrus" <ko********@hot .eewrote in message
news:Of******** ******@TK2MSFTN GP02.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.

Additionall y 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
1801
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 that is actually selected by the user gets children menu items created under it, but that fails. I did this by use of postcommand callback, in which I dynamically add the children menu items to the parent. However, a print statement in the...
6
3234
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 when viewing it in the source code, however, because it doesn't show the complete path to the file. (I'm talking about Internet Explorer click View, click source code.)
4
3997
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 looking for. i am looking for code to make a dynamical menu with submenus The menu items are stored in a MS SQL Table and when by loading the page the items will be created. i have made a asp table. i want my menu on the left cell, in the middle...
10
21313
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 sender As System.Object, _ ByVal e As System.EventArgs) _ Handles mnuTopics_Show.Select Dim mShowMenuItem As MenuItem mShowMenuItem = DirectCast(sender, MenuItem)
2
2306
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 menu dissappears. Any one know why? Below is the code I'm using to create the menu items and append them to the existing menu: Dim aDatasheets As ArrayList = gOSSystemFile.Datasheets
2
1614
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. Let's say after the first loading I have 5 menu items. My problem: Every time the page is loaded (that means also if a menu item is clicked) the menu items are doubled (I have 10, 15, 20, ... menu items).
0
2318
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 navMenu.Items.Visible = false; OR
3
3013
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 following: Level 1 -- Level 2 -- Level 2 Level 1
1
5591
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 loads. This context menu is included in one (1) ListView control and one (1) TextBox control.
0
8600
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9018
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8890
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8858
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6517
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5859
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4360
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3038
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2322
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.