[fxruby-users] i18n messages

Joey Kinsella jkinsella at ancillaryservices.com
Wed Apr 28 11:43:40 EDT 2010

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
      return ("Something totally different")

    # otherwise we just return the message.
    return (m)
# 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")




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
> 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
> _______________________________________________
> fxruby-users mailing list
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/fxruby-users/attachments/20100428/1add72ac/attachment.html>

More information about the fxruby-users mailing list