rednode API - v0.80.1
    Preparing search index...

    Interface Loc

    The game's own text, read from the running game in its current language (#26).

    interface Loc {
        language(): Promise<Language>;
        text(key: string | number): Promise<string | null>;
        text(keys: readonly (string | number)[]): Promise<(string | null)[]>;
    }
    Index
    • The game's text for a LocKey, such as a record's LocalizedName(), in the language the player chose for on-screen text. A number n means "LocKey#n"; a secondary key such as "UI-Menus-WorldMap-Title" works too (unverified for every key). null for a key the game does not know. An array of keys is read in one round trip.

      Works at the main menu and in a save; while the game is still starting the texts may not be loaded yet (unverified).

      Parameters

      • key: string | number

      Returns Promise<string | null>

      import { loc, tweakdb } from "rednode";

      const district = await tweakdb.record("Districts.Watson", "District");
      const name = await loc.text(await district!.LocalizedName()); // "Watson", in the player's language
      const [a, b] = await loc.text(["LocKey#10947", 10963]); // "Watson", "Little China"
    • Parameters

      • keys: readonly (string | number)[]

      Returns Promise<(string | null)[]>