keyongtech


  keyongtech > dotnet.languages.* > dotnet.languages.csharp > 01/2008

 #1  
01-29-08, 09:27 PM
DR
how to determine what language a c# string is written in? is there any C#
method to take a string and return what language it is in? e.g. english,
hindi, spanish, etc.
 #2  
01-29-08, 09:43 PM
Nicholas Paldino [.NET/C# MVP]
DR,

You can't tell definitively.

The best you could do is check each character in the string and then see
what code chart the character is a part of (you will have to find out which
code charts you want to support, as there is no way in .NET (AFAIK) that you
can find this out) and then make a determination from there.

The thing is, many characters are used interchangibly (for example, an
"a" is used in a number of languages), so you can't be sure what language
the code chart is used for.

In the end, you are better off having the user specify the language.
 #3  
01-30-08, 09:22 AM
Norman Diamond
You can use the Encoding class to find out if a string can convert to some
code page. However, words like "comment" or "gift" or "air" will be fully
representable in lots and lots of code pages, not just in the code pages
that are commonly used for French and German and Indonesian.

Even if you decide somehow to choose a favourite code page, I still don't
think a C# method is going to tell you that those strings are French,
German, and Indonesian.

You can use Google to translate those strings to English. The original
poster might be in for a surprise.


"Nicholas Paldino [.NET/C# MVP]" <mvp> wrote in
message news:5160
[..]
 #4  
01-30-08, 06:23 PM
Pedro Luna Montalvo
Don't forget words like: configure, extra, local, visual, simple, produce,
constructor, variable.

The only way to figure out is these word corresponds to english or spanish
is not only checking the word itself, but the context they're used.

Greetings,



"Norman Diamond" <ndiamond> escribio en el mensaje de
noticias:##ahjGyYIHA.1132...
[..]
 #5  
01-30-08, 06:56 PM
Jon Skeet [C# MVP]
Pedro Luna Montalvo <petermoon> wrote:
> Don't forget words like: configure, extra, local, visual, simple, produce,
> constructor, variable.


Other words which might confuse the original poster are:
"multi-post", "don't" "subject", "body", "difference", "netiquette"

It seems impossible to get through to him...
 #6  
01-31-08, 02:19 AM
Arne Vajhøj
DR wrote:
> how to determine what language a c# string is written in? is there any C#
> method to take a string and return what language it is in? e.g. english,
> hindi, spanish, etc.


Not with 100% certainty.

If it is normal text in the languages, then you may be
able to deduce something from the frequencies of letters.

Arne
Similar Threads
how to determine what language a c# string is written in? is there any C# method to take a string and return what language it is in? e.g. english, hindi, spanish, etc.

how to determine what language a c# string is written in? is there any C# method to take a string and return what language it is in? e.g. english, hindi, spanish, etc.

how to determine what language a c# string is written in? is there any C# method to take a string and return what language it is in? e.g. english, hindi, spanish, etc.

how to determine what language a c# string is written in? is there any C# method to take a string and return what language it is in? e.g. english, hindi, spanish, etc.

how to determine what language a string is written in? is there any method to take a string and return what language it is in? e.g. english, hindi, spanish, etc.

how to determine what language a string is written in? is there any method to take a string and return what language it is in? e.g. english, hindi, spanish, etc.

Read an email written in Hindi(Indian) language in Outlook 2003.

display an english text string in another language

Hi all, I'm very new with COBOL and working on displaying an english text string in another language such as korean, japanese, farsi, etc. This is what I have in my program...


All times are GMT. The time now is 07:26 AM. | Privacy Policy