Scripting API

Scripting API

LocalizationSettings

Class in Abyss.Core, from Abyss.Core.

A game's languages: settings/localization.json beside the game's assets, which Project Settings' Localization page lays out — whether the game is localized, its languages, the one it is written in, which it starts in, and what a missing string shows.

public sealed class LocalizationSettings

Remarks

A project without the file is not localized, and nothing of localization runs. Ticking Localize this game writes it; unticking keeps the languages for later, the game unlocalized.

Properties

Enabled

public bool Enabled { get; set; }

Whether the game is localized; false keeps the languages, unused.

Languages

public List<string> Languages { get; set; }

The game's languages, by their codes as BCP 47 writes them, in the order a menu lists them.

Default

public string Default { get; set; }

The language the game is written in, one of LocalizationSettings.Languages: what every other falls back to, and the game starts in where nothing else says.

SavedChoiceFirst

public bool SavedChoiceFirst { get; set; }

Whether a game starts in the language the player last chose, where they chose one.

SystemLanguage

public bool SystemLanguage { get; set; }

Whether a game starts in the system's language where the game has it, or one of the same language, before its default.

Missing

public MissingStrings Missing { get; set; }

What a string missing from the language in use shows.

Notes

public bool Notes { get; set; }

Whether the Localization window shows each entry's note for translators, and a spreadsheet exported has them; off unless a project turns it on.

Digits

public NumberDigits Digits { get; set; }

Which digits numbers are written in: each language's, Latin ones, or each language's own.

Localized

public bool Localized { get; }

Whether the game is localized and has a language to be shown in: what a game uses.

Methods

FileIn

public static string FileIn(string game)

Where a game keeps it: settings/localization.json in its folder.

Parameters

  • game

Read

public static LocalizationSettings Read(string game)

A game's settings; those of a game not localized where it has no file.

Parameters

  • game

Exceptions

  • FormatException: The file is not settings this build reads, saying why.
  • IOException: The file is there and cannot be read.

Parse

public static LocalizationSettings Parse(string json)

Settings from their text.

Parameters

  • json

Exceptions

  • FormatException: It is not settings this build reads, or its languages are none a game can have, saying why.

WhyNot

public string? WhyNot()

What is wrong with the languages: a code that is none, or not as BCP 47 writes it, a language twice, or a default that is not one of them while there are any; null when nothing is.

ToJson

public string ToJson()

The settings as their file holds them.

Write

public void Write(string game)

Writes the settings into a game's folder.

Parameters

  • game

Copy

public LocalizationSettings Copy()

A copy, to change without changing this.

Constants

FileName

public const string FileName = "localization.json"

The file, under the game's settings folder.

PathName

public const string PathName = "settings/localization.json"

What it is called in a game's folder and in its pack: settings/localization.json.

CurrentVersion

public const int CurrentVersion = 1

The version of the file this build writes, and the newest it reads.