Class: Y2Packager::Widgets::ProductLicenseTranslations

Inherits:
CWM::CustomWidget
  • Object
show all
Defined in:
src/lib/y2packager/widgets/product_license_translations.rb

Overview

This widget display license translations for a given product

The widget serves a glue between a pair of widgets:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(product, language) ⇒ ProductLicenseTranslations

Returns a new instance of ProductLicenseTranslations

Parameters:

  • product (Y2Packager::Product)

    Product

  • language (String)

    Default language (en_US, es_ES, etc.).


38
39
40
41
42
43
# File 'src/lib/y2packager/widgets/product_license_translations.rb', line 38

def initialize(product, language)
  super()
  @product = product
  @language = language
  self.handle_all_events = true
end

Instance Attribute Details

#languageString (readonly)

Returns Language code (en_US, es_ES, etc.).

Returns:

  • (String)

    Language code (en_US, es_ES, etc.).


34
35
36
# File 'src/lib/y2packager/widgets/product_license_translations.rb', line 34

def language
  @language
end

#productY2Packager::Product (readonly)

Returns Product

Returns:


32
33
34
# File 'src/lib/y2packager/widgets/product_license_translations.rb', line 32

def product
  @product
end

Instance Method Details

#contentsObject

Widget content

See Also:

  • CWM::CustomWidget#contents

48
49
50
51
52
53
54
# File 'src/lib/y2packager/widgets/product_license_translations.rb', line 48

def contents
  VBox(
    Left(language_selection),
    VSpacing(0.5),
    product_license
  )
end

#handle(event) ⇒ Object

Event handler

Translate the license content if language has changed.

Parameters:

  • event (Hash)

    Event data


61
62
63
64
65
66
# File 'src/lib/y2packager/widgets/product_license_translations.rb', line 61

def handle(event)
  if event["ID"] == language_selection.widget_id
    product_license.translate(language_selection.value)
  end
  nil
end