Loading...
 
Multi-Language Add-In for Visual Studio

Multi-Language Add-In for Visual Studio


Languge Cultures that dont exsist in windows xp!

I need to use es-US but this seems to not work under windows xp users, due to the es-US culture not being available inside windows xp. I also noticed and while searching that some users comment on using es-ES or es-MX, actually in your program,you are using es-MX for Spanish alone. This will not work for me as i am using es-SP for Spain and es-MX for Mexico already. Also i want to know if i go on my own and create custom new cultures for example i need english for Puerto Rico, and some others in which i want to provide english as an available language for these countries that i need would i be able to plug them into your software? (Appear on your list of vailable langauges) Also to make things clear i am also using the culture to display content specific to these website so i am not able to share languages between them (Example- i cannot use en-US for english for Puerto Rico, i cannot use es-US for spanish for US as its not supported in windows xp, i cannot use your spanish because it points to es-MX and i need to use es-MX for Mexico, i cannot use es-SP for spanish for US because i am using it for Spain. Thank you
Germany

Assuming that you are using .NET framework 2.0 or later, then you can register es-US as a custom culture. The Add-In handles custom cultures identically to built-in cultures. (At least I hope it does, it was quite a lot of work!)

The only easy way that I know to register a custom culture is by writing a program to do it. I have made a simple project to register or unregister es-US, which you can download with the link http://www.jollans.com/AmericanSpanish.zip.

This is what it does:

Private Sub btRegister_Click( ByVal sender As System.Object,  ByVal e As System.EventArgs) Handles btRegister.Click

    Dim cib As CultureAndRegionInfoBuilder = Nothing

    ' Create a CultureAndRegionInfoBuilder object named "es-US".
    cib = New CultureAndRegionInfoBuilder ( "es-US", CultureAndRegionModifiers.None )

    ' Populate the new CultureAndRegionInfoBuilder object with culture information.
    Dim ci As New CultureInfo("es-MX")
    cib.LoadDataFromCultureInfo(ci)

    ' Populate the new CultureAndRegionInfoBuilder object with region information.
    Dim ri As New RegionInfo("US")
    cib.LoadDataFromRegionInfo(ri)
    
    'Define some specific parameters
    cib.TwoLetterISORegionName = "US"
    cib.CultureEnglishName     = "Spanish (United States)"
    cib.CultureNativeName      = "Español (Estados Unidos)"
    
    ' Register the custom culture.
    cib.Register()    

  End Sub

Private Sub btUnregister_Click( ByVal sender As System.Object,  ByVal e As System.EventArgs) Handles btUnregister.Click
    
    ' Unregister the culture
    CultureAndRegionInfoBuilder.Unregister("es-US")
  
  End Sub


If you want to use this code, you must add a reference to sysglobl.dll to your project.

The register button copies the culture settings from es-MX, but then overwrites the regional settings with the US settings. I hope that this includes things like the date format and decimal separator, but I haven't tested it.

The language list in the Add-In initially shows the language name in Spanish, even on an English system. I haven't figured this out yet, but it hardly seems critical. You can switch the list to English or Native Language, which display it correctly.

The big drawback of custom languages is that you have to register them on the target machine as well. For an ASP project, this means that you must register the language on the server.

Now to your other questions:

The Add-In always prefers to add neutral cultures before adding specific cultures. This is sensible for Windows Forms projects, but might not always be so good for ASP projects. Perhaps I should make it less strict.

By the way, if you don't want to have the neutral Spanish culture, then you can remove it via the context menu.

ASP pages have a Culture and a UICulture property. You can set Page.UICulture to a neutral culture, but Page.Culture has to be set to a specific culture. This poses a problem if you use a neutral culture for an ASP page.

If you use the SelectLanguage web control from the Add-In, then when you select a neutral culture, it simply searches for the first specific culture and uses that one. I presume that this is what you mean when you say that the Add-In uses es-MX for Spanish alone. (There is certainly no hard coded connection between es and es-MX.) If that is the case, then you can edit the code in the SelectLanguage web control to implement some other logic.

Phil



Thank you so much Phil for thye fast update, i wanted to make sure that if i created my own custom cultures that i would still be able to use your software which i purchased 2 days ago. The code project you sent is great info! I am still a little confused as to how i am able to add them to your list of available languages. Can you please share more specific info as to how i can do that. Thank you biggrin
Germany

Once you have registered the custom culture, it should automatically appear in the list of available languages.

As I mentioned, the only confusing thing was that the Spanish name appeared in the list, although the list was in English. That meant that Español appeared after English and not with Spanish in the list.

Selecting English or Native language with one of the buttons below the language list fixes this problem.

Phil

> Once you have registered the custom culture, it should automatically appear in the list of available languages.
>
> As I mentioned, the only confusing thing was that the Spanish name appeared in the list, although the list was in English. That meant that Español appeared after English and not with Spanish in the list.
>
> Selecting English or Native language with one of the buttons below the language list fixes this problem.
>
> Phil


Thank you Phil for the clarification, i think that it shows Spanish after US because we are assigning it to US.

Thank you so much! biggrin

> Once you have registered the custom culture, it should automatically appear in the list of available languages.
>
> As I mentioned, the only confusing thing was that the Spanish name appeared in the list, although the list was in English. That meant that Español appeared after English and not with Spanish in the list.
>
> Selecting English or Native language with one of the buttons below the language list fixes this problem.
>
> Phil

Phil i have created a new custom culture en-PR, i am not able to see if populate inside your list of available languages. Any Idea?

I did create the es-Us using the project you sent me but this one was already on the list because i had ran the language addin the first time from a Vista machine so thats why it was already populated.
Thank yourolleyes

> > Once you have registered the custom culture, it should automatically appear in the list of available languages.
> >
> > As I mentioned, the only confusing thing was that the Spanish name appeared in the list, although the list was in English. That meant that Español appeared after English and not with Spanish in the list.
> >
> > Selecting English or Native language with one of the buttons below the language list fixes this problem.
> >
> > Phil
>
> Phil i have created a new custom culture en-PR, i am not able to see if populate inside your list of available languages. Any Idea?
>
> I did create the es-Us using the project you sent me but this one was already on the list because i had ran the language addin the first time from a Vista machine so thats why it was already populated.
> Thank yourolleyes



I am very sorry its there, i was just maybe being to fast and missed it. GREAT ! Its working ! I am a super happy camper today! biggrin