Template:Sandbox: Difference between revisions

From OLPC
Jump to navigation Jump to search
(aborting -- ready & could graduate back to Template:Status box (but too fragile) -- aborting)
(testing a template for semi-automatic fake translation redirects)
Line 8: Line 8:
[[Category:Template]]
[[Category:Template]]


: <big>'''Testing: Status box<strike></strike>'''</big>
: <big>'''Testing: Missing translation<strike></strike>'''</big>


</noinclude>
</noinclude>
{{#switch:{{lc:{{{2|{{{action|}}}}}}}}
|<!-- include action --> include={{:{{{page|{{#rel2abs:..}}}}}}}
|<!-- redirect action --> redirect
|<!-- missing action --> default=#REDIRECT [[{{{page|{{#rel2abs:..}}}}}}}]]
}}
<pre>
[[Category:Missing translation|{{PAGENAME}}]]
[[Category:Missing translation lang-{{{lang|{{{1}}}}}}|{{PAGENAME}}]]
</pre>


:What is the result of <nowiki>{{#rel2abs:..}}</nowiki>? [{{#rel2abs:..}}] that is.
{| cellpadding="0" cellspacing="0" style="float:right; border:1px solid #aaa; font-size:small; background:#f9f9f9; width:15em; margin:5px 0px 5px 5px;"
:What is the result of <nowiki>{{#rel2abs:'..'}}</nowiki>? [{{#rel2abs:'..'}}] that is.

:What is the result of <nowiki>{{#rel2abs:".."}}</nowiki>? [{{#rel2abs:".."}}] that is.
|-
:What is the result of <nowiki>{{#rel2abs:The OLPC wiki/translations}}</nowiki>? [{{#rel2abs:The OLPC wiki/translations}}] that is.
| colspan="2" style="font-size:large; text-align:center; background:#6bbe45; color:white; " | '''{{{component|{{PAGENAME}}}}}'''<span style="font-size:small;"><br>[[:Category:{{{type|activity}}}|({{{type|activity}}})]]</span> <!-- IF icon -->{{ #if: {{{icon|}}}<!-- THEN icon -->|<nowiki />
{{!}}-
{{!}} colspan="2" style="valign:middle; padding:5px"{{!}} [[Image:{{{icon}}}|center]]<!-- ELSE icon -->|}}<!--
ENDIF icon --><!--
IF source -->{{ #if: {{{source|}}}<!-- THEN source -->|<nowiki /><!--
IF status -->{{ #if: {{{status|}}}<!-- THEN status -->|<nowiki />
{{!}}-
{{!}} style="text-align:right;" {{!}} '''Status:'''
{{!}} style="text-align:left;" {{!}} {{{status}}}<!-- ELSE status -->|}}<!--
ENDIF status --><!--
IF build -->{{ #if: {{{build|}}}<!-- THEN build -->|<nowiki />
{{!}}-
{{!}} style="text-align:right;" {{!}} '''Build:'''
{{!}} style="text-align:left;" {{!}} {{{build}}}<!-- ELSE build -->|}}<!--
ENDIF build --><!--
IF source -->{{ #if: {{{source|}}}<!-- THEN source -->|<nowiki />
{{!}}-
{{!}} style="text-align:right;" {{!}} '''Source:'''
{{!}} style="text-align:left;" {{!}} {{{source}}}<!-- ELSE source -->|}}<!--
ENDIF source --><!--
IF language -->{{ #if: {{{language|}}}<!-- THEN language -->|<nowiki />
{{!}}-
{{!}} style="text-align:right;" {{!}} '''Language:'''
{{!}} style="text-align:left;" {{!}} {{{language}}}<!-- ELSE language -->|}}<!--
ENDIF language --><!--
IF l10n -->{{ #if: {{{l10n|}}}<!-- THEN l10n -->|<nowiki />
{{!}}-
{{!}} style="text-align:right;" {{!}} '''[[Localization|l10n]]:'''
{{!}} style="text-align:left;" {{!}} {{ #ifexist: {{PAGENAME}}/Localization|[[{{PAGENAME}}/Localization]]|{{{l10n|''<span class="plainlinks">[{{fullurl:{{PAGENAME}}}}/Localization add it here]</span>''}}} }}<!-- ELSE l10n -->|}}<!--
ENDIF l10n --><!--
IF testplan -->{{ #if: {{{testplan|{{#ifexist:{{PAGENAME}}/Test plan|gotpage|}}|}}}<!-- THEN testplan -->|<nowiki />
{{!}}-
{{!}} style="text-align:right;" {{!}} '''[[:Category:Test Plans|Test plans]]:'''
{{!}} style="text-align:left;" {{!}} {{#ifexist:{{PAGENAME}}/Test plan|[[{{PAGENAME}}/Test plan]]|{{{testplan}}}}}<!-- ELSE testplan -->|}}<!--
ENDIF testplan --><!-- ELSE source -->|}}<!--
ENDIF source -->
|-
| colspan="2" style="text-align:center;" | '''Contributors'''
|-
| colspan="2" style="text-align:center" | {{{contributors}}}
|}
<!-- CATEGORIZATION -- TESTING -->
Testing parameterized categorizations:
<!-- CATEGORIZATION -- type
<nowiki>[[</nowiki>Category:{{ #switch: {{lc:{{{type}}}}} | activity=Activity | core=Core | #default=Unknown Component }}<nowiki>]]</nowiki>
''type => {{{type}}} | {{lc:{{{type}}}}}''
-->
<!-- CATEGORIZATION -- type & source & status -->
<nowiki>[[</nowiki>Category:{{ #if: {{{source|}}} | {{ #switch: {{lc:{{{type}}}}} | activity=Activity | core=Core | #default=Unknown Component }} {{{status}}} | Software idea }}<nowiki>]]</nowiki>
''source => {{{source}}} | {{ #if: {{{source|}}} | has source | no source }}''
''type => {{{type}}} | {{lc:{{{type}}}}}''
''status => {{{status}}} | {{lc:{{{status}}}}}''
<!-- CATEGORIZATION -- l10n
<nowiki>[[</nowiki>Category:{{ #if: {{{l10n|}}} | l10n | Pending i18n }}<nowiki>]]</nowiki>
''l10n => {{{l10n}}}''
-->
<includeonly>[[Category:Activity]]</includeonly><noinclude>
{{Pending|This template automatically includes the page in the <nowiki>[[:Category:</nowiki>{{{type}}}]].}}

Many of the 'parameters' only make sense under certain circumstances (ie: no point in mentioning l10n if there's no source code).


== Usage ==
== Usage ==


<nowiki>{{</nowiki>Status box
<nowiki>{{</nowiki>{{PAGENAME}}
| ''component'' = &lt;!-- OPTIONAL &mdash; Name of the component (defaults to page title) --&gt;
| lang = &lt;!-- UNNAMED #1 -- language code of the missing translation (see [[Translating]] for codes) --&gt;
| ''type'' = &lt;!-- OPTIONAL &mdash; Type of the component {activity, core, support} --&gt;
| ''action'' = &lt;!-- UNNAMED #2 -- OPTIONAL &mdash; what to do. Default is to REDIRECT to the base ''page''. --&gt;
| ''icon'' = &lt;!-- OPTIONAL &mdash; ''file name.ext'' (sans <tt><nowiki>[[Image:</nowiki>''file name.ext''<nowiki>]]</nowiki></tt> --&gt;
| ''page'' = &lt;!-- OPTIONAL &mdash; the page name (sans enclosing ''[[]]'') to include or redirect to --&gt;
| contributors = &lt;!-- List of people contributing to the activity --&gt;
| ''source'' = &lt;!-- OPTIONAL &mdash; Repository / location of the source --&gt;
&lt;!-- The following only make sense (and will '''only''' show) if there's a ''source'' value --&gt;
| ''status'' = &lt;!-- OPTIONAL &mdash; Status of the activity --&gt;
| ''build'' = &lt;!-- OPTIONAL &mdash; Build # where it first appeared --&gt;
| ''language'' = &lt;!-- OPTIONAL &mdash; Computer language of the ''source'' --&gt;
| ''l10n'' = &lt;!-- OPTIONAL &mdash; Repository / location of the l10n resources --&gt;
| [[:Category:Test Plans|''testplan'']] = &lt;!-- OPTIONAL &mdash; link to the [[:Category:Test Plans|test plan page]] --&gt;
| <s>version = &lt;!-- Current/latest version available --&gt;</s>''dropping it''
| <s>base = &lt;!-- Yes/No if it's included in the [[OS images]]
/ Could be the first ''build'' number --&gt;</s>''dropping it''
<nowiki>}}</nowiki>
<nowiki>}}</nowiki>


== Sample ==
== Sample ==


The following are all equivalents, as they all generate a <tt>REDIRECT</tt> directive to the upper level
=== Empty ===
<nowiki>{{</nowiki>Missing translation|es<nowiki>}}</nowiki>
Raw invocation.
<nowiki>{{</nowiki>Missing translation|lang=es<nowiki>}}</nowiki>
<br clear="all">
<nowiki>{{</nowiki>Missing translation|lang=es|redirect<nowiki>}}</nowiki>
{{ Sandbox }}
<nowiki>{{</nowiki>Missing translation|lang=es|action=redirect<nowiki>}}</nowiki>
<nowiki>{{</nowiki> Sandbox <nowiki>}}</nowiki>
<nowiki>{{</nowiki>Missing translation|lang=es|action=redirect|page=Foo<nowiki>}}</nowiki> # assuming the including page is <tt><nowiki>[[Foo/subpage]]</nowiki></tt>
; Notes : Nothing else should show.


If instead of <tt>REDIRECT</tt>ing you want to include the ''parent'' page, the following are equivalent:
; Simplest : Basically an idea; using the page name; and misclassified by type, so defaults to a ''<tt>Unknown Component</tt>''. Nothing else should show.
<nowiki>{{</nowiki>Missing translation|es|include<nowiki>}}</nowiki>
<br clear="all">{{ Sandbox | type = Bar }}
<nowiki>{{</nowiki>Missing translation|lang=es|include<nowiki>}}</nowiki>
<nowiki>{{</nowiki>Missing translation|lang=es|action=include<nowiki>}}</nowiki>
<nowiki>{{</nowiki>Missing translation|lang=es|action=include|page=Foo<nowiki>}}</nowiki> # assuming the including page is <tt><nowiki>[[Foo/subpage]]</nowiki></tt>
# This would include the <tt><nowiki>[[Bar]]</nowiki></tt> page regardless of what the including page is.
<nowiki>{{</nowiki> Sandbox
<nowiki>{{</nowiki>Missing translation|lang=es|action=include|page=Bar<nowiki>}}</nowiki>
| type = Bar
<nowiki>}}</nowiki>


; Simple 1 : Basically an idea; using the page name; and misclassified by type.
<br clear="all">{{ Sandbox | type = activity }}
<nowiki>{{</nowiki> Sandbox
| type = activity
<nowiki>}}</nowiki>
; Notes : the ''type'' is recognized. Nothing else should show.

; Simple 2 : Basically an idea for a named component of the activity type, and an icon.
<br clear="all">{{ Sandbox | component = Foo | type = activity | icon = Xo s.png }}
<nowiki>{{</nowiki> Sandbox
| component = Foo
| type = activity
| icon = Xo s.png
<nowiki>}}</nowiki>

; Simple 3 : An activity idea that has code and an icon, in beta status, with l10n resources
<br clear="all">{{ Sandbox | component = Foo | type = activity | icon = Xo s.png | source = [[foo]] | l10n = [[Localization]] | status = beta }}
<nowiki>{{</nowiki> Sandbox
| component = Foo
| type = activity
| icon = Xo s.png
| source = <nowiki>[[foo]]</nowiki>
| l10n = <nowiki>[[Localization]]</nowiki>
| status = beta
<nowiki>}}</nowiki>


[[Category:Template]]
[[Category:Template|{{PAGENAME}}]]
[[Category:Templates using ParserFunctions|{{PAGENAME}}]]
</noinclude>
</noinclude>

Revision as of 16:19, 7 July 2007

Many times you may want to just 'test' an idea for a template, I haven't found a sensible way of fully testing templates by themselves (as they will not get included in the edited version, but rather the saved version).

The idea of this Template:Sandbox is to have that, a simple testing zone that will not interfere with others and avoid leaving a trail of botched attempts.

Please leave this comment/text for others to read.
See Also http://meta.wikimedia.org/wiki/Help:Template
Testing: Missing translation


 [[Category:Missing translation|{{PAGENAME}}]]
 [[Category:Missing translation lang-{{{lang|{{{1}}}}}}|{{PAGENAME}}]]
What is the result of {{#rel2abs:..}}? [] that is.
What is the result of {{#rel2abs:'..'}}? ['..'] that is.
What is the result of {{#rel2abs:".."}}? [".."] that is.
What is the result of {{#rel2abs:The OLPC wiki/translations}}? [The OLPC wiki/translations] that is.

Usage

{{Sandbox
 | lang    = <!-- UNNAMED #1 -- language code of the missing translation (see Translating for codes) -->
 | action  = <!-- UNNAMED #2 -- OPTIONAL — what to do. Default is to REDIRECT to the base page. -->
 | page    = <!-- OPTIONAL — the page name (sans enclosing [[]]) to include or redirect to -->
 }}

Sample

The following are all equivalents, as they all generate a REDIRECT directive to the upper level

{{Missing translation|es}}
{{Missing translation|lang=es}}
{{Missing translation|lang=es|redirect}}
{{Missing translation|lang=es|action=redirect}}
{{Missing translation|lang=es|action=redirect|page=Foo}} # assuming the including page is [[Foo/subpage]]

If instead of REDIRECTing you want to include the parent page, the following are equivalent:

{{Missing translation|es|include}}
{{Missing translation|lang=es|include}}
{{Missing translation|lang=es|action=include}}
{{Missing translation|lang=es|action=include|page=Foo}} # assuming the including page is [[Foo/subpage]]

# This would include the [[Bar]] page regardless of what the including page is.
{{Missing translation|lang=es|action=include|page=Bar}}