tip of the day

Hi all.

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:

www.sqliteroot.com

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

···

wxPython-users+unsubscribe@googlegroups.com
http://groups.google.com/group/wxPython-users?hl=enhttp://en.wikipedia.org/wiki/Gettext#Implementations

"wxTipProvider

Hi.

···

2012/2/15 Gadget/Steve GadgetSteve@live.co.uk

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

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

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:

www.sqliteroot.com

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.

Gadget/Steve
···

wxPython-users+unsubscribe@googlegroups.com
http://groups.google.com/group/wxPython-users?hl=en

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.

http://wiki.wxpython.org/RecipesI18n

···

On 2/15/12 3:50 AM, Fabio Spadaro wrote:

Hi.
2012/2/15 Gadget/Steve <GadgetSteve@live.co.uk
<mailto:GadgetSteve@live.co.uk>>

    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".

    Gadget/Steve

    --
    To unsubscribe, send email to
    wxPython-users+unsubscribe@googlegroups.com
    <mailto:wxPython-users%2Bunsubscribe@googlegroups.com>
    or visit http://groups.google.com/group/wxPython-users?hl=en

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)

--
Robin Dunn
Software Craftsman

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!) :slight_smile:

···

On 2/15/12 10:50 AM, Robin Dunn wrote:

RecipesI18n - wxPyWiki

--
Robin Dunn
Software Craftsman

Maybe even consolidate it with the following?

http://wiki.wxpython.org/Internationalization

Which has two up to date examples and I think is a bit more complete.

The wiki should probably also point to the I18N which is included in the demo.

Werner

···

On 15/02/2012 20:06, Robin Dunn wrote:

On 2/15/12 10:50 AM, Robin Dunn wrote:

RecipesI18n - wxPyWiki

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!) :slight_smile:

Does not work if there is a no-ascii characters, the message of “tip of the days” is:

The tip is not available.

···

Fabio Spadaro

Try Sqlite Root a GUI Admin Tools for manage Sqlite Database:

www.sqliteroot.com

Hi Fabio,

···

On 16/02/2012 07:47, Fabio Spadaro wrote:

Does not work if there is a no-ascii characters, the message of "tip of the days" is:
The tip is not available.

Maybe time to do a MakingSampleApps - wxPyWiki ?

Werner

Hi

···

2012/2/16 werner wbruhin@free.fr

Hi Fabio,

On 16/02/2012 07:47, Fabio Spadaro wrote:

Does not work if there is a no-ascii characters, the message of “tip of the days” is:

The tip is not available.

Maybe time to do a http://wiki.wxpython.org/MakingSampleApps ?

Werner

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

Ok I solved it by saving the. txt with UTF-8 encoding.


Fabio Spadaro

Try Sqlite Root a GUI Admin Tools for manage Sqlite Database:

www.sqliteroot.com