User:DomoViridi/TempTest

From Gramps

The contents of this page is © Copyright 2026 by DomoViridi. All rights reserved.

Sandbox to test templates

For Template:Latindict, Template:Latindict/A (and all the other letter-subpages), Template:Dict/Glossary, Template:Dict, as used in Latin words and expressions, and the translations Latin words and expressions/nl, Latin words and expressions/fr and Latin words and expressions/he.

Improvements to Dict template

  • The default parameter does not make sense, and should be eliminated. If there is no descriptive text for a given language, then the wiki page should show a blank line (or nothing).
Before removing it, in all uses of this template default= should be replaced with nl=. This is also the solution to the problem of showing lots of Dutch language descriptions on the English pages.
  • Better yet: first make default an alternative to nl. That way, the existing calls to this template can remain unchanged, while also only showing the Dutch description (given in default) if lang is "nl".
  • The lang parameter is exclusively used as {{dict|lang ={{{1}}} |word=..., i.e. the value is read from the first unnamed parameter that was passed to Template:Latindict/A. This value cascades down from the main page.
This cascade might be unnecessary, because the template should be able to use the {{PAGELANGUAGE}} magic word. Entries can then be simplified to {{dict|word=.... For the use in special cases lang= could be left available to override the wiki language setting for a particular lemma.
  • Unfortunately {{PAGELANGUAGE}} always returns "en" on this wiki, even on .../nl and Nl:... pages.
  • The word named parameter should be optional, and the word should be allowed to be passed as the first anonymous parameter, so we can write {{dict| abiit| en=he/she has left | nl=hij/zij is vertrokken }}.
Disadvantage: That would make the lemma an unnamed parameter. Unnamed parameters are not stripped of leading and trailing spaces. This can lead to lemmas with extra spaces around them.
Although: because it is the term in a definition list, leading spaces are ignored, and trailing spaces do not affect the layout (the displayed wiki text goes to a new line after the term), or are maybe also ignored.
  • Beware: Though spaces have little effect, a value for an unnamed parameter should never be the last thing on a line, because then the newline following the parameter will become part of the parameter value. In this template that messes up the description-list-item format.
  • This might also be true for a newline before an unnamed parameter.
Can be implemented with {{{word|{{{1}}} }}} in the template. This accepts the first anonymous parameter, except when a word parameter was given when calling the template. This gives backward compatibility, where it is allowed to use the word parameter, but not mandatory.
  • Make it so that Template:Dict does not need an explicit list of language codes. The current list blocks additional translations from being added.
The value of the {{PAGELANGUAGE}} magic word can be used to create the name of the desired parameter, e.g. "en". See Mediawiki Advanced Templates Help: Variable parameter name.
Code: ;{{{word|{{{1}}} }}}:{{{ {{PAGELANGUAGE}} }}}
The use of {{PAGELANGUAGE}} also makes en the default language.
  • Unfortunately {{PAGELANGUAGE}} always returns "en", making it useless. We still need the lang parameter. The trick with double evaluation of the parameter still works, so we can write:
;{{{word|{{{1}}} }}}:{{{ {{{lang}}} }}}
  • The current version outputs {{{en}}} if no default or language code parameter was given. Also produces '''{{{word}}}''' if no word parameter was given.
This is probably actually a good thing, because it shows when there is an error and the template call should be edited to resolve this.
documentation: add to the docs what parameters should be given and what happens if one is missing.
  • There should be a parameter to give the expansion of an abbreviation, separate from the translations. For example {{dict|A.D.|full=Anno Domini"|en=in the year of our lord|nl=in het jaar van de Heer}}. The wiki format to be produced needs to be invented. Possibly as extra text in parentheses added to the lemma, e.g.
A.D. (Anno Domini)
in the year of our lord
Or on the description line:
A.D.
Anno Domini: in the year of our lord
By putting the formatting in the template we can ensure that it is universal accross all pages.
  • This addition is very useful, and helps to show lemmas which only had an expansion (as the default value), but no language-specific descriptions.

Behaviour for missing description text

If there is no descriptive text parameter for the language of the page, then by default the template will show the lemma, but with an empty description.

This might be annoying for translations with relatively few translated descriptions (e.g. for brand new translated pages). The reader will be looking at a long list of lemmas with only a few descriptions.

A possible solution is the introduction of a show parameter, which will determine what will happen if the lemma has is no descriptive text for the current language. Possible values:

quiet
Show nothing. Pages will only show the lemmas which have a description in the page's language.
blank
The default. Show the lemma with a blank description.
a language code
Substitute the description with the given language. (Complicated implementation; maybe wait if there is demand for it.)

If the parameter is not set then do the blank behaviour.

For this parameter to work, we need to set up a new cascade of parameter passing. Then this parameter can be set on the main page for a language, e.g. initially quiet or nl, later to be removed as the descriptions start to become more common.

Restructuring the template cascade

The subdivision into templates for each letter of the alphabet is a pain in the <donkey>, and actually unnecessary. We describe how it is structured currently (Feb 2006), and draw up a plan for a simpler structure.

The two paths to this template: why?

Find out why there are two paths to this template:

  1. Through Template:Latindict and Template:Latindict/A (and the other letters).
  2. Via non-template "Latin words and expressions/letter" pages.

This also happens for the Dutch translated pages, so we get

Latin words and expressions/nl/A
Latin words and expressions/nl/B
etc.

and also

Nl:Latijnse woorden en uitdrukkingen/A
Nl:Latijnse woorden en uitdrukkingen/A
etc.

At first the suspect in this was the French translation, which uses a translated French page for each letter page.

Looking at the page history of the pages involved to see what happened, it turns out these pages were created around the same time and by the same author as the templates. They might be a remnant of an earlier setup. Examination of the exact creation dates and time may shed more light.

While this is going on, the use of Template:languages and Template:Dict/Glossary on all these pages creates a tangled web of pages being linked to by other pages. For example

Nl:Latijnse woorden en uitdukkingen/A

is linked to by:

  • The main Dutch page
  • Itself
  • The non-redirected version of itself
  • The main French page
  • Every other Nl:Latijnse woorden en uitdukkingen/letter page

The Reason

All these subpages were created in a desperate bid by the original author to split the list into separate pages, allowing an editor to edit the list only a letter-section at the time, rather than having to edit the entire list of thousands of lemmas.

Because the actual content of the article is transcluded, the normal "edit by section" mechanism does not work.

This problem is not trivial to solve. Idealy mediawiki should have a built-in mechanism to redirect an action to edit a section to edit the section in the transcluded page.

Find out if such a mechanism exists

The documentation on this subject is shockingly poor. We must find out through experimentation.

It turns out that the current Wiki implements this exactly as expected.

  • Put the sections in a transcluded file
  • Transclude that file in the main file
  • Put a ToC in either the main file or the transcluded file (both work), with simple [[#A|A]] links
  • The ToC links will show you the section on the main page
  • The auto-generated edit links will open the transcluded file on that section
  • It also works with translated pages

Current structure

The main page Latin_words_and_expressions

This contains

  • A warning box about the mixing of English and Dutch descriptions.
  • A code to suppress the Table of Contents.
  • A call to Template:Languages, to make automatic links to the translated pages.
  • An introductory text.
  • A call to Template:Dict/Glossary, passing the name of the page as a parameter. This generates a substitute Table of Contents, linking to all the letter sections which will be generated on this page. Note: instead of passing a literal copy of the name of the page, the code {{BASEPAGENAME}} should have been used by the template.
  • A call to Template:Latindict, with the language code as a parameter ({{latindict|en}}). The language code is not needed, as Template:Dict should have used the {{PAGELANGUAGE}} magic word.
  • A comment with instructions on where to edit lemmas.
  • A Category link [[Category:Genealogy|L]].

Translated pages such as Latin_words_and_expressions/nl (or the page they redirect to) contain the same, with adaptations.

  • The introductory text is translated.
  • The parameter passed to Template:Dict/Glossary changed to the translated page name. (Using {{BASEPAGENAME}} would have prevented this, but that issue is moot in the new structure.)
  • The parameter passed to Template:Latindict is changed to the code for the translated language. (Again, this could have been automated using {{PAGELANGUAGE}}. Again, issue is moot in the new structure.)
  • The instructions in the comment are translated.
  • The Category link is translated: [[Category:Nl:Genealogie|Latijnse woorden]].

Template:Latindict

This contains

  • A list of sections, one for each letter of the alphabet, and one for the 'at' symbol (@), with a Level 2 header with that letter.
  • In each letter section, a call to a sub-template for that letter ({{Latindict/A|{{{1}}}}} etc.). The language code (passed into Template:Latindict as the first parameter), is passed on as the first parameter to the sub-template.
  • Nothing else.

Template:Latindict/A etc.

These contain

  • the actual lemmas, in the form of a Template:Dict entry for each lemma:
{{dict|lang ={{{1}}} |word=abavia|default=betovergrootmoeder |en=second great grandmother}}
  • A link (now dead) to the Dutch/Flemish source material, as a noinclude so it won't show up on the page, but is visible in the source. This could have been done with an HTML comment.

(Note: the English description in the example should be 'great-great-grandmother'.)

The parameters to Template:Dict are filled in as follows:

lang
The language code was passed in as the first parameter, and is now copied into this parameter: lang={{{1}}}.
word
Set to the Latin lemma.
default
Set to the Dutch description (which is wrong, this should be changed to the nl parameter everywhere; this is the main cause of the English/Dutch mixing of the descriptions).
en, nl, fr, etc
Descriptions in other languages are given as a parameter named after their language code. Texts for other languages can be added here, e.g. fr=Arrière-arrière-grand-mère.

Template:Dict

This finally generates a display list entry based on the parameters.

The template turns the parameters into a display list entry, with the format

;'''word''':description

(The lemma word does not need to be explicitly made bold, the description list format already does that.) This results in

word
description

New structure

The main page (and the translations)

  • The warning box about the error will probably be gone by this time.
  • The code to suppress the Table of Contents remains.
  • The call to Template:Languages can remain unchanged.
  • The introductory text can probably remain unchanged.
  • The call to Template:Dict/Glossary must be removed.
  • The call {{Latindict}} must remain unchanged, with the language of the page as the first parameter (because the {{PAGELANGUAGE}} magic word does not work on this wiki).
  • The comment with instructions must be updated to reflect the new situation, i.e. find the lemma in Template:Latindict and edit it there.

The translated page pages must do the same changes:

  • Remove the call to Template:Dict/Glossary.
  • Update the translation of the instructions.

The result will be that:

  • The homebrew ToC entries will jump to that letter on the main page.
  • The "Edit" link on each section will open an edit on the section in the template, allowing direct editing of lemmas.

Template:Latindict

Change to contain:

  • A Table-of-Contents header with in-page links to all the letters. This replaces the Template:Dict/Glossary call from the main page. If the user clicks on one of these links, the view should jump to that letter header on the same page. This helps the user find a lemma more quickly.
There will only be one call for this, so there is no need for a template. A simple set of
[[#A|A]] - [[#B|B]] -[[#C|C]] - [[#D|D]] - ...
with a table around it should do the trick. Copy from the template contents and search/replace {{{1}}}/ with #. Note that this moves this fuctionality from the main page (and the translated pages) to this template (with only one occurence), useful in all translations of the main page.
  • Sections for each letter (unchanged). Simple == A == headers are enough.
  • In each section replace the {{Latindict/A|{{{1}}}}} with all the {{dict|...}} entries for that letter. These can be substituted in by changing {{Latindict/A|{{{1}}}}} to {{subst:Latindict/A|{{{1}}}}} and saving the page. Repeat for all the letters.

If all goes as expected, the ToC links will bring you to the section on the main page, and the auto-generated edit links will open this template for editing on the chosen section.

By allowing editing-by-section, users will not be overburdened by edit pages which are too big. As a major advantage, it will be much easier for editors to find the lemma they want to edit, without the need to search for the correct lettered subpage.

Template:Latindict/A etc.

These can all be eliminated.

Template:Dict

This must be overhauled.

  • Eliminate the lang parameter. Take the language from the {{PAGELANGUAGE}} magic word. On this wiki this will always have a valid value.
    • Unfortunately, {{PAGELANGUAGE}} always produces "en" on this wiki. So we still need the lang parameter
  • Eliminate the default parameter.
    • Or better: Allow default as an alternative for nl. This gives backward compatiblilty with the existing calls to this template.
  • Other improvements are described in the #Improvements to Dict template section

Pages no longer needed

With this new structure the following pages can be eliminated:

  • All the lettered sub-templates (Template:Latindict/A etc.).
  • All the Main: space lettered sub-pages (Latin words and expressions/A etc.).
  • All the Dutch translated main space lettered sub-pages (Latin words and expressions/A/nl etc.), and the pages they redirect to (Nl:Latijnse woorden en expressies/A etc.).
  • Same for the French translated pages. Although we will have to copy the descriptions from the French pages into the Template:Dict calls as fr= parameters first.
  • Status of the Hebrew translated pages needs to be examined.

Actions to take for modification

Set up a test environment

Set up a test environment to create and test a better version of the template without disturbing the existing one.

  • (done) Create a Sandbox subspace to my user page: User:DomoViridi/TempTest; Think about the use or no-use of capital letters in the names of the pages first (doesn't realy matter). Put my own version of the pages there, but in the User:DomoViridi/TempTest space. Test templates can be called with the syntax {{User:DomoViridi/TempTest/mytemplate}} (the braces ensure transclusion, the User: namespace replaces the default Template: namespace.
  • (done) Create a template page with the test template, User:DomoViridi/TempTest/Dict. Fill it initially with a copy of the original Template:Dict.
  • (done) Create a page with test cases, User:DomoViridi/TempTest/Testcases. Put some calls to our Dict template in it, e.g. {{User:DomoViridi/TempTest/Dict | lang=en| word=sillius soddus| en=silly sod| nl=sukkel}}. Add many testcases and put their source code in nowiki text above each.
  • (done) Create a sample template page User:DomoViridi/TempTest/Latindict/A with calls to the Dict template, using {{User:DomoViridi/TempTest/Dict}}. Copy the existing "A" page and shorten it, leaving some useful examples, with different languages, some abbreviations, and some missing languages. Add French translations to some of the lemmas. Also copy a different letter page (a short one), which has some translations.
  • (done) Create a sample template page User:DomoViridi/TempTest/Latindict which calls our Latindict/A template using {{User:DomoViridi/TempTest/Latindict/A}}, and any other letter pages from the test space.
  • (done) Create a main page User:DomoViridi/TempTest/Latin words and expressions, which calls {{User:DomoViridi/TempTest/Latindict}}.
Oh hey!, it turns out Template:Dict/Glossary creates links to Latin words and expressions/A and all the other letters.
Oh hey!, once again we see how the clumsy Template:Dict/Glossary requires subpages of the translated page, one for each letter of the alphabet.
  • (done) Create the translated subpages before moving the translated main page.
Although: this does not help, because the letter pages are not subpages of the .../nl page, but are formed with .../A/nl.

Creating 27 (one for each letter of the alphabet, plus '@') lettered subpages each time for:

  • The Templates
  • The main page (English)
  • The Dutch (nl) translation
  • The redirect for the Dutch (nl) translation
  • The French (fr) translation
  • The redirect for the French (fr) translation
  • The Hebrew (he) translation
  • The redirect Hebrew (he) translation
  • The same again for every new translation

is an unbelievable pile of unnecessary busywork. All so that we can have separate pages for every letter, and links to them. Good thing I only did letters A and B for this sandbox.

Note: the Gramps wiki does not support the TemplateSandbox extension, which would have allowed to attach a sandbox subpage directly to the template. This means the {{testcases notice}} template is also not available.

Create an improved Dict template

(done) Do this in the sandbox. See the #Improvements to Dict template section.

(done) Don't forget to adjust the documentation.

(done) When it works with no detected problems, overwrite the actual template with our code.

Change "default" to "nl"

Because Template:Dict defaults to {{{en}}} if there is no description in a valid language, changing default to nl will result in a lot of bad output for all entries where en is missing.

(done) Solution: make default an alternative for nl, so if lang=en then a blank description is shown, and if lang=nl then the Dutch default description is shown.

(done) This means we need to modify Template:Dict before we make this change.

(deferred) Edit all the Template:Latindict/<letter> pages to change default= to nl=. The effect should be that Dutch descriptions only show on the Dutch pages.

  • Start with a small page and see how it goes.
  • Then do a few more with export-to-editor, bulk search/replace, import from editor. Check for anomalies.
  • Do the other pages

(deferred) This should all have effect without the need to change the templates yet. It also makes room for a modification of Template:Dict which drops the default parameter.

Note: This operation has been deferred, pending a decision to about the future of this dictionary.

Restructure the template cascade

Do this in the sandbox. See #Restructuring the template cascade. Make sure it works perfectly.

Before modifying the real pages, put notices in the talk pages and banners in any and all of the pages involved.

Then modify the real pages.

Try to get the useless pages deleted. At the least put a warning box in them. Something like "Do not use this page. Use page xxx instead. This page will be deleted in the near future".

Move the translated French pages

Copy all the existing French translations to the Template:Latindict/<letter> pages. Note: This leaves the translated French pages unchanged for now.

  • Could be a big job.
  • Have these pages changed much in the last few years?
  • Put a notice on the Talk page for the French translation to tell them what is going on.
  • Maybe put a banner on the pages too.
  • Make sure they work nicely.

Switch the translated French page to use Template:Latindict

Check the Hebrew pages

(done) Check what the Hebrew pages look like now that we made default= an alternative to nl=.

The Hebrew pages do not have a single translated lemma. Only the main page header has been translated, and the body of the page is set to RTL mode.

Remove unneeded pages

Remove all the unneeded letter pages and letter templates, for each language that uses them.

Possible 'silent' mode

We may want to add a "silent" mode, where lemmas are not shown if there is no description for that language. This will avoid long pages of untranslated Latin words and expressions, and emphasise the lemmas that have been translated.


This will require an extra parameter, which must be passed down through all the templates. This named parameter should be given with a value, so that it evaluates to "take the then case" for the parser function:

{{#if:{{{silent|}}} | do silent version | do not-silent version}}

That means the parameter should be set as "silent=<something>", with an arbitrary, non-empty value. See Parser functions in templates

  • On page Latin words and expressions/fr: call template {{Latindict|fr|silent=yes}} for silent and {{Latindict|fr}} for not-silent.
  • Template:Latindict: call {{Latindict/A|{{{1}}}|silent={{{silent|}}}}} (with a bar after the parameter). The same for all the other letter-subtemplates.
  • Template:Latindict/A: call {{Dict|lang={{{1}}}|silent={{{silent|}}}|word=...}} (with a bar after the parameter). The same for all the other letter-subtemplates.
  • Inside Template:Dict use {{#if: {{{silent|}}} | do silent stuff | do non-silent stuff}} (again with a bar after the parameter).


The following table shows how the parameter values trickle down to the #if parser, with or without the extra bar (|). The conclusion is that the extra bar should be used thoughout, and the parameter should be omitted for non-silent mode and passed with a value (e.g. silent=yes) for silent mode. The string used for the value (in this example "yes") does not matter. Note that passing the parameter with an empty string as a value ("silent=") will set the result to non-silent.

Note: the use of the variables s1, s2 and s3 is arbitrary, and is used here for clarity. They could all be called silent.

Passing on the silent parameter
Main page Latindict Latindict/A Dict #if
without bar s1={{{silent}}} s2={{{s1}}} {{{s2}}} {{{s2}}}|then|else
{{Latindict|fr}} {{{silent}}} {{{silent}}} {{{silent}}} then
{{Latindict|fr|silent=}} empty string empty string empty string else
{{Latindict|fr|silent=yes}} yes yes yes then
with bar s1={{{silent|}}} s2={{{s1|}}} {{{s2|}}} {{{s2|}}}|then|else
{{Latindict|fr}} empty string empty string empty string else
{{Latindict|fr|silent=}} empty string empty string empty string else
{{Latindict|fr|silent=yes}} yes yes yes then

In the end, all the entries in Template:Latindict need to be modified, as must all calls to Template:Dict in all the letter templates (Template:Latindict/A etc.). And finally Template:Dict needs to implement the silent mode.

Copyright

The contents of this page is © Copyright 2026 by DomoViridi. All rights reserved.