Using the language codes

Any language idiom (externally defined character strings) can be referenced in a SPIP template file using this syntax:

<:prefix:code:>

Looking for a code in several files

It is possible to search for a code in several language files. By default, if the prefix has not been supplied, SPIP will look in the local_xx.php files, then the spip_xx.php files, and finally the ecrire_xx.php files. If it does not find the code in the language requested, it then looks in the French language. If it still does not find the code, it will display the language code itself (but replacing underscore characters with spaces).

You can specify that the search should operate over several files with the following syntax:

<:prefix1/prefix2/.../prefixN:choisir:>

Overwriting a language file

To overwrite the language items already present in a SPIP language file, for example ecrire/lang/spip_xx.php or in a plugin language file lang/plugin_prefix_xx.php, you only need to create a squelettes/lang/local_xx.php file and insert any modified or new items into that file. SPIP automatically uses such "local" files as taking precedence over the others mentioned above.

Such an operation is often used for locale specific overrides - for instance, in France there are regional divisions known as "départements" and "régions", whereas in Switzerland, it might be more appropriate to rename that same field as a "canton".

Example

Select the right documentation!

<:documentation:choisir:>

If bouton_ajouter is not found in the "documentation" language file, then look for it in the "spip" language file, and failing that, in the "ecrire" language file:

<:documentation/spip/ecrire:bouton_ajouter:>

Author Mark Baber Published : Updated : 12/03/23

Translations : English, français, Nederlands