While many placeholder texts in English can be implemented by simply inserting values as-is, most other languages require more attention, handling declension, article selection, and other details.
As such it is possible for every placeholder in texts parsed by the Grammar Engine to optionally define one or multiple tags to specficy how to interpret the placeholder and/or an actual grammatical case to be used.
Implicit Detection
Most common use cases in many languages can be auto-detected by the Grammar Engine. For this to be possible, placeholders have to be directly preceded by the correct articles or prepositions in masculine form (even if the inserted placeholder value is known to never be masculine in the first place). For example, in German der <<1>> will cause the library to always insert the correct definite article in nominative case according to the value.
Explicit Declaration
In many cases the implicit detection might not be an option, for example when inserting only pronouns. In this case you can directly define grammatical case and/or the specific terms to be inserted as <<case:variable>>, <<case,tags:variable>>, or <<tags:variable>>.
Available Grammatical Cases
The Grammar Engine supports the following grammatical cases depending on the active language:
| Code(s) | Description |
|---|---|
nom ime име |
Nominative case |
gen rod род |
Genitive case |
dat дат |
Dative case |
acc akk vin вин |
Accusative case |
loc lok |
Locative case |
voc vok |
Vocative case |
ins tvo тво |
Instrumental case |
pre пре |
Prepositional case |
Available Placeholder Tags
The Grammar Engine supports a whole range of extra tags to change the inserted value. For example, it's possible to create genitive/owner constructs, generate matching pronouns, and more. The following is just an excerpt of the most commonly used tags. For a full and up to date list, please refer to the official documentation.
Switches
Sometimes it might be necessary to change parts of texts based on the singularity or plurality of a value or based on its gender. Both of these can be achieved by embedding all possible options within a placeholder, where the resulting text will depend on the value to be inserted (or actually be omitted).
Singular/Plural Switches
| Placeholder | Description |
|---|---|
<<variable[singular/plural]>> |
Pick different text based on the numerical value. |
<<variable[zero/singular/plural]>> |
Pick different text based on the numerical value. |
<<variable[singular/plural 1/plural 2]>> |
Pick different text based on the numerical value for languages with multiple plural forms. |
The individual values within brackets may contain %s, $s, %d, or $d placeholders, which will be replaced by the actual value. If the value is not a number, it will be treated as singular or plural based on its set gender.
Please note that the exact order, meaning, and availability of the options may vary by language.
Gender Switches
| Placeholder | Description |
|---|---|
<<variable{m/f}>> |
Pick different text based on the grammatical gender of the value. |
<<variable{m/f/n}>> |
Pick different text based on the grammatical gender of the value. |
<<variable{m/f/n/p}>> |
Pick different text based on the grammatical gender of the value. |
<<variable{m/f/pm/pf}>> |
Pick different text based on the grammatical gender of the value. |
Please note that the exact order, meaning, and availability of the options may vary by language.