Show / Hide Table of Contents

Class CustomLocalization

Wrapper to hold each mod localization data.
Inheritance
System.Object
CustomEntity
CustomLocalization
Inherited Members
CustomEntity.SourceMod
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: Jotunn.Entities
Assembly: Jotunn.dll
Syntax
public class CustomLocalization : CustomEntity

Constructors

| Improve this Doc View Source

CustomLocalization()

Default constuctor.
Declaration
public CustomLocalization()
| Improve this Doc View Source

CustomLocalization(BepInPlugin)

SourceMod hint constuctor.
Declaration
public CustomLocalization(BepInPlugin sourceMod)
Parameters
Type Name Description
BepInPlugin sourceMod Mod data in the shape of BepInPlugin class.

Methods

| Improve this Doc View Source

AddFileByPath(String, Boolean)

Add a translation file via absolute path.
Declaration
public void AddFileByPath(string path, bool isJson = false)
Parameters
Type Name Description
System.String path Absolute path to file.
System.Boolean isJson Is the language file a json file.
| Improve this Doc View Source

AddJsonFile(String, String)

Add a json language file (match crowdin format).
Declaration
public void AddJsonFile(string language, string fileContent)
Parameters
Type Name Description
System.String language Language for the json file, for example, "English"
System.String fileContent Entire file as string
| Improve this Doc View Source

AddLanguageFile(String)

Add a Unity style translation file.
Declaration
public void AddLanguageFile(string fileContent)
Parameters
Type Name Description
System.String fileContent Contents of the language file in string format.
| Improve this Doc View Source

AddTranslation(String, Dictionary<String, String>)

Add a group of translations.
Declaration
public void AddTranslation(in string language, Dictionary<string, string> tokenValue)
Parameters
Type Name Description
System.String language Language of the translation you want to add.
System.Collections.Generic.Dictionary<System.String, System.String> tokenValue Token-Value dictionary.
| Improve this Doc View Source

AddTranslation(String, String)

Add a translation.
Declaration
public void AddTranslation(in string token, string translation)
Parameters
Type Name Description
System.String token Token of the translation you want to add.
System.String translation The translation.
| Improve this Doc View Source

AddTranslation(String, String, String)

Add a translation.
Declaration
public void AddTranslation(in string language, in string token, string translation)
Parameters
Type Name Description
System.String language Language of the translation you want to add.
System.String token Token of the translation you want to add.
System.String translation The translation.
| Improve this Doc View Source

ClearAll()

Clear all localization data.
Declaration
public void ClearAll()
| Improve this Doc View Source

ClearLanguage(String)

Attempts to remove given language.
Declaration
public void ClearLanguage(in string language)
Parameters
Type Name Description
System.String language Language to clear.
| Improve this Doc View Source

ClearToken(String)

Attempts to remove a given token from default language.
Declaration
public void ClearToken(in string token)
Parameters
Type Name Description
System.String token Token to clear.
| Improve this Doc View Source

ClearToken(String, String)

Attempts to remove a given token from certain language.
Declaration
public void ClearToken(in string language, in string token)
Parameters
Type Name Description
System.String language Language from which to search the token.
System.String token Token to clear.
| Improve this Doc View Source

Contains(String, String)

Checks if a translation exists for given language and token.
Declaration
public bool Contains(in string language, in string token)
Parameters
Type Name Description
System.String language Language being checked.
System.String token Token being checked.
Returns
Type Description
System.Boolean True if the token was found.
| Improve this Doc View Source

GetLanguages()

Retrieve list of languages that have been added.
Declaration
public IEnumerable<string> GetLanguages()
Returns
Type Description
System.Collections.Generic.IEnumerable<System.String>
| Improve this Doc View Source

GetTranslations(String)

Retrieve translations for given language.
Declaration
public IReadOnlyDictionary<string, string> GetTranslations(in string language)
Parameters
Type Name Description
System.String language Language of the translation you want to retrieve.
Returns
Type Description
System.Collections.Generic.IReadOnlyDictionary<System.String, System.String>
| Improve this Doc View Source

ToString()

Declaration
public override string ToString()
Returns
Type Description
System.String
Overrides
System.Object.ToString()
| Improve this Doc View Source

TryTranslate(String)

Retrieve a translation from this custom localization or . Searches with the user language with a fallback to English.
Declaration
public string TryTranslate(string word)
Parameters
Type Name Description
System.String word Word to translate.
Returns
Type Description
System.String Translated word in player language or english as a fallback.

Extension Methods

PrefabExtension.FixReferences(Object)
  • Improve this Doc
  • View Source
☀
☾
In This Article
Back to top
Generated by DocFX
☀
☾