Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Libraries and TheIDE: i18n, Unicode and Internationalization » Internationalization problem when using ctr as member of TopWindow
Internationalization problem when using ctr as member of TopWindow [message #10098] Wed, 20 June 2007 04:01 Go to next message
westcity1973 is currently offline  westcity1973
Messages: 5
Registered: June 2007
Location: China
Promising Member
I have studied UPP for three months, I find it is excellent.It is very easy and powerful. But when I try to use ctrls as member of Top window, it seems that the Internationalization does'nt work. My code is as follows:

class TransWithCtrlInTopWnd : public TopWindow {
public:
MenuBar menu ;
Button bt ; // a ctrl
bool langIsChina ;

public :
// menu handler
void MainMenu(Bar &bar)
{
bar.Add(t_("Try It"), THISBACK(SubMenu)) ;
}

void SubMenu (Bar &bar) {
bar.Add(t_("Menu1"), THISBACK(BlankFun) ) ;
bar.Add(t_("Menu2"), THISBACK(BlankFun) ) ;
}

void BlankFun() {}

// Button handler
void ChangeLanguage()
{
// When push button, change language between english and chinese.

Razz langIsChina = (!langIsChina) ;

if (langIsChina)
SetLanguage( LNGC_('Z','H','C','N', CHARSET_UTF8) ) ;
else
SetLanguage(LNGC_('E','N','U','S', CHARSET_UTF8) ) ;

menu.Set(THISBACK(MainMenu)) ; // Refresh menu
}

public:
typedef TransWithCtrlInTopWnd CLASSNAME;

TransWithCtrlInTopWnd() {
langIsChina = true ;

AddFrame(menu) ;
menu.Set(THISBACK(MainMenu)) ;

(*this) << bt.LeftPos(5, 100).TopPos(20, 20) ;

bt.SetLabel(t_("Push Me")) ;
bt <<= THISBACK(ChangeLanguage) ;
}
};

And I attatch my upp project file.
Re: Internationalization problem when using ctr as member of TopWindow [message #10101 is a reply to message #10098] Wed, 20 June 2007 09:45 Go to previous messageGo to next message
mezise is currently offline  mezise
Messages: 49
Registered: April 2006
Member
Hi, you need to add to the application the code responsible for handling of translation file:
#include <CtrlLib/CtrlLib.h>

using namespace Upp;

#define TFILE <TransWithCtrlInTopWnd/my.t> // <----
#include <Core/t.h> // <----

class TransWithCtrlInTopWnd : public TopWindow {
...

PS: first click on the button changes lang to english, so you need to click twise to see chinese Wink

Michal

[Updated on: Wed, 20 June 2007 09:47]

Report message to a moderator

Re: Internationalization problem when using ctr as member of TopWindow [message #10115 is a reply to message #10101] Thu, 21 June 2007 05:38 Go to previous message
westcity1973 is currently offline  westcity1973
Messages: 5
Registered: June 2007
Location: China
Promising Member
Thanks your help. Yes, I must include the header files.
Previous Topic: Internationalizing Keyboard Accelerator Keys?
Next Topic: Problem with non-English dirs
Goto Forum:
  


Current Time: Thu Nov 14 19:59:11 CET 2019

Total time taken to generate the page: 0.01352 seconds