Can Access application have multi-languages? (1 Viewer)

AccessPractice

Registered User.
Local time
Tomorrow, 05:43
Joined
Jun 24, 2016
Messages
25
Hi
I want to create an application which can switch between languages.
What should I learn to be capable of making it.

Note: I will not create it now because I am learning the program (I am concentrating on VBA). But I would like to know the concept in advance.
Thank you
 

CJ_London

Super Moderator
Staff member
Local time
Today, 23:43
Joined
Feb 19, 2013
Messages
16,651
really depends on what you mean - if you mean just changing label captions to the local language you can have a table of language 'alternatives' which can populate to captions when the form is opened.

what to learn with this is sizing - a word or phrase in another language may have more characters than the English equivalent so the label needs to be wider, or if using abbreviations to reduce width, understand how that language abbreviates.

Other issues are character sets and punctuation characters - some languages use ; instead of , and how would you handle the accents in the French language for example?

and then handling user responses - they will probably have their local language settings and the data will no doubt be stored using the same setting, so your code will need to handle that as well.

finally, within your db, call your fields what you like but avoid spaces and non alphanumeric characters (use the _ if you must) and learn to use the caption property in field definitions so you get used to it.
 

Lightwave

Ad astra
Local time
Today, 23:43
Joined
Sep 27, 2004
Messages
1,521
I have used VBA attached to individual fields to automatically change keyboard layouts as you move between fields. I did a blog post which explains how you can change to a Russian layout and cyrillics - this can be done for any alphabet. Note in this example the user will have to know how to touch type in all alphabets you transfer between :)

VBA Function to allow alteration of Key Mapping for Multi-lingual support

Proviso : bear in mind that different operating systems have different support for languages – with Windows 7 you require ultimate version of the OS – happy to say that Win 8 has language support as standard. My environment when I first solved this was Win 7 ultimate.

So the problem – You are multi-lingual (or trying to be) and you regurlaly need to change mapping of your keyboard between alphabets (you can also touch type in both alphabets). You can do it manually everytime you need to change but it’s a pain, you have a database with fields some of which are in one language the others of which are in another language. You would like to alter keyboard mapping to specific languages on entering particular fields but how do you do it?

This can be done through VBA in MS Access no problem remembering the provisio that your OS must support your chosen language.

Code:
Private Declare Function ActivateKeyboardLayout Lib "user32.dll" (ByVal myLanguage As Long, Flag As Boolean) As Long 'define your desired keyboardlanguage

Private Const RSN = 1049 'russian keyboard language layout

Private Const eng = 1033 'english(united states)keyboard language layout
Private Sub A_GotFocus()
Call ActivateKeyboardLayout(RSN, 0)
End Sub

Private Sub A_LostFocus()
Call ActivateKeyboardLayout(eng, 0)
End Sub

You can choose different key mappings by altering the parameter codes. All available codes are here…

http://msdn.microsoft.com/en-gb/goglobal/bb964664.aspx

Look to the LCID Dec column.

My blog on it is exactly the same and found here
http://rounduptheusualsuspects.org/?p=39
 

AccessPractice

Registered User.
Local time
Tomorrow, 05:43
Joined
Jun 24, 2016
Messages
25
Hi Lightwave
Thank you for your suggestion.
I have to admit that I don't understand many details you provided.
I'm just an intermediate learner.
As a matter of fact, all I need is that my application must be supported
two languages mainly at the forms and message boxes responding to the users
since they aren't good at English.
I will frequently re-read your advice while I am now focusing on VBA and have much knowledge.
Thank you again.
 

ByteMyzer

AWF VIP
Local time
Today, 15:43
Joined
May 3, 2004
Messages
1,409
If all you are looking for is a way to determine in what language labels and messages should be displayed, you can do this in VBA quite easily with the GetUserDefaultUILanguage Windows API.

Study the code examples below. Once you become more familiar with VBA it will become immediately apparent how you can incorporate it in your application.

For more information on the values returned by this API, you can visit the following page:
Language Identifier Constants and Strings

In a new global module, paste and save the following code:
Code:
[COLOR="Navy"]Private Declare Function[/COLOR] GetUserDefaultUILanguage [COLOR="Navy"]Lib[/COLOR] "kernel32" () [COLOR="Navy"]As Long

Public Function[/COLOR] GetUILanguage() [COLOR="Navy"]As Long[/COLOR]
    GetUILanguage = GetUserDefaultUILanguage
[COLOR="Navy"]End Function[/COLOR]

Here are some examples of how to use this feature in your Form's code:
Code:
[COLOR="Navy"]Private Sub[/COLOR] Form_Open(Cancel [COLOR="Navy"]As Integer[/COLOR])

    [COLOR="DarkGreen"]' Set a label's caption based on the Language[/COLOR]
    [COLOR="Navy"]Select Case[/COLOR] GetUILanguage
        [COLOR="Navy"]Case[/COLOR] &[COLOR="Navy"]H[/COLOR]409 [COLOR="DarkGreen"]' United States (US)[/COLOR]
            Me.lblUser.Caption = "User Name"
        [COLOR="Navy"]Case[/COLOR] &[COLOR="Navy"]H[/COLOR]40[COLOR="Navy"]C[/COLOR] [COLOR="DarkGreen"]' France (FR)[/COLOR]
            Me.lblUser.Caption = "Nom d'utilisateur"
    [COLOR="Navy"]End Select

End Sub

Private Sub[/COLOR] cmdButton1_Click()

    [COLOR="DarkGreen"]' Display a message box based on the Language[/COLOR]
    [COLOR="Navy"]Select Case[/COLOR] GetUILanguage
        [COLOR="Navy"]Case[/COLOR] &[COLOR="Navy"]H[/COLOR]409 [COLOR="DarkGreen"]' United States (US)[/COLOR]
            MsgBox "You clicked on button 1"
        [COLOR="Navy"]Case[/COLOR] &[COLOR="Navy"]H[/COLOR]40[COLOR="Navy"]C[/COLOR] [COLOR="DarkGreen"]' France (FR)[/COLOR]
            MsgBox "Vous avez cliqué sur le bouton 1"
    [COLOR="Navy"]End Select

End Sub[/COLOR]
 

Users who are viewing this thread

Top Bottom