Click here to Skip to main content
15,907,687 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
See more:
Hi All,

At present my software support logs only in English language but my client need in different languages like Japanese, Korean, Turkish and Arabic etc.

Now instead of changing code from scratch and spending ample amount of time on retesting, what I am thinking is just to convert English language file to say Japanese language and show to user.

I tried using this code but it’s not working for me, it show same output

Say input here is “test input”

public static string ConverToJapaneese(string message)
        {
            string outputmessage = string.Empty;
            Encoding SourceEncoding = Encoding.GetEncoding("shift-jis");
            Encoding TargetEncoding = Encoding.UTF8;
            byte[] UnicodeBytes = TargetEncoding.GetBytes(message);
            byte[] JapaneeseBytes = Encoding.Convert(TargetEncoding, SourceEncoding, UnicodeBytes);
            char[] JapaneseChars = new char[SourceEncoding.GetCharCount(JapaneeseBytes, 0, JapaneeseBytes.Length)];
            SourceEncoding.GetChars(JapaneeseBytes, 0, JapaneeseBytes.Length, JapaneseChars, 0);
            string JapaneseString = new string(JapaneseChars);
            outputmessage = System.Text.Encoding.GetEncoding(932).GetString(JapaneeseBytes);
            
            return outputmessage;
        }


I learn its from this link
http://msdn.microsoft.com/en-us/library/system.text.encoding.aspx[^]

I will get solution if I can convert a file from one language to another.

Anyone can provide me better solution and throw some light on different encodings in different languages.
Thanks

[edit]Code block added, "Ignore HTML..." option disabled, link linkified - OriginalGriff[/edit]
Posted
Updated 23-Jun-11 0:11am
v2
Comments
sunder.tinwar 23-Jun-11 6:38am    
Is there a way to convert a single key press to the Japanese representation of that key press?

It will also resolve my issue.
sunder.tinwar 23-Jun-11 7:06am    
I found very nice tutorial on this link regarind unicode so sharing with you all

http://joelonsoftware.com/articles/Unicode.html

1 solution

I think you can use google translator API.
 
Share this answer
 
Comments
sunder.tinwar 23-Jun-11 6:30am    
I dont want to use any API if solution is possible. I have read that its possible. How facebook will convert you complete profile to some other langauge.

Here my client will having a particular language fonts intalled on his machine.
Sergey Alexandrovich Kryukov 23-Jun-11 12:35pm    
Don't you think it's absurd? What do you want then? You need the code for translator -- extremely difficult and expensive work. Where do you agree to get it; or write it by yourself (spend a lifetime, no less :-). What are your requirements? Stop telling about key press. How much you want to pay and what license are you agree on?
--SA
sunder.tinwar 23-Jun-11 6:37am    
Is there a way to convert a single key press to the Japanese representation of that key press?

It will also resolve my issue.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900