YaST/Web/VendorCustomization

From openSUSE

(Difference between revisions)
Revision as of 16:07, 4 September 2009
Dmacvicar (Talk | contribs)

� Previous diff
Revision as of 22:58, 23 September 2009
Mvidner (Talk | contribs)
Misc. Options - fixed the file path
Next diff →
Line 5: Line 5:
==Misc. Options== ==Misc. Options==
-These options can be set in the optional /etc/YaST/vendor.yml file.+These options can be set in the optional /etc/YaST2/vendor.yml file.
<pre> <pre>

Revision as of 22:58, 23 September 2009

Contents

Vendor customization

As it is targeted to custom appliances, WebYast can be customized for your own needs during appliance creaton.

Misc. Options

These options can be set in the optional /etc/YaST2/vendor.yml file.

# Custom url that will be displayed on crashes.
bug_url: http://www.mycompany.com/report_bug
# Important packages of your appliance, those versions are displayed
# in the status information
packages:
  - mydb-server
  - mydb-console
# Important services of your appliances, those may be
# remarked or hightlighted
services:
  - mydb-daemon
  - syslog
# Your appliance eula
eula:
  This is an evil eula that will
  make you think twice before
  clicking it

Layout and Theming

This part describes ways how the layout of WebYaST like text, stylesheet, images, icons,... can be changed or added.

Overriding existing images,icons and stylesheets

Images, icons, stylesheets are stored in the public directory of the YaST-Webclient. The public directory contains and additional subdirectory vendor which is used for overwriting,exchaninging images, stylesheets,.... for special vendors. Each file in the public directory can be exchanged by putting a file with the same path into the vendor.

For example changing the WebYaST logo which is stored in:

---public
     |
     +---images
            |
            +---webyast-logo.png

the corresponding file has be created in:

---public
     |
     +---images
     |      |
     |      +---webyast-logo.png
     |
     +---vendor
            |
            +---images
                   |
                   +---webyast-logo.png

Please take care that all links in the views have to be defined by the AssetTagHelper like image_tag, stylesheet_link_tag, javascript_include_tag, ...

e.g.

   <%= link_to(image_tag("/images/webyast-logo.png", :alt =>"webyast" ),"/")  %>

instead of

   <a href="/"><img src="/images/webyast-logo.png" alt="webyast" /></a>


Add new images, icons, stylesheets,.... for Plugins

Icons, images,... are normally stored in the public directory of the webserver. In order to avoid flooding this directory each plugin can define his own public directory in:

  vendor/plugins/<plugin-name>/public

The webserver has a look into this directory if the requested file is not in the official public directory. So only new files will be regarded in the vendor/plugins/<plugin-name>/public directory.

In order to exchange existing files use the mechanism described above.

Changing Text strings

WebYaST uses gettext in order to provide translations for each text in the UI. These translations are located in the po directory split in so called textdomains. While running a WebYaST module different textdomains will be loaded. e.g. the status module loads (logfile output):

Loading standard textdomain: yast_webclient
Loading standard textdomain: yast_webclient_status

The concerning translations ( so called po-files) are located in

  • po/<language>/yast_webclient.po
  • vendor/plugins/status/po/<language>/yast_webclient_status.po

These po-files have to be translated into so called mo-files by the call rake makemo. The generated files are located in:

  • locale/<language>/LC_MESSAGES/yast_webclient.po
  • vendor/plugins/language/locale/<language>/LC_MESSAGES/yast_webclient_status.mo

This mechanism can also be used for changing text completely. Please regard when changing the text you have to provide translations by your own :-).

This is an example how to change the textdomain yast_webclient:

  • Copy po/<language>/yast_webclient.po to public/vendor/text/po/<language>/yast_webclient.po
  • Change the text in public/vendor/text/po/<language>/yast_webclient.po
  • Call rake makemo in public/vendor/text. The text will be translated into mo-files.

After restarting the webserver following entries are generated in the logfile:

Loading textdomain yast_webclient from public/vendor/text/locale
Loading standard textdomain yast_webclient_status