-
Notifications
You must be signed in to change notification settings - Fork 12
New Features
This wouldn't be Localization Plus without adding a couple extra features for users and developers. I have a decent backlog of features I want to add in future versions, but for now let me show you what features v2.0 brings!
Do you speak a language where the form of used adjectives changes according to the thing they're describing? I've added support for these cases when it comes to item prefixes! Some languages also order these differently, so I've added support for that too.
(Both of these can be freely turned on or off inside the mod's configuration too!)
Below you can see an example in es-ES.
- Smart Prefix Inflection and Smart Prefix Position toggled on
- Only Smart Prefix Position toggled on
- Only Smart Prefix Inflection toggled on
- None toggled on (Vanilla)
Ever wanted to make a really cool item name that even changes the position of the prefix inside the name? You may have had to settle for ugly string.Split(' ') and string.Join(' ', parts) operations inside ModifyTooltips, but with Localization Plus you don't need to do that anymore! Simply use this format:
DisplayName: My Super {Prefix} Sword
And Localization Plus will handle the rest, including trimming the spaces around it if needed.
You can also add your own localizable cultures, just like Localization Plus adds support for 18 new languages by itself. I've explained the process in full in this other wiki article: Registering a New Culture
Using Localization Plus, you can add comments in localization files. This means no more typing repeated comments manually. Use the LangUtils.AddComment() method, or the Mod.AddComment() extension method to use this feature.
If you use Localization Plus as a project reference, you will be able to use many methods from the LangUtils utilities class. This class contains a decent amount of, as the name implies, localization utilities. However, the main focus of the methods here is allowing you to easily work with localization files directly.
Some of the things you can do include:
- Extracting localization files from a
Modinstance using theMod.GetLocalizationFiles()extension method. - Getting the
recordtype tML uses for manipulating these files with any overload of theTmodFile.FileEntry.ToLocalizationFile()extension method. - Writing manipulated localization files back to disk using the
LocalizationFile.WriteToDisk()extension method. - Extracting vanilla localization files at various levels of parsing (I recommend using
LangUtils.GetVanillaLanguageFilesForCultureFlattened()since the result is cached for speed). - Extracting vanilla localization values from multiple cultures using
LangUtils.GetVanillaLocalizationValues().
If you want to know if a Mod contains localizations for, say, es-ES, you can do so easily:
if (mod.HasLocalizationsFor("es-ES"))
{
// This mod has es-ES localization files!
}This method also works for custom cultures.