[fxruby-users] i18n messages

Reginaldo Francisco naldo_ds at yahoo.com.br
Sat May 1 10:44:37 EDT 2010


Joey, your FXTranslator sample code solved completely my problem!

Thank you very much, and everybody who helped me too.

Reginaldo Francisco
naldo_ds at yahoo.com.br


Em 28/04/2010 12:43, Joey Kinsella escreveu:
> After further investigation, it's as easy as this:
>
> require 'fox16'
> include Fox
>
> # Create a Translation Class
> class ExampleTranslator < FXTranslator
>   # tr() is called to translate the text
>   # c = context
>   # m = message
>   # h = hint
>   def tr(c, m, h)
>     # here you would probably do something like Paul did with a file 
> to map stuff, but for an example I just matched on
>     # one string.
>     if(m == "Print Destination")
>       # if text matches "Print Destination" translate to "Something 
> totally different"
>       return ("Something totally different")
>     end
>
>     # otherwise we just return the message.
>     return (m)
>   end
> end
> # End example Translation class.
>
> # Basic stuff..
> app = FXApp.new("Test", "Test")
>
> # Set the translator for our application to be our Translator
> app.translator = ExampleTranslator.new(app)
>
> # More basic stuff.
> win = FXMainWindow.new(app, "Test App", :opts => DECOR_ALL)
> pd = FXPrintDialog.new(win, "Test")
>
> app.create
> win.show
> pd.show
>
> app.run
>
> --------------------------------------------
>
> I realized after sending my email that the tr() function in 
> FXTranslator was virtual, and intended to be overwritten
> by self-written algorithms.
>
> Good luck :)
>
> On Wed, Apr 28, 2010 at 10:28 AM, Reginaldo Francisco 
> <naldo_ds at yahoo.com.br <mailto:naldo_ds at yahoo.com.br>> wrote:
>
>
>         Glancing through the FXRuby source I don't see anything
>         additional or different being done for the FXTranslator
>         object. but that's just a glance.. Further investigation could
>         yield something else.
>
>
>     It's that Joey, I did not find anything to do that, even how to
>     use a FXTranslator!
>
>
>     Reginaldo Francisco
>     naldo_ds at yahoo.com.br <mailto:naldo_ds at yahoo.com.br>
>     _______________________________________________
>     fxruby-users mailing list
>     fxruby-users at rubyforge.org <mailto:fxruby-users at rubyforge.org>
>     http://rubyforge.org/mailman/listinfo/fxruby-users
>
>
> --
> If you are not the intended recipient, you are hereby notified
> that any dissemination, distribution, copying or other use of
> this communication is strictly prohibited.  If you have
> received this communication in error, please notify us
> immediately.
>
>
>
>
> _______________________________________________
> fxruby-users mailing list
> fxruby-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/fxruby-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/fxruby-users/attachments/20100501/ba4633e8/attachment-0001.html>


More information about the fxruby-users mailing list