Solved

Application in Multilanguage (internationationalization)

Posted on 2001-07-18
19
263 Views
Last Modified: 2012-06-21
Hi, all,
I need your help here.
I need to convert a English version of VB apps into other international language.
What is the best way to do it?
I'm attempting to use VB resource file to keep the translation but i wonder that is the correct way to do it? But then I have to segregate out the string(s) at User Interface, including the menu. What is the fastest way of doing it without compensating the future maintainability? Any available tools that can help me?

Please help.

Regards,

Becky
0
Comment
Question by:BeckyDD
  • 9
  • 6
  • 4
19 Comments
 
LVL 4

Expert Comment

by:VincentLawlor
ID: 6293285
Yes resource files are the best way of doing this.

You could also consider reading your resources on startup form a file. This means you could swap the file in and out depending on the language without having to recompile your code.

This file would be the same as a .Res file.

Vin.
0
 
LVL 4

Expert Comment

by:VincentLawlor
ID: 6293310
Sorry I meant to say similar to a res file

It would contain a list of name value pairs.

eg.

100=&File
101=&Close

etc.

You open this file on startup one line at a time and assign the names to your controls etc using their tag property where tag = value in the file.

If you don't want to do it this way then RES files are a good approach.

You can also define multiple languages in your RES file.
So if the default locale is changed the appropriate language is used.

Vin.
 
0
 

Author Comment

by:BeckyDD
ID: 6296590
Hi, Vincent,
Thanks for the response, but I have a problem here:
I'm using Res file, and I need to assign every single string that display to users with the LoadResString(index).
It means, I will have to add-in a many many lines of codes in my current apps including menu, tooltips, label, button, message box, etc...
And do it line by line cause each line will reference to a different index in my res file.

Does it sound correct?

Secondly, the different version only works when the users choose the differet locale setting....
what if I want to make it such a way that user just need to choose the language from my apps and the display will immediately change to the new language...

Does it make sense??

Sorry that, I'm too new with all this internationalization stuffs.. but would hope to get some advices from anybody ...

Thanks & regards,

Becky


0
 

Author Comment

by:BeckyDD
ID: 6296706
Hi, Vincent,
Thanks for the response, but I have a problem here:
I'm using Res file, and I need to assign every single string that display to users with the LoadResString(index).
It means, I will have to add-in a many many lines of codes in my current apps including menu, tooltips, label, button, message box, etc...
And do it line by line cause each line will reference to a different index in my res file.

Does it sound correct?

Secondly, the different version only works when the users choose the differet locale setting....
what if I want to make it such a way that user just need to choose the language from my apps and the display will immediately change to the new language...

Does it make sense??

Sorry that, I'm too new with all this internationalization stuffs.. but would hope to get some advices from anybody ...

Thanks & regards,

Becky


0
 
LVL 4

Expert Comment

by:VincentLawlor
ID: 6297601
>>I'm using Res file, and I need to assign every single string that display to users with the LoadResString(index).
It means, I will have to add-in a many many lines of codes in my current apps including menu, tooltips,
label, button, message box, etc...
And do it line by line cause each line will reference to a different index in my res file.

Yes that's the way is should be done.

>>Secondly, the different version only works when the users choose the differet locale setting....
what if I want to make it such a way that user just need to choose the language from my apps and the
display will immediately change to the new language...

Ok there is a way of doing this without changing the default locale on the machine.

Create two new ActiveX DLL projects (number of projects depends on the number of languages required but for this example two will suffice).

Name the projects as follows
LocalEnglish
LocalIrish

Rename Class1 in both cases Resource

Using the Resource Add in in Visual basic add a resource to each project name the .Res files LocalEnglish and LocalIrish.

Just for example add "How Are You" to the LocalEnglish resource and "Conas ata tu" to the LocalIrish resource.

Add the following code to each class module.

Public Function GetResourceString(ResourceIndex As Long) As String
         GetResourceString = LoadResData(ResourceIndex, 6)
End Function

Make both ActiveX DLLs. Save the projects and close them.

You now have a means of switching between resources in your code.

Just do the following and test it.


Dim objLocalised as Object
Dim strLanguage as String
strLanguage = "English"


Select Case strLanguage
   Case "English"
        objLocalised = CreateObject("LocalEnglish.Resource")
   Case "Irish"
        objLocalised = CreateObject("LocalIrish.Resource")
   Case Else
End Select

Dim strTemp as String  
strTemp = objLocalised.GetResourceString(101)

If you change the strLanguage to "Irish" you will get the Irish version of How are you.

That should be it.

Vin.


 

Vin.



 
0
 
LVL 4

Expert Comment

by:VincentLawlor
ID: 6301421
Just checking in how did you get on with this ?

