View previous topic :: View next topic |
Author |
Message |
JM Software
Joined: 18 Oct 2008 Posts: 1 Location: France
|
Posted: Sat Oct 18, 2008 1:03 pm Post subject: Automatic Localization |
|
|
I need to display the dialog boxes and licensing messages in French or English depending on user's cultureInfo.
In other words, I need to tell my application to use License.resources.fr when the user's culture is French and use License.resources in all other cases.
I want to compile a single installation package for both languages (not two).
Is there is simple way to do this by adding a couple of lines ?
Which ones?
Thanks,
Jean-Marie |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Sat Oct 18, 2008 10:36 pm Post subject: |
|
|
Quote: | I want to compile a single installation package for both languages (not two). Is there is simple way to do this by adding a couple of lines ? |
If you are including the licensing classes in your own application then this is the same process as for localizing the rest of your application. Add the required. For forms you can use the Visual Studio designer to add (and edit the language required. For the string resources you add the LicenseResources.fr.resx to your project as an embedded resource.
Then all you need to do is to set the Thread UICulture to the current Culture in your main program before forms are displayed. The resources will then be loaded in the most appropriate culture eg
Code: | Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture; |
If you are localizing your application then you should consider our Globalizer.NET product as this makes localizing much easier then using Visual Studio alone. We are looking for a French translator for this product at the moment. If you are interested you could receive a free license for Globalizer.NET. Email us at support@infralution.com if you are interested. _________________ Infralution Support |
|
Back to top |
|
|
CADbloke
Joined: 07 Jan 2016 Posts: 25 Location: Sydney
|
Posted: Sat Oct 13, 2018 9:28 am Post subject: |
|
|
10 years later I found an edge case problem with this...
I use ILS in an AutoCAD plugin, I'm in Australia so my system culture is en-au. AutoCAD (v2017) doesn't have an en-au resource set so it sets its culture to en-us. If my plugin sets it back to en-au I get exceptions from AutoCAD like Code: | System.IO.FileNotFoundException: Could not load file or assembly 'AcCustomize.resources, Culture=en-AU' or one of its dependencies. The system cannot find the file specified. |
so watch out for that one, just in case you're running inside a host application that doesn't understand there is a whole world out there that speaks better English than they do. |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Sun Oct 14, 2018 10:23 pm Post subject: |
|
|
Is the AcCustomize.resources part of your code or Autocad?
Are you setting the CurrentUICulture to the CurrentCulture as described previously in this topic?
It looks like Autocad (or perhaps you) is doing something slightly unusual and are loading files directly based on the CurrentUICulture without handling the possibility that this could be set to values that you don't have resources for. _________________ Infralution Support |
|
Back to top |
|
|
|