Filter by Language
You can use the xml:lang
attribute to filter content by (natural) language for HTML and PDF outputs. This means you can mark an element as being appropriate for a language, and the element will only be included if the content is published to that language. If you publish to different
languages, the element is excluded.
The xml:lang
attribute works a little differently to the other filter attributes. Firstly, to use it, you need to enable the feature on the layout that you will use for publishing. Then you can add it to elements that you want to filter, and finally, you publish and choose what languages to
publish to. Paligo applies the language filters automatically, based on what languages you are publishing to.
-
Select Layout and edit the layout you are going to use for publishing.
-
Enable the Use xml:lang as profiling attribute setting. This is in the Classes and Attributes settings for HTML layouts and in the General > Filtering and Taxonomies section for PDF layouts.
-
In your content, select an element that you want to filter by language.
-
Use the Element attributes section to add the
xml:lang
filter attribute and set its value to the appropriate language. For the language values, use the two letter language codes, for example, en for English, sv for Swedish.Important
Use the two letter codes shown in the Languages section (see step 6). Only these two letter codes are supported. You cannot use alternative language codes.
-
Repeat steps 3 and 4 for other any other elements you want to filter by language.
-
Publish your content and choose the layout you edited in step 1 and the language(s) that you want to publish to:
If you publish to a language that matches the value of the
xml:lang
filtered content, that content is included in the output.If you publish to a language that does not match the value of the
xml:lang
filtered content, that content is excluded from the output. -
Set any variables and other profiles as required, and then publish.