Click here to Skip to main content
15,878,959 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to design c# window forms app. to translate the text in multiple langauge for this i have two textboxes i.e., txtbox1 and txtbox2 and 3 buttons english,french,russian
i have added three resource files res.en.resx,res.ru.resx,res.fr.resx in the project.

after entering the text in textbox1 if i press the french button it should translate the content english to french.

can anyone help with the code for buttons in c#

What I have tried:

i am trying to work on offline translator without internet connection by storing some words in resource files. i need the both original text and translated text to be visible.
Posted
Updated 19-Sep-16 22:44pm
v2
Comments
Bernhard Hiller 20-Sep-16 2:48am    
"offline" - that's why you tagged the question "ASP.NET", isn't it?
No, the way you try to translate won't work for sentences, that won't even be useful for words, as words may have several meanings which means that a choice of words must be presented in the other language. Haven't you ever used a printed dictionary?
Member 12650438 20-Sep-16 3:14am    
i want to save some words in resource file so if i enter that words and press the language button it should translate
Richard MacCutchan 20-Sep-16 4:22am    
Then you just need to set up a number of tables in your code with the translations of each word in the same order in each table. You then find the index of the word selected by the user, and find the translation(s), which will be at the same index in the other table(s). Not very sophisticated but it will do the basics.

Quote:
can anyone help with the code for buttons in c#


not sure what you need from us here - when you're in forms design mode, if you select a button, look at the properties, select the events (look for the lightning bolt symbol iirc), you can see for example 'click' event. If you click on this, the system will insert a click handler for you - iirc (I dont have VS open) you can change the name of the handler, but if the buttons are properly named I usually dont need to. ... you then fill in the code in the supplied button click event handler to handle reading from txtbox1, translating and setting txtbox2 to the result

you need to find yourself a good tutorial on WinForms to get the hand of this - Im not sure if this Step 1: Create a Windows Forms Application Project[^] is good enough .. this one might be better https://www.dotnetperls.com/button[^] ..

Is that what you wanted ? or maybe you need this Google Translate Desktop Application in C#.NET[^] to help you start on one possible way of doing the translate
 
Share this answer
 
Comments
Member 12650438 20-Sep-16 3:15am    
i want same exactly working like google translator but only for limited number of words which are stored in resource file
We aren't a code-to-order service - here's two projects that may give you ideas/material to pull apart

GitHub - HakanL/resxtranslator: Resx Resource Translator[^]

.NET Resource (.resx file) Translator[^]
 
Share this answer
 
Comments
Member 12650438 20-Sep-16 6:30am    
cant we develop an c# windows forms applciation regarding the resource files with some data in different languages
Garth J Lancaster 20-Sep-16 7:24am    
sure you can
Member 12650438 21-Sep-16 7:03am    
how can i develop such a application by using resource file.
Garth J Lancaster 21-Sep-16 7:58am    
ok, whats wrong with this http://www.codeproject.com/Articles/5447/NET-Localization-using-Resource-file ?

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