Skip to main content

nwnrs_localization/
lib.rs

1#![forbid(unsafe_code)]
2#![doc = "# nwnrs-localization\n\n`nwnrs-localization` defines the small vocabulary that recurs across TLK, GFF,\nSSF, and installation-facing resource loading.\n\n## Scope\n\n- represent NWN language identifiers\n- represent dialog string references\n- represent the male/female selector used by TLK lookup\n- keep those foundational concepts consistent across the workspace\n\nThe relevant entry points are [`Language`], [`StrRef`], and\n[`resolve_language`].\n\n## Public Surface\n\n### Core types\n\n- `StrRef`\n- `Language`\n- `Gender`\n\n### Constants and parsing\n\n- `BAD_STRREF`\n- `ParseLanguageError`\n- `resolve_language`\n\n### Important `Language` operations\n\n- `Language::id`\n- `Language::short_code`\n- `Language::from_id`\n- `FromStr for Language`\n\n## Logical Edges\n\n- `BAD_STRREF` is the sentinel for \"no string\" and must be treated as such by\n  higher layers\n- `Language` is an NWN-specific vocabulary, not a general i18n abstraction\n- `Gender` is here because TLK lookup has male/female layering semantics\n- `resolve_language` and `FromStr` form the normalization boundary between user\n  input, install directory naming, and the typed language enum\n\n## See also\n\n- [`nwnrs-tlk`](https://docs.rs/nwnrs-tlk), which uses `Language`, `Gender`,\n  and `StrRef` for dialog-table lookup\n- [`nwnrs-gff`](https://docs.rs/nwnrs-gff), which uses `StrRef` and `Language`\n  for localized string fields\n- [`nwnrs-ssf`](https://docs.rs/nwnrs-ssf), which stores `StrRef` values in\n  soundset slot entries\n- [`nwnrs-encoding`](https://docs.rs/nwnrs-encoding), which provides the\n  byte-level text encoding that this crate builds on\n\n## Why This Crate Exists\n\nWithout a single localization vocabulary, every crate that touched `TLK` or\nlanguage roots would reinterpret the same concepts independently.\n"include_str!("../README.md")]
3
4mod resolve;
5mod types;
6
7pub use resolve::*;
8pub use types::*;
9
10/// Common imports for consumers of this crate.
11pub mod prelude {
12    pub use crate::{BAD_STRREF, Gender, Language, ParseLanguageError, StrRef, resolve_language};
13}