Skip to content

Overriding section names #11

@noraj

Description

@noraj

Describe the problem

We can't translate section names.

How would the new feature work?

Adding an additional section_names: option to TTY::Option::Formatter#initialize.

Drawbacks

None I can think of.

Workaround

Hardcore ugly monkey patching, e.g. for French translation

module TTY
  module Option
    class Formatter
      def initialize(parameters, usage, param_display: DEFAULT_PARAM_DISPLAY,
                     width: DEFAULT_WIDTH, order: DEFAULT_ORDER, indent: 0)
        @parameters = parameters
        @usage = usage
        @param_display = param_display
        @order = order
        @width = width
        @indent = indent
        @space_indent = SPACE * indent
        @param_indent = indent + 2
        @section_names = {
          usage: "Utilisation :",
          arguments: "Arguments :",
          keywords: "Mots clés :",
          options: "Options :",
          env: "Environement :",
          examples: "Exemples :"
        }
      end
    end
  end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions