Простейшее решение:
1. Сделайте табличку tblLangWords:
ID | Russia | UnatedStates | Ukraina | 1 | Номер | Number | ... | 2 | Выход | Exit | ... | 3 | Введите пароль | Enter password | ... | ... | ... | ... | ... | 2001 | Количество | Quantity | ... |
|
2. Каждому лейблу, который должен переводиться, пропишите в Tag нужный номер - 1, 2, 3, ...
3. На событие Load каждой формы поставьте:
Dim ctl As Control
For Each ctl In Me.Controls
If TypeOf ctl Is Label Then
If ctl.Tag <> "" And Not IsNull(ctl.Tag) Then
ctl.Caption = LoadString(ctl.Tag)
End If
End If
Next ctl
4. Создайте стандартный модуль и скопируйте туда нижеследующий код:
Option Compare Database
Option Explicit
Private Const LOCALE_SCOUNTRY As Long = &H6
Private Declare Function GetKeyboardLayout Lib "user32" _
(ByVal dwLayout As Long) As Long
Private Declare Function GetLocaleInfo Lib "kernel32" _
Alias "GetLocaleInfoA" _
(ByVal Locale As Long, _
ByVal LCType As Long, _
ByVal lpLCData As String, _
ByVal cchData As Long) As Long
Private Function GetUserLocaleInfo(ByVal dwLocaleID As Long, _
ByVal dwLCType As Long) As String
Dim sReturn As String
Dim nSize As Long
nSize = GetLocaleInfo(dwLocaleID, dwLCType, sReturn, Len(sReturn))
If nSize > 0 Then
sReturn = Space$(nSize)
nSize = GetLocaleInfo(dwLocaleID, dwLCType, sReturn, Len(sReturn))
If nSize > 0 Then
GetUserLocaleInfo = Left$(sReturn, nSize - 1)
End If
End If
End Function
Private Function LoWord(wParam As Long) As Integer
If wParam And &H8000& Then
LoWord = &H8000& Or (wParam And &H7FFF&)
Else
LoWord = wParam And &HFFFF&
End If
End Function
Public Function sCountry() As String
Dim hKeyboardID As Long
Dim LCID As Long
hKeyboardID = GetKeyboardLayout(0&)
If hKeyboardID > 0 Then LCID = LoWord(hKeyboardID)
If LCID Then sCountry = Replace(GetUserLocaleInfo(LCID, LOCALE_SCOUNTRY)," ","")
End Function
Public Function LoadString(wdNumber As Long) As String
On Error GoTo HandleErrors
Dim strLoadString As String
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim strSQL As String
Set db = CurrentDb
strSQL = "SELECT tblLangWords." & sCountry _
& " FROM tblLangWords" _
& " WHERE tblLangWords.ID = " & wdNumber & ";"
Set rst = db.OpenRecordset(strSQL, dbOpenSnapshot)
If Not rst.EOF Then
rst.MoveFirst
strLoadString = rst("wdText")
End If
exithere:
On Error Resume Next
rst.Close
db.Close
Set rst = Nothing
Set db = Nothing
LoadString = strLoadString
Exit Function
HandleErrors:
MsgBox "MyModuleName - LoadString:" & vbNewLine & Err.Number & vbTab & Err.Description
Resume exithere
End Function
Все, можно играться...