Scripting API

Scripting API

Language

Record struct in Abyss.Core, from Abyss.Core.

A language a game can be shown in: its code as BCP 47 writes it (ru, pt-BR, zh-Hans), its name in English, and its name in itself, which a language menu shows.

public readonly record struct Language

Constructors

Language

public Language(string Code, string EnglishName, string NativeName)

A language a game can be shown in: its code as BCP 47 writes it (ru, pt-BR, zh-Hans), its name in English, and its name in itself, which a language menu shows.

Parameters

  • Code: Its code, as BCP 47 writes it.
  • EnglishName: Its name in English.
  • NativeName: Its name in itself: Русский, Español (España).

Properties

Code

public string Code { get; init; }

Its code, as BCP 47 writes it.

EnglishName

public string EnglishName { get; init; }

Its name in English.

NativeName

public string NativeName { get; init; }

Its name in itself: Русский, Español (España).

Known

public static IReadOnlyList<Language> Known { get; }

Every language the engine knows by name, by its English name. A game can have others, known by their codes.

RightToLeft

public bool RightToLeft { get; }

Whether the language is written right to left: Arabic, Hebrew, Persian, Urdu. A game shown in one mirrors its UI documents.

Plurals

public IReadOnlyList<PluralCategory> Plurals { get; }

The plural categories the language has, PluralCategory.Other last: the forms a string with a count is written in for it.

Methods

Of

public static Language Of(string code)

The language of a code: the engine's names for it where it knows them, its code for both otherwise.

Parameters

  • code

Exceptions

  • ArgumentException: It is no language's code.

Canonical

public static string? Canonical(string code)

A code as BCP 47 writes it, whichever way it came: pt_br and PT-BR are pt-BR, zh-hans is zh-Hans; null for what no code is.

Parameters

  • code

PluralOf

public PluralCategory PluralOf(string number)

The plural category a number takes in the language, as it is written (1, 1.0, 21); PluralCategory.Other for what is no number.

Parameters

  • number

ToString

public override string ToString()

Its code.