Skip to content

kalilistic/Dalamud.Loc

Repository files navigation

Dalamud.Loc

Nuget

A localization library to use with dalamud plugin projects for FFXIV. Avoid boring boilerplate code in your plugin project and use this instead. The library supports JSON and can load strings directly, embedded resources, and local/remote files. Brought to you by SheepGoMeh and kalilistic.

Sample Json

{
  "OptionShowFriends": "Afficher les amis",
  "OptionLanguage": "Langue",
  "LanguageName": "Français"
}

Basic Example

// create localization obj
var loc = new Localization(dalamudPluginInterface);

// load language
loc.LoadLanguage(Language.French, frenchStringsJson);

// set current language
loc.CurrentLanguage = Language.French;

// use localized strings
var text = loc.GetString("MyStringKey");

// clean up when done
loc.Dispose();

Other ways to load strings

// load from string
loc.LoadLanguage(Language.French, frenchStringsJson);

// load from local file
loc.LoadLanguageFromFile(Language.French, pluginInterface.ConfigDirectory + "/loc/fr.json");

// load from embedded resource
loc.LoadLanguageFromAssembly(Language.French, "MyPlugin.Resource.translation.fr.json");

// load from remote file
loc.LoadLanguageFromUrl(Language.French, urlToJson);

Using localized ImGui components

LocGui.Text("MyStringKey");

About

Localization library for dalamud plugins

Topics

Resources

License

Stars

Watchers

Forks

Languages