Jump to content

GTRANS usage


cgarnier

Recommended Posts

Hi,

Sorry to bother you with such a topic but usage of GTRANS is quite unclear for me... I understand that every text that I need to translate can be stored in a structure and then use with gtrans methods. 

My application has 5 pages, and I have to translate each page from one language to another when a button is pressed (a setting for user). All my application has to change and stay in the new current language. It works fine with widgets like buttons and labels using gwinSetText + gtransIndex/gt but if I use the gdispFillStringBox as in the demo, the translation disappear once I leave the current page. So, my question is, do I have to make everything a widget and use gwinSetText + gtransIndex/gt for my language to stay as asked by the user or is there another way to do it that I didn't find/think of?

I also have a question about UTF8. My basic language is French, and some vowels need accent. It works well when the application starts, my French words are written correctly, but when I switch to English then back in French with gtrans tool, UTF8 isn't supported anymore and I've got question marks replacing my accentuated vowels... I'm using a custom font that was well converted to support those special letters, any idea where does it come from?

Thank's for your help, and do not hesitate to ask for more details if my questions are unclear !

Charlotte

Link to comment
Share on other sites

Hello Charlotte,

The text rendering functions provided by the GDISP module (such as gdispFillStringBox()) don't store the text anywhere in memory. Those functions simply set the pixels correctly to display that text and then everything gets forgotten. They are simple pixel manipulation functions, they don't have any intelligence or memory. That is what labels are there for: They store the text themselves so if they need to be redrawn (eg. when changing the display page) they can redraw themselves because they retain the text they are supposed to display in memory (the GWIN text attribute that you can set with gwinSetText()).
Therefore, the behavior that you are experiencing is perfectly normal and expected. If you need to draw things that need to redraw themselves upon changing display pages or similar, use widgets - that is what they are there for. In this case, simply use the Label widget instead of gwinFillStringBox() - or create your own widget if you have more specific needs.

The UTF8 thing that you are describing sounds a bit strange. Can you please put together a small test case so that we can run it ourselves to see what is going on? Simply attach a ZIP archive containing the most minimalistic uGFX application code to show the problem (eg. one Label and GTRANS), the fonts that you are using as well as the configuration file.

Link to comment
Share on other sites

Hi, 

I found that the error is caused by the encoding of my gui.h ! It was encoding in ANSI instead of UTF-8, I converted it with notepad ++ and now it's working like a charm ! 
I just need to carefully convert without filter my fonts so all my UTF-8 characters are supported !

Thanks again for your help !

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...