Skip to content

Variables

Variable Tagging

In order for variables to be used properly, they'll typically have to be tagged.

Tagging Might be Optional

This depends on a case-by-case basis, determined by the actual variable text as well as the language you're using. For example, if the whole variable text is a full error message, tagging isn't necessary, as the text will be inserted 1:1. Names, like monster names, on the other hand should always be tagged accordingly. If you're unsure, just tag everything, which gives translators the most flexibility.

Syntax

Tagging always happens by appending a circumflex character (^) followed by one or more of the following tags.

The first tag always denotes the primary gender of the object or name as well as whether it's a proper name or not (i.e. whether it appears with or without articles).

Manual Plural Definition

While the Grammar Engine is capable of determining the correct plural forms for many words, it might fail in case of certain compound words or rare and unusual cases.

In such situations it's possible to define a plural form by hand simply by appending it using | as a separator:

singular form^n|plural form^p

Russian, which supports an alternative plural form based on the actual count, may define a second plural form the same way:

singular form^n|plural form 1^p|plural form 2^p

Separator Might be Different

Based on your project, there might be a different character sequence to properly separate plural forms.

For example, if a single | would conflict with other markup code, it's possible to change it to || in code.

Primary Tags

Note that not all tags are available or used in all languages and it's possible they need a secondary tag to further add details, like whether a French plural would be male or female.

Tag Description Example
m Object is male and has articles hero^m, deadly skeleton^n
f Object is female and has articles sorceress^f, wife^f
n Object is neuter and has articles dog^n, stick^n
p Object is plural and has articles* villagers^p, people^p
M Object is male without articles Mario^M, Pete^M
F Object is female without articles Julia^F, Anne^F
N Object is neuter without articles Berlin^N, Excalibur^N
P Object is plural without articles* Cirque du Soleil^P
x Variable is static text only easy^x, medium^x, hard^x

* Plural cases in some languages, such as French, might require a secondary tag to set the proper gender.

Default Gender

Even if you don't provide any tagging, variables will inherit some default gender based on the language being used.

If you want make sure variable contents aren't modified, always tag them using x or use the X flag for the placeholder.

Secondary Tags

In addition to a primary tag, variables might also include one or more secondary tags to include further details. Typical examples include overwriting genders, e.g. to denote a male job name being fulfilled by a woman, or adding further declension hints (such as marking an owner/genitive case for proper declension).

Secondary Tag Description Example
m/n/f/p With p: Define the plural's gender.
With others: Set gender object is addressed with.
πŸ‡«πŸ‡·hommes^pf, πŸ‡«πŸ‡·femmes^pf
πŸ‡©πŸ‡ͺWache^mf, dog^mn
g Skip first noun for declension (typically genitive). πŸ‡©πŸ‡ͺJans Schwert^Ng
G Skip first two nouns for declension (typically genitive). πŸ‡©πŸ‡ͺKrieger Jans Schwert^NG
s Object is not countable, i.e. there's no proper plural form. water^ns, waste^ns
2 Object describes a pair of something. Experimental boots^p2, daggers^p2
d Object always uses a definitive article. unholy crown^nd, destroyer of worlds^md
D Object always uses a definitive article in uppercase. Unholy Crown^nD, Destroyer of Worlds^mD
l Object is alive. Only used for Russian. πŸ‡·πŸ‡ΊΠšΠΎΡ€Π΄ΡŒΠ΅^Ml, πŸ‡·πŸ‡ΊΠœΠ°ΡˆΠ°^Fl
x Keep the gender, but don't decline the object. Mario^Mx, Michelle^Fx
c Last adjective in front of noun is uppercase. (German only)
C All adjectives in front of noun are uppercase. (German Only)

Word Type Definitions

While the Grammar Library will try to determine the actual types of words in a variable – e.g. by identifying uppercase German words as nouns – such approaches aren't always working, especially in languages like Russian or Polish. As such, the Russian and Polish modules both support an extra definition following the regular tags. You may use any combination of the following extra tags behind the regular gender (and any other) tags.

Automatic Detection

By default, if you don't define word types for all words in a term, the Grammar Engine will try to determine them on its own. This works well for most cases, but might fail in more complex instances, especially for names or titles. If in doubt, it's always better to explizitly add tags for all words.

Type Definition Description
a{...} Define the words indexed by ... as having adjective declension.
n{...} Define the words indexed by ... as having noun declension.
x{...} Define the words indexed by ... as having no declension.

Word Index

Please note this uses natural counting rather than a more programmatic approach. The first word has index "1", the second "2" and so on.

Example Notes
adjective adjective noun postfix^m Define the variable as male, the Grammar Engine will try to find the noun.
adjective adjective noun postfix^mn{3} Define the third word to be the noun, all words to the left (first two) are considered adjectives.
adjective adjective noun postfix^mn{3}a{1,2} Same as above, but explicitly mark the first two words as adjectives.
adjective adjective noun postfix^mn{3}a{1,2}x{4} Same as above, but explicitly mark the first two words as adjectives and the last word as having no declension.

Name Generator Tags

The Name Generator uses the primary and secondary tags mentioned above for its noun definition.

All affixes are defined by a special set of primary tags. These must not be combined with any of the others and may be followed by an optional single digit number denoting the priority/position of the affix in case there's more than one in its class.

Affix Tag Description Example
a Affix is supposed to be a prefix. An optional following single digit number may mark priority. healing^a, strong^a9, divine^a1
z Affix is supposed to be a postfix. An optional following single digit number may mark priority. of healing^z, of strength^z9, of the Divines^z1, "Thunderblast"^z
- Affix is supposed to be prepended using a hyphen. This is typically used for group associations in German. πŸ‡©πŸ‡ͺBanditen^-, πŸ‡©πŸ‡ͺWinternacht^-
+ Affix is supposed to be prepended forming a compound word. πŸ‡©πŸ‡ͺStahl^+, πŸ‡©πŸ‡ͺGroß^+
= β‰₯1.6.2Affix defines a unique name for the generated name to be added. Excalibur^=
~ β‰₯1.7.3Postfix is supposed to be appended, forming a compound word. πŸ‡©πŸ‡ͺlein^~, πŸ‡―πŸ‡΅-san^~, πŸ‡―πŸ‡΅γ•γ‚“^~

Adding Owners with the Name Generator

Make sure you're not trying to add an owning entity using prefix (a tag), as this might not work for all languages. Instead use a regular proper name (e.g. Mike^M), which will be handled accordingly.


Last update: January 31, 2024