You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tags/text.md
+14-9Lines changed: 14 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -21,22 +21,17 @@ tags:
21
21
<txp:text />
22
22
~~~
23
23
24
-
The **text** tag is a *single* tag which is primarily used to return localized language strings from the `txp_lang` database table.
24
+
The **text** tag is a *single* tag which is used to return localized language strings from the `txp_lang` database table.
25
25
26
-
Note: only language strings designated with a type of [`common`](https://github.com/textpattern/textpacks/blob/main/lang/en.ini#L265) or [`public`](https://github.com/textpattern/textpacks/blob/main/lang/en.ini#L776) are available to use. All other language string types are reserved for use within the Textpattern system itself.
26
+
Note: only language strings designated with a type of [`common`](https://github.com/textpattern/textpacks/blob/main/lang/en.ini#L265) or [`public`](https://github.com/textpattern/textpacks/blob/main/lang/en.ini#L776) are available to use. All other language string types are reserved for use within the Textpattern back-end system itself.
27
27
{: .alert-block .information}
28
28
29
29
## Attributes
30
30
31
31
Tag will accept the following attributes (**case-sensitive**) as well as the {% include atts-global-link.html %}:
: Escape [HTML entities](https://developer.mozilla.org/en-US/docs/Glossary/Entity) such as `<`, `>` and `&` within text.
35
-
: **Values:** See the [tag escaping](/tags/learning/#tag-escaping) documentation for all possible values.
36
-
: **Default:**`html`.
37
-
38
33
`item="text"`
39
-
: Piece of text to display, preferably an item from the `name` column of the `txp_lang` database table. If the given item matches a key there, the contents of the respective item in the `data` column will be returned. Otherwise, whatever you supply as the `item` value is returned verbatim.
34
+
: Piece of text to display, preferably an item from the `name` column of the txp_lang database table. If the given item matches a key in the currently selected site language, the contents of the respective item in the `data` column will be returned. Otherwise, whatever you supply as the `item` value is returned verbatim.
40
35
41
36
## Examples
42
37
@@ -48,7 +43,17 @@ Tag will accept the following attributes (**case-sensitive**) as well as the {%
48
43
</txp:older>
49
44
~~~
50
45
51
-
Outputs the text 'older' inside the `<txp:older />` tag, respecting the current Textpattern language, instead of using the tag like this: `<txp:older>older</txp:older>` which would always render the English text 'older', it replaces the contents with the value assigned to the name 'older' in the current language. So you would see a link with the word 'älter' if you were using German `de` as the Textpattern site language.
46
+
Replaces the contents of the tag with the value assigned to the name 'older' in the current site language. It takes this information from the matching key 'older' in the txp_lang database table. So if you were using German `de` as the Textpattern site language, you would see a link with the word 'älter'.
47
+
48
+
If, however, you had used the `<txp:older>` tag tag like this:
49
+
50
+
~~~html
51
+
<txp:older>
52
+
Older
53
+
</txp:older>
54
+
~~~
55
+
56
+
then it would always render English text, which is undesirable if your site is changed to show content in a different language.
0 commit comments