Results 1 to 16 of 16

Thread: Multilingual application?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    top of the mountain
    Posts
    234

    Question Multilingual application?

    I need to write multilingual application (two languages). That's means labels, buttons and other objects on forms display in language which user can select. Generally, how to do that?

    p.s. this n-tier (3-tier) application with central database on remote machine

    regards

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Search General VB Questions Forum for a lot of links I posted about Application Globalization . It should help you .

  3. #3
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367
    If I were doing this I would store all of my strings that go on buttons, labels and menus in a database or XML file.

    Then when they want to switch languages load the string from the database/XML.

    Hope this helps,

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    top of the mountain
    Posts
    234
    In that approach, I must on every form in load event read label(s).text, button(s).text ... from database or xml. I'm wondering is that poor (slow) solution?

    regards

  5. #5
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367
    Well you could load all of the appropriate language information into memory to start, and only hit the database/XML when the application loads, or when they switch languages.

  6. #6
    Frenzied Member MrGTI's Avatar
    Join Date
    Oct 2000
    Location
    Ontario, Canada
    Posts
    1,277

    Talking

    Or you could just tell everyone that doesn't understand english to take an ESL course.

    I thought we used resource files in VB6 to do this? You just loaded the language from the resource file. I never did it, but i heard lots about it. Maybe jump over to the VB6 forum and search for resource files and languages.
    ~Peter


  7. #7
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    This is exactly why VB has RESOURCE files.... look into that on MSDN... I know there is a tutorial on there on how to "globalize" an app.
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  8. #8
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by techgnome
    This is exactly why VB has RESOURCE files.... look into that on MSDN... I know there is a tutorial on there on how to "globalize" an app.
    If you store all language inof in resource file , then you have to recompile your proj not like XML or DB file . So better you go for either XML or DB .

  9. #9
    Frenzied Member MrGTI's Avatar
    Join Date
    Oct 2000
    Location
    Ontario, Canada
    Posts
    1,277

    Post

    You'd have to recompile the project anyway to use any new fields.

    Look into the resource file. I agree that it was created to do stuff like that.
    ~Peter


  10. #10
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Well , I wasn't talking about .NET . That was in VB6 as I can remember.

  11. #11
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536
    Read "Developing International Software" by Dr. International from Microsoft Press (ISBN 0-7356-1583-7).

    Each form in your project has a Localizable property. Set this to true and VB will create a resource file (e.g. Form1.resx) for your form. Copy these forms and rename them as (e.g. From1.fr.resx). The "fr" in this example is French, you use "ja" for Japanese and so on. Edit Form1.fr.resx and translate the .Text properties. Recompile your program and run it on a French PC - Form1 will pick up the translations from Form1.fr.resx.

    You can also force a change of Culture (e.g. language) from code.
    This world is not my home. I'm just passing through.

  12. #12
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by trisuglow
    Read "Developing International Software" by Dr. International from Microsoft Press (ISBN 0-7356-1583-7).

    Each form in your project has a Localizable property. Set this to true and VB will create a resource file (e.g. Form1.resx) for your form. Copy these forms and rename them as (e.g. From1.fr.resx). The "fr" in this example is French, you use "ja" for Japanese and so on. Edit Form1.fr.resx and translate the .Text properties. Recompile your program and run it on a French PC - Form1 will pick up the translations from Form1.fr.resx.

    You can also force a change of Culture (e.g. language) from code.
    This means , if you want to release another version then you have to add the changes and recompile the whole proj . am I right ?

  13. #13
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536
    Yes,

    I believe that if you want to add a new (spoken) language to your application you will have to provide appropriate .resx files and recompile.

    I believe that it is possible to write code to look for .resx files at run time and load them in, but I imagine this would be quite hard work and you wouldn't be taking advantage of the built-in facilities on offer. I wouldn't know how to start on this...
    This world is not my home. I'm just passing through.

  14. #14
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Dude , use XML or database . The only thing you need is to add some translated lablel captions and that's it !

  15. #15
    New Member
    Join Date
    Jun 2009
    Posts
    6

    Re: Multilingual application?

    Keep in mind that translating labels will not resize your controls.

    What you can do is
    1. Set the localizable property in the form you are working on to TRUE and change the language from default to the language you are translating it to.

    2.After you've selected the language you may then change the text and size and anything else you need to change.

    3. When you are done with your changes set the localizable property on the form back to default.

    This will automatically generate the resource files for the form in each language you've worked with in your form (no need to manually rename the forms). This is lighter in the end, since the assemblies will only contain the localizable information.
    Your application will be loaded in the correct language according to the user's OS settings.

    Hope this helps

  16. #16
    Fanatic Member
    Join Date
    Aug 2009
    Posts
    540

    Re: Multilingual application?

    Gabe, get back to work and stop resurrecting dead threads :P

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width