Difference between revisions of "S2 Guide: Style System Overview"

From Dreamwidth Notes
Jump to: navigation, search
Line 3: Line 3:
 
<graphviz caption='Order of layers'>
 
<graphviz caption='Order of layers'>
 
digraph layers {
 
digraph layers {
 +
rankdir = "LR";
 +
 
core_layer [shape="doubleoctagon" color="#002F74" fontcolor="black"];
 
core_layer [shape="doubleoctagon" color="#002F74" fontcolor="black"];
 +
i18nc_layer [shape="Mdiamond" color="#017313" fontcolor="black"];
 
layout_layer [shape="doubleoctagon" color="#444F96" fontcolor="black"];
 
layout_layer [shape="doubleoctagon" color="#444F96" fontcolor="black"];
 +
i18n_layer [shape="Mdiamond" color="#01A313" fontcolor="black"];
 
theme_layer [shape="doubleoctagon" color="#886FA8" fontcolor="black"];
 
theme_layer [shape="doubleoctagon" color="#886FA8" fontcolor="black"];
 
wizard_layer [shape="doubleoctagon" color="#BB8FCA" fontcolor="black"];
 
wizard_layer [shape="doubleoctagon" color="#BB8FCA" fontcolor="black"];
 +
 +
subgraph {
 +
  rank = same;
 +
  core_layer;
 +
  i18nc_layer;
 +
}
 +
 +
 +
subgraph {
 +
  rank = same;
 +
  layout_layer;
 +
  i18n_layer;
 +
}
  
 
core_layer -> layout_layer
 
core_layer -> layout_layer
 +
i18nc_layer -> core_layer
 
layout_layer -> theme_layer
 
layout_layer -> theme_layer
 +
i18n_layer -> layout_layer
 
theme_layer -> wizard_layer
 
theme_layer -> wizard_layer
 
}
 
}
Line 48: Line 67:
 
== Wizard layer ==
 
== Wizard layer ==
  
All a wizard layer can do is set properties.  It's meant to be edited by using the customize interface on the site, but can also be created or edited manually.  (If you're familiar with styles on LiveJournal, this was called the "user layer".)
+
All a wizard layer can do is set existing properties.  Since a lot of layouts have many properties, this can change a lot of things!
  
== Language layers ==
+
It's meant to be edited using the customize interface on the site, but can also be created or edited manually.  (If you're familiar with styles on LiveJournal, this was called the "user layer".)
 +
 
 +
Many new layout themes have originated from people sharing wizard layers in <dwcomm>dreamscapes</dwcomm>!
 +
 
 +
== Internationalization layers ==
 +
 
 +
Unless you're translating a layout into another language, you won't have to worry about these layers.  The i18nc layer overrides text properties in the core, translating them into a specific language. It also overrides the default short, medium, and long date and time formats and functions which do things like return ordinal numbers from cardinal numbers and map item counts onto their plural form.
 +
 
 +
To achieve this goal, language layers can:
 +
 
 +
* Set properties
 +
* Override the names and descriptions of properties
 +
* Override existing functions
  
 
=== i18nc: core ===
 
=== i18nc: core ===
 +
 +
This layer translates text properties in the core into a specific language, overrides the default date and time formats, and changes functions that do things like make pluralized item count statements--all things that can change according to different languages or standard conventions!
  
 
=== i18n: layout ===
 
=== i18n: layout ===
  
 +
This layer does the same as <tt>i18nc</tt>, but only for new properties or functions added by a layout.
  
 
[[Category: S2 Guide]]
 
[[Category: S2 Guide]]

Revision as of 19:56, 15 June 2010

Layers

<graphviz caption='Order of layers'> digraph layers { rankdir = "LR";

core_layer [shape="doubleoctagon" color="#002F74" fontcolor="black"]; i18nc_layer [shape="Mdiamond" color="#017313" fontcolor="black"]; layout_layer [shape="doubleoctagon" color="#444F96" fontcolor="black"]; i18n_layer [shape="Mdiamond" color="#01A313" fontcolor="black"]; theme_layer [shape="doubleoctagon" color="#886FA8" fontcolor="black"]; wizard_layer [shape="doubleoctagon" color="#BB8FCA" fontcolor="black"];

subgraph {

 rank = same;
 core_layer;
 i18nc_layer;

}


subgraph {

 rank = same;
 layout_layer;
 i18n_layer;

}

core_layer -> layout_layer i18nc_layer -> core_layer layout_layer -> theme_layer i18n_layer -> layout_layer theme_layer -> wizard_layer } </graphviz>

Core layer

The core layer is the foundation everything else builds on. It can:

  • Define classes
  • Define builtin functions that are present in the backend
  • Define global functions that don't belong to a class
  • Define class methods
  • Define and set properties

Dreamwidth has two different core layers.

  • core1 is inherited from LiveJournal and allows people to import their LiveJournal layouts.
  • core2 is Dreamwidth's core layer, that includes extra features built in, like modules. Plain Tabula Rasa is the base style put out by core2 without any modifications.

Layout layer

  • Define builtin functions that are present in the backend
  • Define global functions that don't belong to a class
  • Define class methods; the method name must have the prefix lay_ to avoid future namespace collisions if the core layer expands
  • Define and set properties
  • Set up properties for the customization wizard

Theme layer

A theme layer can:

  • Override existing functions
  • Override names and descriptions of properties

It's usually used to make different versions to a base layout, such as different color schemes.

Wizard layer

All a wizard layer can do is set existing properties. Since a lot of layouts have many properties, this can change a lot of things!

It's meant to be edited using the customize interface on the site, but can also be created or edited manually. (If you're familiar with styles on LiveJournal, this was called the "user layer".)

Many new layout themes have originated from people sharing wizard layers in [info]dreamscapes!

Internationalization layers

Unless you're translating a layout into another language, you won't have to worry about these layers. The i18nc layer overrides text properties in the core, translating them into a specific language. It also overrides the default short, medium, and long date and time formats and functions which do things like return ordinal numbers from cardinal numbers and map item counts onto their plural form.

To achieve this goal, language layers can:

  • Set properties
  • Override the names and descriptions of properties
  • Override existing functions

i18nc: core

This layer translates text properties in the core into a specific language, overrides the default date and time formats, and changes functions that do things like make pluralized item count statements--all things that can change according to different languages or standard conventions!

i18n: layout

This layer does the same as i18nc, but only for new properties or functions added by a layout.