|
|||||||
New to SitePoint Forums? Register here for free!
|
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
SitePoint Addict
![]() ![]() ![]() Join Date: Mar 2004
Location: scotland
Posts: 242
|
help with translation function
hello,
im currently coding a function to translate between languages, however im having some problems, heres what i have so far Code:
public String translateEngAndFreToSol(int option) //option = 0 for english, 1 for french
{
String[] data = loadSave.getLoadedData().split("\\s"); // creates array of words (by splitting string where theres a space)
String output = "";
String word = "";
for(int i = 0; i < data.length; i++)
{
String prev = data[i]; //used to store data incase current word is not in mini dictionary
try
{
switch(option)
{
case 0: word = dictionary.getEntryByEngWord(data[i]).getSolWord();
break;
case 1: word = dictionary.getEntryByFreWord(data[i]).getSolWord();
break;
}
output += word + " ";
}
catch(NullPointerException e) //if word is not stored in the dictionary then use the value thats currently there, probally not best way to handle this
{
output += prev + " ";
}
}
return output.trim();
}
Hello, how are you? how do i get it to leave any grammer intact and only to translate the words? any help at all would be greatly appreciated |
|
|
|
| Bookmarks |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
|
All times are GMT -7. The time now is 00:40.









Threaded Mode