473,397 Members | 1,950 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Spelling in a foreign language

PhilOfWalton
1,430 Expert 1GB
Has anybody got any thoughts about checking words against foreign dictionaries.

For Example, suppose the word is "Wurst" in German, I want that to return True, but "Vurst" to return false

I believe DoCmd.RunCommand acCmdSpelling only checks in the native language.

In addition, the spell checker only seems to list 3 languages (all various varieties of English, French & Spanish), but not German

Thanks

Phil
Sep 25 '17 #1

✓ answered by Rabbit

What if you downloaded databases of words in different languages? You could DLookUp to that to determine if the word is part of that language.

7 2370
ADezii
8,834 Expert 8TB
  1. This is Theory (Air Code), Phil. I know that it works for English and I can only assume that it works for other Languages assuming you have the appropriate Dictionary installed.
  2. The idea is to:
    1. Create an Instance of Excel.
    2. Change the Language used for Spell Checking (DictLang Property).
    3. Execute the CheckSpelling() Method of the newly created Excel Application Object against the Word.
  3. Code Definition:
    Expand|Select|Wrap|Line Numbers
    1. Dim appExcel As Excel.Application
    2.  
    3. Set appExcel = New Excel.Application
    4.  
    5. With appExcel
    6.   .Visible = False
    7.   .SpellingOptions.DictLang = 1033      'Works for English
    8.      Debug.Print IIf(.CheckSpelling(Word:="Vurst"), "Valid", "NOT Valid")
    9. End With
    10.  
    11. appExcel.Quit
    12. Set appExcel = Nothing
    13.  
  4. Options for German Language (Value of DictLang):
    Expand|Select|Wrap|Line Numbers
    1. 'German - 1031
    2. 'GermanAustria - 3079
    3. 'GermanLiechtenstein - 5127
    4. 'GermanLuxembourg - 4103
    5.  
  5. Again, this is only Air Code and I am assuming that you will have to have the Custom Dictionary (*.dic) installed.
  6. Assuming all works out well, False should appear in the Immediate Window.
  7. Good Luck with your Project.
Sep 25 '17 #2
PhilOfWalton
1,430 Expert 1GB
Thank for that. I have modified the code to
Expand|Select|Wrap|Line Numbers
  1. Function CheckSpelling2(InputStr As String, DictionaryLanguage As Long)
  2.     ' DictionaryLanguage = 2057 for UK Englisg, 1031 for German German
  3. '?checkspelling2("deutch", 1031)        ' This gives an error that the language is not installed
  4. '?checkspelling2("dog", 2057)           ' This works
  5.  
  6.     Dim Result As Boolean
  7.     Dim Marker As Integer
  8.     On Error GoTo CheckSpelling2_Err
  9.  
  10.     Dim appExcel As Excel.Application
  11.  
  12.     Set appExcel = New Excel.Application
  13.  
  14.     With appExcel
  15.         .Visible = False
  16.         Marker = 1
  17.         .SpellingOptions.DictLang = DictionaryLanguage     'Works for English
  18.         Marker = 2
  19.         Result = .CheckSpelling(InputStr)
  20. CheckSpelling2_Exit:
  21.         .DisplayAlerts = False
  22.         .Quit
  23.         Set appExcel = Nothing
  24.     End With
  25.  
  26.     Debug.Print Result
  27.  
  28.     Exit Function
  29.  
  30. CheckSpelling2_Err:
  31.     If Err = 1004 Then
  32.         MsgBox "Neccessary language is not installed", vbCritical
  33.     Else
  34.         LogError Err, Err.Description, "CheckSpelling2", Marker
  35.     End If
  36.  
  37.     Resume CheckSpelling2_Exit
  38.  
  39. End Function
  40.  
The LogError is just a routine to save any unhandled errors to a table.

It works perfectly for English, bu in spite of having installed the German language pack, I get the Error 1004 coming up.

Any forther thought would be appreciated

Phil
Sep 25 '17 #3
PhilOfWalton
1,430 Expert 1GB
Just found another problem. which I thought the .DisplayAlerts = False would cure, and that is that I get numerous messages "Do you want to save Sheet 1?

Phil
Sep 25 '17 #4
ADezii
8,834 Expert 8TB
Not really sure on this one, Phil. You could research the 2nd Argument of the CheckSpelling() Method where you can optionally set the Custom Dictionary to use.
Expand|Select|Wrap|Line Numbers
  1. Application.CheckSpelling(Word As String,[CustomDictionary],[IgnoreUppercase]) As Boolean
Sep 26 '17 #5
PhilOfWalton
1,430 Expert 1GB
Don't think that that is a runner. As far as I know, the Custom Dictionary is your personal dictionary to which you can add your own words.

I think spell check checks the standard directory and then the custom directory to see if a word exists.

Phil
Sep 26 '17 #6
Rabbit
12,516 Expert Mod 8TB
What if you downloaded databases of words in different languages? You could DLookUp to that to determine if the word is part of that language.
Sep 26 '17 #7
PhilOfWalton
1,430 Expert 1GB
That sounds feasible, Rabbit.

I have just downloaded about 1.2 million German words, and it checks if a word exists in about .5 seconds.

I shall play with this further.

Many thanks

Phil
Sep 26 '17 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Irishmaninusa | last post by:
Hello, I have a form which has a check box on it and the name of the checkbox in the source code is "Übermitteln Sie mir bitte folgende Informationen über den ValuePark:" When I submit this...
0
by: Lady_A | last post by:
Hi, I have an XP SP2, .net framework 1.1 SP1. An html/css interface using jscripts in which I create ActiveX objects and present a dialog using the appropriate language set by the user on that...
1
by: Dave | last post by:
Hi All, I have a VS.NET 2003 solution that uses several setup projects to package various components and applications into MSI files. I need to provide foreign language support for 5-6 languages...
2
by: jaekim | last post by:
Visual .NET c# design view is showing "?????" for all the Korean characters in design view. In code view, it looks okay. Did anybody have this kind of problem with foreign characters?
2
by: Calvin Lai | last post by:
Hi all, I have a serious problem with the application I am developing. The language I used are mainly English, and some Chinese. (But I guess this problem happens accross different language). ...
1
by: Krich | last post by:
I have text file contains word in English language and in foreign language and I include this text file as embedded resource in my project. VB.NET editor can display the foreign langue of this...
4
by: Dave | last post by:
Hi All, Don't know if anyone has ever come across this but was just wondering. Am programming something to be used in a number of countires and was asking regarding Fonts. I have a page to...
1
by: mohammedsk | last post by:
Hi, I am trying to save information into MySQL using PHP. The data I am saving is in Arabic language. The database table will show some "???" or other characters. If I insert the text directly...
0
by: Fineen | last post by:
I have been interested in learning Italian for quite a long time and I have finally decided to take the plunge! I have found a good course consolidator voyages linguistiques angleterre , estudiar...
1
by: rosscos20 | last post by:
I am creating a dual language website containing both English and Hebrew versions. The Hebrew javascript does not display in IE, the English works perfectly? How do I solve the problem?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.