Live-Forum - Die aktuellen Beiträge
Anzeige
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Inhaltsverzeichnis

Multilang.. Mehrsprachig

Forumthread: Multilang.. Mehrsprachig

Multilang.. Mehrsprachig
15.11.2004 10:29:12
Andreas
Hallo zusammen...
ich muss Dialog mehrsprachig gestalten..
Wie kann ich die Ländereinstellung des Rechners auslesen und auf die eingestellte Sprache reagieren?
Thanx
Andreas
Anzeige

2
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: Multilang.. Mehrsprachig
15.11.2004 10:48:58
Frank
Hi Andreas
eine Variante (Nutzung von Windows API-Calls):
1. Füge folgendes in ein Klassenmodul (z.B.: clsCountrySettings) ein:
'---------------------------------------------------------------------------
'Module: clsCountrySettings (class module)
'Purpose: Contains all code for getting the country settings
' for the language from the Windows syste,
'---------------------------------------------------------------------------
Option Explicit
Private Declare Function GetThreadLocale Lib "kernel32" () As Long
Private Declare Function GetSystemDefaultLCID Lib "kernel32" () 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
Const LOCALE_ILANGUAGE As Long = &H1 'language id
Const LOCALE_SLANGUAGE As Long = &H2 'localized name of lang
Const LOCALE_SENGLANGUAGE As Long = &H1001 'English name of lang
Const LOCALE_SABBREVLANGNAME As Long = &H3 'abbreviated lang name
Const LOCALE_SNATIVELANGNAME As Long = &H4 'native name of lang
Const LOCALE_ICOUNTRY As Long = &H5 'country code
Const LOCALE_SCOUNTRY As Long = &H6 'localized name of country
Const LOCALE_SENGCOUNTRY As Long = &H1002 'English name of country
Const LOCALE_SABBREVCTRYNAME As Long = &H7 'abbreviated country name
Const LOCALE_SNATIVECTRYNAME As Long = &H8 'native name of country
Const LOCALE_SINTLSYMBOL As Long = &H15 'intl monetary symbol
Const LOCALE_IDEFAULTLANGUAGE As Long = &H9 'def language id
Const LOCALE_IDEFAULTCOUNTRY As Long = &HA 'def country code
Const LOCALE_IDEFAULTCODEPAGE As Long = &HB 'def oem code page
Const LOCALE_IDEFAULTANSICODEPAGE As Long = &H1004 'def ansi code page
Const LOCALE_IDEFAULTMACCODEPAGE As Long = &H1011 'def mac code page
Const LOCALE_IMEASURE As Long = &HD '0 = metric, 1 = US
'#if(WINVER >= &H0400)
Const LOCALE_SISO639LANGNAME As Long = &H59 'ISO abbreviated language name
Const LOCALE_SISO3166CTRYNAME As Long = &H5A 'ISO abbreviated country name
'#endif /* WINVER >= as long = &H0400 */
'#if(WINVER >= &H0500)
Const LOCALE_SNATIVECURRNAME As Long = &H1008 'native name of currency
Const LOCALE_IDEFAULTEBCDICCODEPAGE As Long = &H1012 'default ebcdic code page
Const LOCALE_SSORTNAME As Long = &H1013 'sort name
'#endif /* WINVER >= &H0500 */
Dim LCID As Long
'---------------------------------------------------------------------------
Public Function GetUserLocaleInfo(ByVal dwLocaleID As Long, ByVal dwLCType As Long) _
As String
'---------------------------------------------------------------------------
Dim sReturn As String
Dim r As Long
'call the function passing the Locale type
'variable to retrieve the required size of
'the string buffer needed
r = GetLocaleInfo(dwLocaleID, dwLCType, sReturn, Len(sReturn))
'if successful..
If r Then
'pad the buffer with spaces
sReturn = Space$(r)
'and call again passing the buffer
r = GetLocaleInfo(dwLocaleID, dwLCType, sReturn, Len(sReturn))
'if successful (r > 0)
If r Then
'r holds the size of the string
'including the terminating null
GetUserLocaleInfo = Left$(sReturn, r - 1)
End If
End If
End Function
'---------------------------------------------------------------------------

Private Sub Class_Initialize()
LCID = GetSystemDefaultLCID()
End Sub

'---------------------------------------------------------------------------
Public Property Get LanguageName() As String
'---------------------------------------------------------------------------
'LOCALE_SENGLANGUAGE
'Full English name of the language from the International
'Organization for Standardization (ISO) Standard 639.
'This is always restricted to characters that can be
'mapped into the ASCII 127-character subset. This is
'not always equivalent to the English version of LOCALE_SLANGUAGE.
LanguageName = GetUserLocaleInfo(LCID, LOCALE_SENGLANGUAGE)
End Property
2. Und nun kannst du das wie folgt in Deinem Code aufrufen:
sub foo()
Dim cCty As clsCountrySettings
Set cCty = New clsCountrySettings
msgbox cCty.LanguageName
End Sub
sollte dann je nach Sprache folgendes zurückgeben:
Deutsch
English
Francais
...
Basierend darauf kannst Du dann einen Dialog mehrsprachig gestalten. Zwei Möglichkeiten, die Texte zu speichern:
1. Verborgenes Arbeitsbaltt mit einer Spalte je Sprache
2. INI-Datei mit den Sprachcodes
Wünsche Dir viel Erfolgt mit der 'Mehrsprachigkeit'.
Frank
Anzeige
AW: Multilang.. Mehrsprachig
15.11.2004 10:56:34
Andreas
Schon mal ein dickes DANKE...
Test the rest..
melde mich noch mal.
Gruß Andreas
;

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Entdecke mehr
Finde genau, was du suchst

Die erweiterte Suchfunktion hilft dir, gezielt die besten Antworten zu finden

Suche nach den besten Antworten
Unsere beliebtesten Threads

Entdecke unsere meistgeklickten Beiträge in der Google Suche

Top 100 Threads jetzt ansehen
Anzeige