.. _sld_language:
i18N in SLD
================
This section describes how to specify metadata (titles and abstracts) in different languages in SLD documents.
Metadata in different languages
-------------------------------
GeoServer extends Title and Abstract sections, so that text in different languages can be included.
This is an example of the syntax to use:
.. code-block:: xml
This is the default title
English titleTitolo in italiano
A default text (``This is the default title`` in the example) and a set of Localized sections, one for each language that you want to support.
Each ``Localized`` section specifies the language (using a two letter abbreviation in the ``lang`` attribute) and the related text.
Currently, GeoServer supports localized text in SLD in WMS GetLegendGraphic requests (legends that contain labels are rendered using the
requested language, if a ``LANGUAGE`` parameter is added to the request, e.g. ``LANGUAGE=it``).
Using the language function
---------------------------
GeoServer provides a ``language`` function that can be used to get the ``LANGUAGE`` requested in ``GetMap`` or ``GetFeatureInfo`` request. The function can be used to generate maps whose symbology is language dependent.
Here is an example providing **labels in multiple languages**, integrating the ``language`` function with ``Recode`` e.g:
.. code-block:: xml
#000000
The empty ```` elements acts as the default language, matching a value with a missing language parameter. If there is no default value,the default language will be returned. See :ref:`internationalization` for details on ``Default Language``.
It is also possible to use the ``language`` function in a rule filter, **filtering rules
for both rendering and legend production** purposes. This one shows how to refer to different symbols
based on the current language:
.. code-block:: xml
itimage/png32deimage/png32
Specifically for the external graphics, if the external symbols are all co-located, and follow
a naming convention including the language identifier, then it's also possible to **embed the
language in the symbol URL**:
.. code-block:: xml
image/png32