Class: AMS::Translate

Inherits:
Object
  • Object
show all
Defined in:
Documentation/ams/translate.rb,
RubyExtension/ams_Lib/translate.rb

Overview

Note:

This translate class is based on SketchUp langhadler.rb and AE::Translate by Andreas Eisenbarth.

Translate allows loading and controlling localization of strings.

Since:

  • 2.0.0

Instance Method Summary collapse

Constructor Details

#initialize(toolname = nil, dir = nil) ⇒ Translate

Load translation strings.

Parameters:

  • toolname (String) (defaults to: nil)

    A name to identify the translation file (plugin name).

  • dir (String) (defaults to: nil)

    An optional directory path where to search, otherwise in this file's directory.

Since:

  • 2.0.0

Instance Method Details

#get(key, *si) ⇒ String Also known as: []

Get a single translation.

Parameters:

  • key (String)

    Original string in ruby script; % characters escaped by %%.

  • si (*String)

    s0-sn: optional strings for substitution of %0 … %sn.

Returns:

  • (String)

    translated string

Since:

  • 2.0.0

#get_allHash{String => String}

Get all translations as hash.

Returns:

  • (Hash{String => String})

    key/value pairs of original and translated strings.

Since:

  • 2.0.0