Created
September 14, 2015 12:24
-
-
Save mmoczkowski/bc4526e27598d62f5870 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Sathra.Localization { | |
[ExecuteInEditMode] | |
[RequireComponent(typeof(Text))] | |
public class Localizer : MonoBehaviour { | |
#region Inspector | |
[SerializeField] private int _resId = 0; | |
#endregion | |
private Text _label; | |
private void Awake () { | |
_label = GetComponent<Text>(); | |
LocalizationManager.LanguageChanged += OnLanguageChanged; | |
} | |
private void OnLanguageChanged(SystemLanguage language) { | |
if(_resId != 0 && _label != null) { | |
_label.text = LocalizationManager.Instance.GetString(_resId); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment