Skip to main content

Crate nwnrs_localization

Crate nwnrs_localization 

Source
Expand description

§nwnrs-localization

nwnrs-localization defines the small vocabulary that recurs across TLK, GFF, SSF, and installation-facing resource loading.

§Scope

  • represent NWN language identifiers
  • represent dialog string references
  • represent the male/female selector used by TLK lookup
  • keep those foundational concepts consistent across the workspace

The relevant entry points are Language, StrRef, and resolve_language.

§Public Surface

§Core types

  • StrRef
  • Language
  • Gender

§Constants and parsing

  • BAD_STRREF
  • ParseLanguageError
  • resolve_language

§Important Language operations

  • Language::id
  • Language::short_code
  • Language::from_id
  • FromStr for Language

§Logical Edges

  • BAD_STRREF is the sentinel for “no string” and must be treated as such by higher layers
  • Language is an NWN-specific vocabulary, not a general i18n abstraction
  • Gender is here because TLK lookup has male/female layering semantics
  • resolve_language and FromStr form the normalization boundary between user input, install directory naming, and the typed language enum

§See also

  • nwnrs-tlk, which uses Language, Gender, and StrRef for dialog-table lookup
  • nwnrs-gff, which uses StrRef and Language for localized string fields
  • nwnrs-ssf, which stores StrRef values in soundset slot entries
  • nwnrs-encoding, which provides the byte-level text encoding that this crate builds on

§Why This Crate Exists

Without a single localization vocabulary, every crate that touched TLK or language roots would reinterpret the same concepts independently.

Modules§

prelude
Common imports for consumers of this crate.

Structs§

ParseLanguageError
An error returned when a language identifier cannot be parsed.

Enums§

Gender
A gender selector for TLK lookups.
Language
A supported NWN language identifier.

Constants§

BAD_STRREF
The sentinel string reference used for “no string”.

Functions§

resolve_language
Resolves a language from a numeric id, short code, or English name.

Type Aliases§

StrRef
A TLK string reference.