Module: Sketchup::RegionalSettings

Overview

The RegionalSettings module contains methods getting information about the user's locale settings.

Note that when you convert between units and strings you don't need to parse it yourself and you can instead use String#to_l and Length#to_s.

Version:

  • SketchUp 2016 M1

Class Method Summary # collapse

Class Method Details

.decimal_separatorString

Returns the decimal character for the current user's locale.

Examples:

# Format a Float using the user's locale settings.
# Ruby's Float.to_s always use period as decimal separator.
formatted = 0.123.to_s.tr('.', Sketchup::RegionalSettings.decimal_separator)

Returns:

  • (String)

    the decimal separator character

Version:

  • SketchUp 2016 M1

.list_separatorString

Returns the list separator character for the current user's locale.

Examples:

# Format a CSV list in user's locale:
decimal = Sketchup::RegionalSettings.decimal_separator
list = Sketchup::RegionalSettings.list_separator
row = [3.14, 1.618, 2.718]
csv = row.map { |value| value.to_s.tr('.', decimal) }.join(list)

Returns:

  • (String)

    the list separator character

Version:

  • SketchUp 2016 M1