public string translateKey(string key) { LocaleModel locale = LocalisationMap.FirstOrDefault(l => string.Equals(l.Key, key, StringComparison.CurrentCultureIgnoreCase)); return(locale?.Value); }
private static void UndoRedoCallback() { if (_undoObject != null && !string.IsNullOrEmpty(_undoObject._serialisedLocalisationMap)) { _localisationMap = (LocalisationMap)Serializer.FromString(typeof(LocalisationMap), _undoObject._serialisedLocalisationMap); if (_localisationMap == null) { throw new Exception(); } _undoObject._serialisedLocalisationMap = null; _dirty = true; } }
public static void LoadStrings() { _localisationMap = null; TextAsset asset = Resources.Load(kDefaultLocalisationFilePath) as TextAsset; if (asset != null) { _localisationMap = Serializer.FromTextAsset <LocalisationMap>(asset); } else { _localisationMap = new LocalisationMap(); } #if UNITY_EDITOR RefreshEditorKeys(); #endif }
public static void LoadStrings(SystemLanguage language) { string resourceName = GetLocalisationMapName(language); string resourcePath = AssetUtils.GetResourcePath(LocalisationProjectSettings.Get()._localisationFolder) + "/" + resourceName; TextAsset asset = Resources.Load(resourcePath) as TextAsset; LocalisationMap localisationMap; if (asset != null) { localisationMap = Serializer.FromTextAsset <LocalisationMap>(asset); } else { localisationMap = new LocalisationMap(); localisationMap._language = language; } _localisationMaps[LanguageCodes.GetLanguageCode(language)] = localisationMap; #if UNITY_EDITOR RefreshEditorKeys(); #endif }
public string translateKey(string key) { LocaleContent locale = LocalisationMap.SingleOrDefault((l) => l.Key.ToLower() == key.ToLower()); return(locale != null ? locale.Value : null); }