I have an established program that I am changing to allow users to select
one of eight languages and have all the label captions change accordingly.
I have no problems with English, French, Dutch, German, Spanish or Italian.
The Polish language is causing me trouble.
From what I have read, VB supports UNICODE, in fact it uses UNICODE
internally, which means that ANY character in pretty much any language
should be readable from a UNICODE encoded text file and displayed correctly.
My text files display correctly in Notepad, Wordpad and MS Word. I have
saved the text files in Notepad because I don't need extraneous formatting
characters imbedded in the text file.
The following example text is read correctly from my file and displays
correctly as captions.
Français
NÄHEN
fintantoché
vänligen
aktivitetsfältet
één
The following Polish text does not display correctly. The "special"
characters are either displayed as weird graphic boxes or are split into two
different letters.
UKLAD ZAGLA
BUDOWANIE "DESKI Z GWOZDZIAMI"
zalaczajac
Jesli Twój
I have scoured the 'net until my eyes started burning trying to find a
solution to this problem.
Here is the code that I use to load the strings from the text file.
===========================================
Public Sub LoadLanguage()
Rem Load the appropriate language file from harddrive
On Error GoTo ErrorHandler ' Enable error-handling routine.
Select Case Language
Case 1
Open App.Path & "\Lang-NPW9bEnglish.ltf" For Input As #1
Case 2
Open App.Path & "\Lang-NPW9bDutch.ltf" For Input As #1
Case 3
Open App.Path & "\Lang-NPW9bFrench.ltf" For Input As #1
Case 4
Open App.Path & "\Lang-NPW9bGerman.ltf" For Input As #1
Case 5
Open App.Path & "\Lang-NPW9bItalian.ltf" For Input As #1
Case 6
Open App.Path & "\Lang-NPW9bSwedish.ltf" For Input As #1
Case 7
Open App.Path & "\Lang-NPW9bSpanish.ltf" For Input As #1
Case 8
Open App.Path & "\Lang-NPW9bPolish.ltf" For Input As #1
End Select
Do While Not EOF(1)
Line Input #1, Text ' read the entire line from file until carriage return
character encountered
x = Val(Left$(Text, 3)) ' read the 3 leftmost characters and use that
number for array
If x > 0 Then ' if line is blank then don't read the line
Phrase(x) = Right$(Text, Len(Text) - 4) 'the phrase becomes the entire
line minus the first four characters (the array number!)
End If
Loop
Close #1
Call Form_Load
Exit Sub ' Exit to avoid handler.
ErrorHandler: ' Error-handling routine.
CR = Chr$(10) & Chr$(13)
Select Case Err.Number ' Evaluate error number.
Case 53
Msg = "The language file could not be found. Please place the" & CR
Msg = Msg & "Lang-NPW9bxxxxx.ltf files in the same folder" & CR
Msg = Msg & " where this program is located and try again."
MsgBox Msg, , "Language File Not Found"
Err.Clear ' Clear Err object fields
End Select
End Sub
================================================== ==
Any help you can provide will be much appreciated.
If you need to see this for yourself, you can download my .exe from
http://members.shaw.ca/kyrawhite/Vis...PW9bLanguages/
Also download the .ltf (language translation files in text format) and put
them in same folder as .exe.
Tom