logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class SteamPartnerLocaleMap

    Maps Unity/Serenity locale codes to and from the language names the Steamworks partner site uses for achievement display text, and back.

    Inheritance
    object
    SteamPartnerLocaleMap
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.Steam.Infrastructure
    Assembly: Serenity.Steam.Infrastructure.dll
    Syntax
    public static class SteamPartnerLocaleMap
    Remarks

    The canonical pairs are Steamworks' own published "Supported Languages" list. A handful of locale codes Unity spells differently than this project's own convention (zh-Hans, zh-Hant, pt-PT) are accepted as ALIASES on TryToSteamLanguage(string, out string) only — TryToLocaleCode(string, out string) only ever answers a canonical code, so a pull round-trip never invents a locale code this project did not already use to push.

    No two canonical locale codes may resolve to the same Steam language: that would leave a pull unable to tell which locale a Steam string belongs to. The lookup table is built once, at type load, and throws if the seed data ever violates that — enforcement by construction rather than a check a caller could skip. SteamPartnerLocaleMapTests also asserts it by walking every entry.

    Fields

    EnglishLocaleCode

    The locale code Steam's english maps to — and the one a bare-string text field is filed under.

    Declaration
    public const string EnglishLocaleCode = "en"
    Field Value
    Type Description
    string

    Properties

    Aliases

    Declaration
    public static IReadOnlyDictionary<string, IReadOnlyList<string>> Aliases { get; }
    Property Value
    Type Description
    IReadOnlyDictionary<string, IReadOnlyList<string>>

    For each canonical locale code that has aliases, the other codes a project may spell the same language with (zh-CN is also zh-Hans, pt is also pt-PT).

    DisplayNames

    Declaration
    public static IReadOnlyDictionary<string, string> DisplayNames { get; }
    Property Value
    Type Description
    IReadOnlyDictionary<string, string>

    The English name Steam's partner site gives each canonical locale code's language.

    SupportedLocaleCodes

    Declaration
    public static IReadOnlyList<string> SupportedLocaleCodes { get; }
    Property Value
    Type Description
    IReadOnlyList<string>

    Every canonical locale code this map carries, ordinal-sorted.

    Methods

    TryToLocaleCode(string, out string)

    Resolves a Steam language name back to its canonical locale code.

    Declaration
    public static bool TryToLocaleCode(string steamLanguage, out string localeCode)
    Parameters
    Type Name Description
    string steamLanguage

    The Steam language name to resolve. Case-insensitive.

    string localeCode

    The canonical locale code, or empty when it did not resolve.

    Returns
    Type Description
    bool

    Whether the Steam language name resolved.

    TryToSteamLanguage(string, out string)

    Resolves a locale code to the Steam language name used in achievement text fields.

    Declaration
    public static bool TryToSteamLanguage(string localeCode, out string steamLanguage)
    Parameters
    Type Name Description
    string localeCode

    The locale code to resolve. Case-insensitive.

    string steamLanguage

    The canonical Steam language name, or empty when it did not resolve.

    Returns
    Type Description
    bool

    Whether the locale code resolved, canonically or through a known alias.

    In this article
    © 2026 Serenity. All Rights Reserved