Method: I18n::Inflector::API_Strict#token_description

Defined in:
lib/i18n-inflector/api_strict.rb

#token_description(token, kind) ⇒ String? #token_description(token, kind, locale) ⇒ String?

Note:

If the given token is really an alias it returns the description of the true token that it points to.

Gets the description of the given inflection token belonging to a strict kind.

Overloads:

  • #token_description(token, kind) ⇒ String?

    Uses the current locale and the given token to get a description of that token.

    Parameters:

    • token (Symbol, String)

      the token

    • kind (Symbol, String)

      the identifier of a kind

    Returns:

    • (String, nil)

      the descriptive string or nil if something went wrong (e.g. token was not found)

  • #token_description(token, kind, locale) ⇒ String?

    Uses the given locale and the given token to get a description of that token.

    Parameters:

    • token (Symbol, String)

      the token

    • kind (Symbol, String)

      the identifier of a kind

    • locale (Symbol)

      the locale to use

    Returns:

    • (String, nil)

      the descriptive string or nil if something went wrong (e.g. token was not found)

Returns:

  • (String, nil)

    the descriptive string or nil

Raises:


589
590
591
592
593
# File 'lib/i18n-inflector/api_strict.rb', line 589

def token_description(*args)
  token, kind, locale = tkl_args(args)
  return nil if (token.nil? || kind.nil?)
  data_safe(locale).get_description(token, kind)
end