SHARE
TWEET

Untitled

a guest Jun 17th, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.IO;
  3. using Assets.Program_Modules.Localization;
  4. using SimpleLocalization;
  5. using SimpleLocalization.Providers;
  6. using UnityEngine;
  7. using UnityEngine.UI;
  8.  
  9. [RequireComponent(typeof(Text))]
  10. public class LocalizatorText : MonoBehaviour
  11. {
  12.     public string LocalizationKey = "MyTestText";
  13.  
  14.     public bool UseGameObjectName;
  15.  
  16.     private Text _text;
  17.  
  18.     private void Awake()
  19.     {
  20.         LocalizationManager.MemoryLocalizationProvider =
  21.             new XmlMemoryLocalizationProvider(new Unity3DResourcesSource());
  22.  
  23.         LocalizationManager.MemoryLocalizationProvider.LoadFrom(
  24.             new Uri($"Localizations{Path.DirectorySeparatorChar}{Application.systemLanguage}", UriKind.Relative));
  25.     }
  26.  
  27.     private void Start()
  28.     {
  29.         _text = GetComponent<Text>();
  30.  
  31.         _text.text = LocalizationManager.MemoryLocalizationProvider[LocalizationKey];
  32.     }
  33. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top