Localization

Localization is not directly implemented in TutorialMAX, since we provide no compatibility nor support for third-party packages. However, it's really easy to write your own scripts to connect TutorialMAX to your favorite localization package.

Depending on your use case:

  • You can set the string values within your scripts. All you need is a reference to TutorialMAX's component and a script to set the string accordingly.
  • Most use-cases can be covered by simply creating new string modifiers (Implementation of TutorialStringModifierBase) that work based on your game's logic.
  • If you're working with a key-value based localization system, you can create a new string modifier that fetches the value from your localization package. To do this you'll need to extend and implement the base class TutorialStringModifierBase.
  • You could roll out your own custom state behavior that supports localization by default. In this case, extend the base class TutorialStateBehaviorBase.
In both cases mentioned above there are (New Script) options in the Add context menus for convenience. You won't need to memorize the class names.

Examples For Unity Localization Package

1. Based on Entry Key


using UnityEngine;
using UnityEngine.Localization;
using UnityEngine.Localization.Settings;
using TutorialMax;

[TutorialMenu("Localization/Unity Localization")]
public class LocalizationStringModifier : TutorialStringModifierBase
{
	public string TableName;

	protected override void ApplyOverride(TutorialStringModifierContext context)
	{
		context.Value = LocalizationSettings.StringDatabase.GetLocalizedString(TableName, context.Value);
	}
}

This example is really basic of course. For example, you could have parameters in the original string besides the key and then parse that string within your modifier.

2. Based on Game Logic


using UnityEngine;
using UnityEngine.Localization;
using UnityEngine.Localization.Settings;
using TutorialMax;

public class CoinBasedStringModifier : TutorialStringModifierBase
{
	public LocalizedString Text;
	public int Coins = 100;

	protected override void ApplyOverride(TutorialStringModifierContext context)
	{
		context.Value = Text.GetLocalizedString(Coins);
		// The result will be something like "Collect 100 Coins to buy a magic sword!"
	}
}