I have to print some text to printer. I needed to translate that text in Urdu language also. For that I used google translation API and all was set. But I am facing problem in order of output.
// this is the code which is giving my desired output
String text = "Honda head light large size"
String translatedText = GoogleTranslate.translate("ur", text);
String myString = "Saboor"
String printString = String.format("%-15s %-15s
%-10s",text,translatedText,myString);
graphics.drawString(printString,x,y)
//Above code is giving me correct output as following
Honda head light large size urdu translation Saboor
// Now pasting the code which create problem:
String text = "Honda head light large size"
String translatedText = GoogleTranslate.translate("ur", text);
int val = 10
String printString = String.format("%-15s %-15s
%-10s",text,translatedText,val);
graphics.drawString(printString,x,y);
// now the output of this code is following(which i don't want):
Honda head light large size 10 udru translation
// but i need following output:
Honda head light large size urdu translation 10
This question may already have an answer here:
How can I create table using ASCII in a console? 8 answers
I have to print some text to printer. I needed to translate that text in Urdu language also. For that I used google translation API and all was set. But I am facing problem in order of output.
// this is the code which is giving my desired output
String text = "Honda head light large size"
String translatedText = GoogleTranslate.translate("ur", text);
String myString = "Saboor"
String printString = String.format("%-15s %-15s
%-10s",text,translatedText,myString);
graphics.drawString(printString,x,y)
//Above code is giving me correct output as following
Honda head light large size urdu translation Saboor
// Now pasting the code which create problem:
String text = "Honda head light large size"
String translatedText = GoogleTranslate.translate("ur", text);
int val = 10
String printString = String.format("%-15s %-15s
%-10s",text,translatedText,val);
graphics.drawString(printString,x,y);
// now the output of this code is following(which i don't want):
Honda head light large size 10 udru translation
// but i need following output:
Honda head light large size urdu translation 10
As you see in case of code(correct output), after printing translated text, when i print a String , it prints correctly.
But after printing translated text,when i print a decimal or float number , alignment or order goes wrong. Please guide me, why is this happening?
Note: Urdu language has right to left direction.