Is it possible change “tip of the day” (wx.CreateFileTipProvider)
so that the title “the tip of the day” and “Did you now?” be translated to other languages?
Thanks.
···
–
Fabio Spadaro
Try Sqlite Root a GUI Admin Tools for manage Sqlite Database:
It should already be using the _() macro for both items, you just
need to include them into the .pot files, these can then be
translated and included in the .po files which in turn will be
compiled into .mo files and can be placed into the appropriate
locale directories. See
also you might
notice that one of the wxPython examples, I18n, includes the phrase
“Tip of the Day” in 6 languages.
It is also worth having a look at the wx manual section Overview".
Gadget/Steve
It should already be using the _() macro for both items, you just
need to include them into the .pot files, these can then be
translated and included in the .po files which in turn will be
compiled into .mo files and can be placed into the appropriate
locale directories. See http://en.wikipedia.org/wiki/Gettext#Implementations also you might
notice that one of the wxPython examples, I18n, includes the phrase
“Tip of the Day” in 6 languages.
It is also worth having a look at the wx manual section ["wxTipProvider](http://classwx_tip_provider.html)
Overview".
Gadget/Steve
I have explained, the Tip “tip of the day” is builded with wx.CreateFileTipProvider whose title is “tip of the day” and a label “Did you now …”. How do I translate them if there is no method SetLabel or SetTitle? Show few lines of code to explain better:
label = ‘Suggerimenti del giorno’
tp = wx.CreateFileTipProvider("tips.txt", 1)
#tp.SetTitle(label) does not exist !
showTip = wx.ShowTip(self, tp)
–
Fabio Spadaro
Try Sqlite Root a GUI Admin Tools for manage Sqlite Database:
You shouldn’t have to - basically if you mark your text in tips.txt
as being translatable, i.e. _(“Some Text”) and produce the .pot file
for it, then add “Tip of the Day” and “Did you know …” to the .pot
file, you can then get the .pot file translated and compiled and
your tips and the window title, etc, will be translated for the user
based on the Locale.
Steve is referring to the standard way of doing internationalization of software applications, by using the gettext facilities. The strings you've identified are declared in the C++ code inside of _() markers, and the gettext tool has extracted them into message catalog files that are translated and made available based on the active locale as the 'wxstd' catalog. You can do the same thing with string constants in your own code andmaking your own catalogs. (IIRC you can even override the strings in wxstd with translated strings in your catalog if you set things up correctly.) So, in a nutshell, if you have the wxstd message catalogs installed correctly and if you set the wx.Locale to a locale that has a message catalog, then those strings used for tip dialog's title and label should already be translated.
It should already be using the _() macro for both items, you just
need to include them into the .pot files, these can then be
translated and included in the .po files which in turn will be
compiled into .mo files and can be placed into the appropriate
locale directories. See gettext - Wikipedia also you might
notice that one of the wxPython examples, I18n, includes the phrase
"Tip of the Day" in 6 languages.
It is also worth having a look at the wx manual section
"wxTipProvider <http://classwx_tip_provider.html> Overview".
I have explained, the Tip "tip of the day" is builded with
wx.CreateFileTipProvider whose title is "tip of the day" and a label
"Did you now ...". How do I translate them if there is no method
SetLabel or SetTitle? Show few lines of code to explain better:
label = 'Suggerimenti del giorno'
tp = wx.CreateFileTipProvider("tips.txt", 1) #tp.SetTitle(label) does not exist !
showTip = wx.ShowTip(self, tp)
BTW, the code sample on that page is very old and uses the old package name and etc. If somebody wanted to learn more about i18n in wxPython updating that sample would be a good start. (hint! hint!)
BTW, the code sample on that page is very old and uses the old package name and etc. If somebody wanted to learn more about i18n in wxPython updating that sample would be a good start. (hint! hint!)