private void Start() { #if !UNITY_METRO // Check for overridden localization data. var localizationFilePath = Application.persistentDataPath + "/Localization.txt"; FileInfo localizationFile = new FileInfo(localizationFilePath); if (localizationFile.Exists) { Debug.Log("Found localization file at " + localizationFilePath); using (var fileStream = localizationFile.OpenRead()) { using (var binaryReader = new BinaryReader(fileStream)) { var bytes = binaryReader.ReadBytes((int)localizationFile.Length); var nguiByteReader = new ByteReader(bytes); var localizationData = nguiByteReader.ReadDictionary(); Localization.Set("TestLanguage", localizationData); return; } } } #endif // Get current system language. SystemLanguage systemLanguage = Application.systemLanguage; Debug.Log(string.Format("System Language: {0}", systemLanguage)); // Check if available, otherwise fallback to English. TextAsset textAsset = Resources.Load(systemLanguage.ToString(), typeof(TextAsset)) as TextAsset; if (textAsset == null) { systemLanguage = SystemLanguage.English; Debug.Log(string.Format("Using fallback language: {0}", systemLanguage)); } Localization.language = systemLanguage.ToString(); }
/// <summary> /// Load the specified asset and activate the localization. /// </summary> static public void Load (TextAsset asset) { ByteReader reader = new ByteReader(asset); Set(asset.name, reader.ReadDictionary()); }
/// <summary> /// Load the specified asset and activate the localization. /// </summary> void Load(TextAsset asset) { mLanguage = asset.name; PlayerPrefs.SetString("Language", mLanguage); ByteReader reader = new ByteReader(asset); mDictionary = reader.ReadDictionary(); UIRoot.Broadcast("OnLocalize", this); }
/// <summary> /// Set the localization data directly. /// </summary> static public void Set (string languageName, byte[] bytes) { ByteReader reader = new ByteReader(bytes); Set(languageName, reader.ReadDictionary()); }
/// <summary> /// Set the localization data directly. /// </summary> static public void Set(string languageName, byte[] bytes) { ByteReader reader = new ByteReader(bytes); Set(languageName, reader.ReadDictionary()); }
static public void Load(TextAsset asset) { ByteReader reader = new ByteReader(asset); Set(asset.name, reader.ReadDictionary()); }
public static void Load(TextAsset asset) { ByteReader byteReader = new ByteReader(asset); Localization.Set(asset.name, byteReader.ReadDictionary()); }
public static void Set(string languageName, byte[] bytes) { ByteReader byteReader = new ByteReader(bytes); Localization.Set(languageName, byteReader.ReadDictionary()); }
/// <summary> /// Load the specified asset and activate the localization. /// </summary> public void Load (TextAsset asset) { ByteReader reader = new ByteReader(asset); Set(asset.name, reader.ReadDictionary()); OnLocalizationChanged(); }
public static void Set(String languageName, Byte[] bytes) { ByteReader byteReader = new ByteReader(bytes); Provider.Set(languageName, byteReader.ReadDictionary()); }
static public void Load(byte[] asset) { mDictionary.Clear(); ByteReader reader = new ByteReader(asset); mDictionary = reader.ReadDictionary(); }
private MusicPathManager() { TextAsset musicPath = Resources.Load("audioSources/MusicPath") as TextAsset; ByteReader reader = new ByteReader(musicPath); mDictionary = reader.ReadDictionary(); }
void Load(TextAsset asset) { ByteReader reader = new ByteReader(asset); DPalabras = reader.ReadDictionary(); }