Vin.
0
 
LVL 4

Expert Comment

by:VincentLawlor
ID: 6302596
Hmmm...

Vin.
0
 

Author Comment

by:BeckyDD
ID: 6311226
Hi, Vincent,
Thanks for the reply.
The problem is that I will have more than one .exe file in my app.
Is there any way I can make it a way that users can select the language from the app... and change it accordingly?

regards,
BK
0
 
LVL 4

Expert Comment

by:VincentLawlor
ID: 6311462
Ok to select the language:

Start with the default language say English.

Add a dialog to the application for language selection. This can be as simple as a combobox with a list of the supported languages.

In a module add a public String to indicate the language selected

Public gLanguageSelected as String

In your dialog box select the language.

gLanguageSelected = Selection


The rest of the code is the same as I described earlier.

Dim objLocalised as Object
Dim strLanguage as String
strLanguage = gLanguageSelected


Select Case strLanguage
  Case "English"
       objLocalised = CreateObject("LocalEnglish.Resource")
  Case "Irish"
       objLocalised = CreateObject("LocalIrish.Resource")
  Case Else
End Select

Dim strTemp as String  
strTemp = objLocalised.GetResourceString(101)

Vin.

Alternatively you can use the registry to pick the language.

Vin.



 

 
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 4

Expert Comment

by:VincentLawlor
ID: 6312747
Progress ??

Vin.
0
 
LVL 3

Expert Comment

by:modder
ID: 6409210
BeckyDD,

I've checked that you're still active on the site. You logged in yesterday. Please provide the feedback our expert is asking for. If they answered the question to your satisfaction, award the points. If not, let them know so they can continue working on a solution for you

Experts-Exchange is not a news group, in which you can post a question, get the answer, and walk away, or ignore any posts that do not serve to solve your problem.

You can read more about how the site works in our member agreement: http://experts-exchange.com/jsp/infoMemberAgreement.jsp

Although the agreement tells you something about how the site works, it doesn't tell you much about the netiquette that has evolved on our site. In Experts-Exchange it is expected that you always provide feedback to those who participate in the questions that you post. And I'll explain why this is the case.

When a question is resolved, it becomes a Previously Answered Question, and will be stored in the database. Users who have similar problems can buy your question for 1/10 of the original point value in order to find a solution to *their* problem.

A a result it is important that you provide feedback to our experts

If an expert provides a suggestion that solves your problem, award them by grading the answer so that the question does indeed become such a "PAQ". That way future visitors of this question get the most out of it.

If you did *not* get a satisfactory response to one of your questions, you have to tell participants that this is the case, so that they know that you have read and understood their suggestions, even though it didn't help you. After that, by all means, you can contact me or post a question in the Community Support topic area, and ask us to delete the question and refund your points.

I would also like you to consider this: Our experts are willing to spend some of their precious time to help you solve your problem. A lot of our experts are professionals, to whom time is money. And they're willingly giving up some of their time to help you.

And the only thing we're asking in return is a bit of feedback and an effort on your behalf to participate according to our member agreement and our peculiar brand of netiquette. I think that is a pretty good deal, don't you?

modder
Community Support Admin
0
 

Author Comment

by:BeckyDD
ID: 6409608
Thanks, Modder,

Thanks for your reminder. Sorry for my neglect. I was temporary off from the translation project. Vincent, thanks for the solution being provided.

In fact, VincentLawlor has give me a good suggestion, but then I was not very keen of the method being suggest at that time. There may be other method.

So, what is the best way I should do, Mr. Modder?

Regards,

Becky
0
 
LVL 3

Expert Comment

by:modder
ID: 6409661
Perhaps we could agree to award half the points or something? Vincent, how does that sound?
0
 
LVL 3

Expert Comment

by:modder
ID: 6409666
Anyway - thanks for responding. Between yourself and Vincent I hope you can come to an arrangement, and when you do, just let me know, and I will be of assistance with things that you can't do yourself.

Regards

modder
0
 
LVL 4

Accepted Solution

by:
VincentLawlor earned 80 total points
ID: 6409676
Hi,
That's fine with me all the points would be nice though :-)
Vin.
0
 

Author Comment

by:BeckyDD
ID: 6411765
Hi,
Thanks, Vincent. Emmh.. I agree to give you 80 points instead of 100. OK?
0
 
LVL 3

Expert Comment

by:modder
ID: 6412593
Sounds good to me. Sorted!
0
 
LVL 4

Expert Comment

by:VincentLawlor
ID: 6412597
That's cool thanks

Good luck.

Vin.
0
 

Author Comment

by:BeckyDD
ID: 6414518
Thanks, Vincent, Thanks Modder.
: )
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now