I want to change the language (1 Viewer)

abdo20

New member
Local time
Today, 16:54
Joined
Jul 15, 2020
Messages
10
I want to change the language through the buttons, and when opening any one of the forms, it will be like the selected language
 

Attachments

  • abdo - Copy.accdb
    2.6 MB · Views: 77

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 09:54
Joined
Feb 28, 2001
Messages
27,195
Access uses a library of text and messages for each language. You can download a language option file from Microsoft and can even manually make a given database file prefer the new language as a default. There are YouTube videos on that process.

The catch is that to have that language change (which is done through the File >> Options path) to take effect, you must close and restart Access. That tells me that the language change acts based on dynamic links built into a DLL file, which includes getting mapped into the MSACCESS.EXE program image. If Access doesn't have this kind of dynamic language feature built-in then you can't do what you wanted unless you somehow simulate it yourself.

More precisely, while it may be possible to change the language selection, you would not be able to keep Access open AND change the language in a way that it immediately takes effect.

If another of my colleagues knows a way to do this, I would defer to their knowledge, but I don't see an easy way because of the need to select what I believe to be a different language's library file via actions that normally only occur during image initialization.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 15:54
Joined
Feb 19, 2013
Messages
16,619
On my phone so not clear if you are talking about access or captions on forms. If the latter the only way I know is to have a table of translated captions and when a form opens code updates the form captions.

but not always enough - may need code to change messages in msg boxes and input boxes

I believe @isladogs has an example
 

isladogs

MVP / VIP
Local time
Today, 15:54
Joined
Jan 14, 2017
Messages
18,241
I do have an app for translating captions, message box and input box text though it hasn't yet been officially released.
Button text in message boxes is dependant on the Office language in use.
I'm not aware of being able to set a different Office language for individual files though it had never occurred to me to try.

You can see my approach at
 
Last edited:

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 09:54
Joined
Feb 28, 2001
Messages
27,195
As it appears, my colleagues have ways to simulate the behavior of actually changing the base language by changing things after-the-fact. My answer was based on changing the underlying language of the entire database.
 

isladogs

MVP / VIP
Local time
Today, 15:54
Joined
Jan 14, 2017
Messages
18,241
As it appears, my colleagues have ways to simulate the behavior of actually changing the base language by changing things after-the-fact. My answer was based on changing the underlying language of the entire database.
I think you got that back to front.
Changing the Office language as you described in post #2 does not alter the contents of any individual database other than modifying the language used for message box and input box buttons that is controlled by Access.
Similarly translating button / label captions as well as message box/input box/status bar text can be implemented independently of the Office language as I have done in my Application translator app and Peter Doering did with the old Northwind at AEK many years ago.
 
Last edited:

abdo20

New member
Local time
Today, 16:54
Joined
Jul 15, 2020
Messages
10
There is a script with sample databases by Peter Döring for multilingual applications, published at the Access Developer Conference 10 (2007), Organizer Karl Donaubauer.



Can the combo box be replaced with buttons?
 

Josef P.

Well-known member
Local time
Today, 16:54
Joined
Feb 2, 2023
Messages
827
Can the combo box be replaced with buttons?
In the example file from Peter is this code:
Code:
Private Sub fldSwitchLanguage_AfterUpdate()
    Dim strSQL As String
    Dim Rst As DAO.Recordset
    
    If Nz(Me!fldSwitchLanguage, 0) <> 0 Then
        
        lngLang = Me!fldSwitchLanguage.Value
        
        strSQL = "UPDATE tblSettings SET LangCode=" & lngLang
        CurrentDbC.Execute strSQL, dbFailOnError
        
        LoadLanguage Me
    End If
End Sub

A minor refactoring:
Code:
Private Sub fldSwitchLanguage_AfterUpdate()
    If Nz(Me!fldSwitchLanguage, 0) <> 0 Then
        SwitchLanguage Me!fldSwitchLanguage.Value
    End If
End Sub

Private Sub SwitchLanguage(ByVal NewLangId As Long)

    Dim strSQL As String
    Dim Rst As DAO.Recordset

    lngLang = NewLangId ' !!! lngLang is a global variable
    ' => I would change to Property and then implement the SQL statement in the property

    strSQL = "UPDATE tblSettings SET LangCode=" & NewLangId
    CurrentDbC.Execute strSQL, dbFailOnError
    
    LoadLanguage Me

End Sub
Do you see the possibility of using buttons now?
 

abdo20

New member
Local time
Today, 16:54
Joined
Jul 15, 2020
Messages
10
Can you help me here
 

Attachments

  • abdoo.accdb
    680 KB · Views: 60

Josef P.

Well-known member
Local time
Today, 16:54
Joined
Feb 2, 2023
Messages
827
What do you think happens when you call SwitchLanguage 1?
(SwitchLanguage from #9)
 

Users who are viewing this thread

Top Bottom