Skip to content

Initializing a LocString(table, entry) may fail if the localization has not been provided #193

@lriuui0x0

Description

@lriuui0x0

I added such a helper in the mod I'm working on, maybe consider adding it to the baselib?

    public static string Localize(string table, string entry)
    {
        try
        {
            return new LocString(table,entry).GetFormattedText();
        }
        catch (LocException)
        {
            LocManager.Instance.StartOverridingLanguageAsEnglish();
            var str = new LocString(table, entry).GetFormattedText();
            LocManager.Instance.StopOverridingLanguageAsEnglish();
            return str;
        }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions