wesnoth/data/schema/macros.cfg
Celtic Minstrel 0c42cdc038
Enable translation mark validation by the schema (#5800)
- The t_string type is now a schema built-in type and no longer attempts a regex match.
- You can also specify that non-t_string types may be optionally-translatable; this case supports a regex match on the string (but note that the translation mark is not part of the match).
- Error messages involving keys with very large values ( > 128 characters) will now truncate the value.
- To account for occasional cases where the schema is intentionally violated, the --validate command-line option now automatically defines the SCHEMA_VALIDATION preprocessor define.

A key validates as type t_string if one of the following is true:
- The key is not present
- The key has at least one segment with a translation mark
- The key is blank (an empty string)

Any type other than t_string is not allowed to be translatable by default, unless you specify allow_translatable=yes in the [type] tag.

An optionally-translatable string could also be defined as a union of t_string and some other type.
2021-06-14 23:59:52 -04:00

73 lines
1.1 KiB
INI

#define SIMPLE_KEY NAME TYPE
[key]
name="{NAME}"
type="{TYPE}"
[/key]
#enddef
#define DEFAULT_KEY NAME TYPE DEFAULT
[key]
name="{NAME}"
type="{TYPE}"
default={DEFAULT}
[/key]
#enddef
#define REQUIRED_KEY NAME TYPE
[key]
name="{NAME}"
type="{TYPE}"
mandatory=yes
[/key]
#enddef
#define DEPRECATED_KEY NAME TYPE
[key]
name="{NAME}"
type="{TYPE}"
deprecated=yes
[/key]
#enddef
# Use to specify that unknown keys are always valid in a tag
#define ANY_KEY TYPE
[key]
name="*"
type="{TYPE}"
[/key]
#enddef
# Defines a tag that must contain no content
#define EMPTY_TAG NAME MIN MAX
[tag]
name="{NAME}"
min={MIN}
max={MAX}
[/tag]
#enddef
# Defines a tag that can contain any arbitrary content
#define DATA_TAG NAME MIN MAX TYPE
[tag]
name="{NAME}"
min={MIN}
max={MAX}
any_tag=yes
{SIMPLE_KEY * {TYPE}}
[/tag]
#enddef
#define LINK_TAG PATH
[link]
name="{PATH}"
[/link]
#enddef
# These are "magic" keys allowed whenever two WML tags are merged.
#define WML_MERGE_KEYS
{SIMPLE_KEY __remove bool}
{SIMPLE_KEY add_to_* int}
{SIMPLE_KEY concat_to_* string}
#enddef