Hi,
in a Windows form VB.Net project I use localization for all texts.
In App.Config I added:
<appSettings>
<add key="locale" value="de"/>
</appSettings>
In the project I have ressource files strings.resx (English text) and
strings.de.resx for the German texts.
In the Main Module I use the follwowÃ*ng code:
Imports System.Configur ation
Imports System.Resource s
Imports System.Globaliz ation
Imports System.Threadin g
.......
Friend M_LocRM As ResourceManager
Friend M_Locale As String
......
Sub Main()
M_Locale = ConfigurationSe ttings.AppSetti ngs.Get("locale ")
Thread.CurrentT hread.CurrentCu lture =
CultureInfo.Cre ateSpecificCult ure(M_Locale)
Thread.CurrentT hread.CurrentUI Culture = New CultureInfo(M_L ocale)
M_LocRM = New ResourceManager ("MyNamespace.S trings",
GetType(MyMainM odule).Assembly )
......
For all texts I then use the GetString method of the ResourceManager M_LocRM.
This works fine, as long as I debug the project: changing the value of
'locale' in app.config from 'en' to 'de' (and vice versa) gives all the texts
in German or English like it should be.
When I install MyFunction.exe in a different folder (say c:\program
files\MyFunctio n) together with the config file MyFunction.exe. config it does
not work any more:
Changing the value of 'locale' in the config file has no effect, as only the
entries of the ressource file 'strings.resx' are used. Changing the locale
from 'en' to 'de' has not the effect that the entries of 'strings.de.res x'
are used.
Why? Can anybody give me some hint, as the above described implementation
works fine in any of my ASP.Net projects but not in my Windows form projects.
--
Best regards
Henry 8 3718
Henry,
I dont, know however is this one not easier
(I dont know how it acts with multithreading for a complete application so
that you have to check)
Threading.Threa d.CurrentThread .CurrentCulture = New _
Globalization.C ultureInfo("en-US")
And than this one when you need to set it back in the program, what I doubt
that that is needed.
Threading.Threa d.CurrentThread .CurrentCulture = _
Globalization.C ultureInfo.Inst alledUICulture
I hope this helps
Cor
Henry, When I install MyFunction.exe in a different folder (say c:\program files\MyFunctio n) together with the config file MyFunction.exe. config it does not work any more:
Do you also remember to install the respective language DLLs to c:\program
files\MyFunctio n also?
You should be able to copy the folder structure under the bin folder in
VS.NET.
Hope this helps
Jay
"Henry" <he********@nos pam.nospam> wrote in message
news:25******** *************** ***********@mic rosoft.com... Hi, in a Windows form VB.Net project I use localization for all texts. In App.Config I added:
<appSettings> <add key="locale" value="de"/> </appSettings>
In the project I have ressource files strings.resx (English text) and strings.de.resx for the German texts.
In the Main Module I use the follwowíng code:
Imports System.Configur ation Imports System.Resource s Imports System.Globaliz ation Imports System.Threadin g ......
Friend M_LocRM As ResourceManager Friend M_Locale As String .....
Sub Main() M_Locale = ConfigurationSe ttings.AppSetti ngs.Get("locale ")
Thread.CurrentT hread.CurrentCu lture = CultureInfo.Cre ateSpecificCult ure(M_Locale) Thread.CurrentT hread.CurrentUI Culture = New CultureInfo(M_L ocale)
M_LocRM = New ResourceManager ("MyNamespace.S trings", GetType(MyMainM odule).Assembly ) .....
For all texts I then use the GetString method of the ResourceManager M_LocRM.
This works fine, as long as I debug the project: changing the value of 'locale' in app.config from 'en' to 'de' (and vice versa) gives all the texts in German or English like it should be.
When I install MyFunction.exe in a different folder (say c:\program files\MyFunctio n) together with the config file MyFunction.exe. config it does not work any more:
Changing the value of 'locale' in the config file has no effect, as only the entries of the ressource file 'strings.resx' are used. Changing the locale from 'en' to 'de' has not the effect that the entries of 'strings.de.res x' are used.
Why? Can anybody give me some hint, as the above described implementation works fine in any of my ASP.Net projects but not in my Windows form projects.
-- Best regards
Henry
Henry,
I took the wrong one sorry
Threading.Threa d.CurrentThread .CurrentUICultu re = New
Globalization.C ultureInfo("en-US")
And that than direct in the New sub
Cor
Jay, Do you also remember to install the respective language DLLs to c:\program files\MyFunctio n also?
Edify me?
:-)
I know that I can use different framework versions depending on the OS that
is used.
However language dll's?
Cor
Jay,
Thanks, I did make an application which is more global, however did not use
the resx for that however an xml. (I still find the RESX a lot of work
although I have now that C# program to edit it).
But now I see what you mean with that dll.
(The links where not needed by the way, your text was enough)
Cor
Hi Jay,
that was of course the fault: I forgot to include the 'en' subfolder of the
bin folder in my setup projet ... Thanks a lot
Regards
Henry
"Jay B. Harlow [MVP - Outlook]" wrote: Henry, When I install MyFunction.exe in a different folder (say c:\program files\MyFunctio n) together with the config file MyFunction.exe. config it does not work any more: Do you also remember to install the respective language DLLs to c:\program files\MyFunctio n also?
You should be able to copy the folder structure under the bin folder in VS.NET.
Hope this helps Jay
"Henry" <he********@nos pam.nospam> wrote in message news:25******** *************** ***********@mic rosoft.com... Hi, in a Windows form VB.Net project I use localization for all texts. In App.Config I added:
<appSettings> <add key="locale" value="de"/> </appSettings>
In the project I have ressource files strings.resx (English text) and strings.de.resx for the German texts.
In the Main Module I use the follwowÃ*ng code:
Imports System.Configur ation Imports System.Resource s Imports System.Globaliz ation Imports System.Threadin g ......
Friend M_LocRM As ResourceManager Friend M_Locale As String .....
Sub Main() M_Locale = ConfigurationSe ttings.AppSetti ngs.Get("locale ")
Thread.CurrentT hread.CurrentCu lture = CultureInfo.Cre ateSpecificCult ure(M_Locale) Thread.CurrentT hread.CurrentUI Culture = New CultureInfo(M_L ocale)
M_LocRM = New ResourceManager ("MyNamespace.S trings", GetType(MyMainM odule).Assembly ) .....
For all texts I then use the GetString method of the ResourceManager M_LocRM.
This works fine, as long as I debug the project: changing the value of 'locale' in app.config from 'en' to 'de' (and vice versa) gives all the texts in German or English like it should be.
When I install MyFunction.exe in a different folder (say c:\program files\MyFunctio n) together with the config file MyFunction.exe. config it does not work any more:
Changing the value of 'locale' in the config file has no effect, as only the entries of the ressource file 'strings.resx' are used. Changing the locale from 'en' to 'de' has not the effect that the entries of 'strings.de.res x' are used.
Why? Can anybody give me some hint, as the above described implementation works fine in any of my ASP.Net projects but not in my Windows form projects.
-- Best regards
Henry
Henry,
If you are using a Setup Project to deploy your app (as opposed to coping
the files). You should add the localized resources to your setup project (as
opposed to adding the "bin/en" or "bin/de" folders directly. As this will
allow new localized languages to automatically be included in the setup!
(for example "bin/fr" for French support).
Use "Project - Add - Project Output", then select the project with the
localized resources under Project, select "Localized resources" in this list
box, and click OK. I normally include localized resources for all my
projects in a solution, even if those projects are not yet localized...
The setup project will then put create the language folders & deploy the
language dll's for you...
Hope this helps
Jay
"Henry" <he********@nos pam.nospam> wrote in message
news:37******** *************** ***********@mic rosoft.com... Hi Jay,
that was of course the fault: I forgot to include the 'en' subfolder of the bin folder in my setup projet ... Thanks a lot
Regards
Henry
"Jay B. Harlow [MVP - Outlook]" wrote:
Henry, > When I install MyFunction.exe in a different folder (say c:\program > files\MyFunctio n) together with the config file MyFunction.exe. config > it > does > not work any more: Do you also remember to install the respective language DLLs to c:\program files\MyFunctio n also?
You should be able to copy the folder structure under the bin folder in VS.NET.
Hope this helps Jay
"Henry" <he********@nos pam.nospam> wrote in message news:25******** *************** ***********@mic rosoft.com... > Hi, > in a Windows form VB.Net project I use localization for all texts. > In App.Config I added: > > <appSettings> > <add key="locale" value="de"/> > </appSettings> > > In the project I have ressource files strings.resx (English text) and > strings.de.resx for the German texts. > > In the Main Module I use the follwowíng code: > > > Imports System.Configur ation > Imports System.Resource s > Imports System.Globaliz ation > Imports System.Threadin g > ...... > > Friend M_LocRM As ResourceManager > Friend M_Locale As String > ..... > > Sub Main() > M_Locale = ConfigurationSe ttings.AppSetti ngs.Get("locale ") > > Thread.CurrentT hread.CurrentCu lture = > CultureInfo.Cre ateSpecificCult ure(M_Locale) > Thread.CurrentT hread.CurrentUI Culture = New > CultureInfo(M_L ocale) > > M_LocRM = New ResourceManager ("MyNamespace.S trings", > GetType(MyMainM odule).Assembly ) > ..... > > For all texts I then use the GetString method of the ResourceManager > M_LocRM. > > This works fine, as long as I debug the project: changing the value of > 'locale' in app.config from 'en' to 'de' (and vice versa) gives all the > texts > in German or English like it should be. > > When I install MyFunction.exe in a different folder (say c:\program > files\MyFunctio n) together with the config file MyFunction.exe. config > it > does > not work any more: > > Changing the value of 'locale' in the config file has no effect, as > only > the > entries of the ressource file 'strings.resx' are used. Changing the > locale > from 'en' to 'de' has not the effect that the entries of > 'strings.de.res x' > are used. > > Why? Can anybody give me some hint, as the above described > implementation > works fine in any of my ASP.Net projects but not in my Windows form > projects. > > -- > Best regards > > Henry This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Manish Pansiniya |
last post by:
Hello to all,
we want to update resource online when administrator changes Localization
database. can anybody tell me weather it is possible to run localization
toolkit in command line or as batch process to generate satellite assembly
???
Reply ASAP whatever it is.
|
by: Rental |
last post by:
I'm having the sam problem as described below with the Localization
toolkit. Does anyone know if there is a solution to this problem.
--->When attempting to generate resource dlls with
--->LocalizationManagement.exe, I get an exception:
--->Unable to generate loose file resources
|
by: Samuel |
last post by:
Hi,
I am running into a problem of mixing UICulture = auto and allowing users to
select culture using a dropdown list.
I am detecting a querystring, "setlang", and when found, setting the
CurrentUICulture to what's specified in the querystring. Since I want to
allow UICulture auto detecting, I add UICulture = "auto" to page directive on
each page.
|
by: Olivier Matrot |
last post by:
I encounter a problem with Localization features in ASP.NET 2.0.
Is seems that the framework is not able to manage neutral cultures such as
'fr', or 'de'. Those are the culture sent by default from a french or German
Internet Explorer in France or Germany.
There is a runtime error "System.NotSupportedException: Culture "fr" is a
neutral culture. It can not be used in formatting and parsing and therefore
cannot be set as the thread's...
|
by: VB Programmer |
last post by:
I would appreciate your assistance on this ASP.NET 2.0 site....
This is the wierd problem: While accessing the built in .NET functions for
'profiling' or 'membership' an error is generated (see following 2
examples):
---- EXAMPLE 1 --------
OK --> Dim p As New ProfileCommon
OK --> p = Profile.GetProfile(Me.ddlRacer.SelectedItem.Text)
FAILS --> Me.lblDebug.Text = p.FirstName.ToString
| |
by: jojobar |
last post by:
Hello,
I am trying to localize an existing application (asp.net 2.0). using
implicit as well as explicit localization.
Asp.net 2.0 uses App_LocalResources folder for implicit localization. When
this happens the tag values for Text, ToolTip etc. are not used from the aspx
file but read from the resource files. The problem is that most developers
works
on the aspx files to make and view changes.
|
by: CMM |
last post by:
I don't seem to "get" ASP.NET 2.0's Localization features. I've read up on
everything... and of course, everything is explained in cursory softball
terms- not any "real-world" usage way.
I hope someone can give me a clue...
Questions:
1) Do my eyes deceive me or is it true that localization is still totally
utterly disengaged from the Designer and Property Editor... either in source
|
by: bruno |
last post by:
I need to localize my ASP.NET app and I just used "Tools" --"generate local
resources" command and everything works fine in my WebForms.
Resource file name is: MyWebForm.aspx.resx under a subDir named:
"App_LocalResources" inside the App directory.
Now I need to localize some messages my VB app sends to the user. What I'm
looking for is a way to read from a .resx file and get the appropriate
values.
I found some examples like this...
|
by: AmitKu |
last post by:
I am trying to do a URL post using HttpWebRequest, but it fails because
I am hosting on Network Solutions, and their servers are all medium
trust. Apparently HttpWebRequest doesn't work on medium trust.
Is there any way to do URL posting in a medium trust environment? I'm
hoping I don't need to switch hosts because of this.
Btw I've posted this a 3rd time now because I've yet to receive any
replies whatsoever. I've called around...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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...
| |
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
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...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |