Hi,

John Labenski wrote:
> On 6/26/07, Hakki Dogusan <[EMAIL PROTECTED]> wrote:
>> Since it compiled with gcc-4.1.2 I tried to find my other -translation-
>> problem first. After -all day- compiling with different configurations,
>> a few minutes ago I found the reason! (Why it is always the last one you
>> look for?)
>>
>> loc = wx.wxLocale(wx.wxLANGUAGE_TURKISH)
>>
>> print(loc:GetString("&About")) --not translated
>> print(loc:GetString("&About", "wxstd")) --translated
>>
>> print(wx.wxGetTranslation("&About")) --not translated
>> print(wx.wxGetTranslation("&About", "wxstd")) --translated
>>
>>
>> Do you know a quick solution? :)
> 
> You're doing better than I... why doesn't this work at all? Note, I
> just added the Init() function so I could get the return value, which
> is false, but it seemed to have set it anyway, but then doesn't
> translate it...
> 
> ========= code =============
> 
> wx.wxLocale.AddCatalogLookupPathPrefix("c:\\labenski\\wx\\wxWidgets\\wxWidgets-2.8.4\\locale\\")

Is ther any .mo file there?

> print(wx.wxLocale.IsAvailable(wx.wxLANGUAGE_TURKISH))
> 
> loc = wx.wxLocale()
> print(loc:Init(wx.wxLANGUAGE_TURKISH))
> print(loc:IsOk())
> print(loc:GetSysName())
> print(loc:GetLanguage(), wx.wxLANGUAGE_TURKISH)
> 
> print(loc:GetString("&About")) --not translated
> print(loc:GetString("&About", "wxstd")) --translated
> 
> print(wx.wxGetTranslation("&About")) --not translated
> print(wx.wxGetTranslation("&About", "wxstd")) --translated
> 

If you change calling order then Init returns true (I checked with 
current cvs), ie:

loc = wx.wxLocale()
loc.AddCatalogLookupPathPrefix("f:/a_c/dsuye/locale")
print(loc:Init(wx.wxLANGUAGE_TURKISH))
--print("AddCatalog:", loc:AddCatalog("wxstd")) --loaded automatically
print("AddCatalog:", loc:AddCatalog("dsuye"))

[snip]

I think I found the reason of requiring szDomain parameter to translate..

[intl.h]
virtual const wxChar *
GetString(const wxChar *szOrigString,
           const wxChar *szDomain = NULL) const;

virtual const wxChar *
GetString(const wxChar *szOrigString,
           const wxChar *szOrigString2,
           size_t n,
           const wxChar *szDomain = NULL) const;

szDomain is declared as wxChar here, and:

[intl.cpp ~2608]
it is checked against NULL


but in [wxLua - datetime.cpp ~5733] it is declared and used as wxString:
//virtual wxString
//GetString(const wxString& szOrigString,
//          const wxString& szDomain = "") const;
static int LUACALL wxLua_wxLocale_GetString(lua_State *L)
...
const wxString szDomain = (argCount >= 3 ?
                            wxlState.GetwxStringType(3) :
                            wxString(wxEmptyString));
...

If we omit szDomain parameter, it gets an emty string instead of NULL!


What do you think?


> Dunno,
>     John Labenski
> 


--
Regards,
Hakki Dogusan

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to