public void SetLanguage(SystemLanguage language) { Language = language; _listLocalizationValues.Clear(); TextAsset txtLocalization = Resources.Load <TextAsset>($"Localization/{language}") as TextAsset; if (txtLocalization != null) { DataLocalization dataLocalization = JsonUtility.FromJson <DataLocalization>(txtLocalization.ToString()); foreach (var dataItemLocalization in dataLocalization.Data) { _listLocalizationValues.Add(dataItemLocalization.Key, dataItemLocalization.Value); } } OnChangeLanguage?.Invoke(); var items = FindObjectsOfType <MonoBehaviour>().OfType <ILocalizationItem>(); foreach (var item in items) { item.ChangeLocalization(); } PlayerPrefs.SetInt(_keyLanguage, (int)language); }
// 言語切り替え時に呼ばれる void ChangeLanguage() { if (!string.IsNullOrEmpty(LanguageKeyOfParam)) { Param.SetParameterString(LanguageKeyOfParam, LanguageManagerBase.Instance.CurrentLanguage); } this.Page.OnChangeLanguage(); OnChangeLanguage.Invoke(this); //ローカライズ時に呼びだす(今のところボイスファイルの変更が必要な時のみ) ForEachCommand((x) => x.OnChangeLanguage(this)); }
// --------------------------------------------------------------------- public void ChangeLanguage(Language newLanaguage) { if (newLanaguage != CurrentLanguage) { CurrentLanguage = newLanaguage; Debug.Log("Changing language to: " + CurrentLanguage.ToString()); LoadLocFile(mLanguages[CurrentLanguage].LocFile, ref mLocEntries); if (OnChangeLanguage != null) { OnChangeLanguage.Invoke(); } } }
void SetLanguage(string langName, IDictionary <string, string> values) { if (_currentLanguage.Name == langName) { return; } _currentLanguage.Update(values); _currentLanguage.Name = langName; OnChangeLanguage.SafeInvoke(_currentLanguage); #if HOURAI_EVENTS _eventManager.Publish(new LanguageChanged { NewLanguage = _currentLanguage }); #endif log.Info("Set language to {0}", Language.GetName(langName)); }
/// <summary> /// 言語切り替え時に呼ばれる /// </summary> void ChangeLanguage() { this.Page.OnChangeLanguage(); OnChangeLanguage.Invoke(this); }