internal static string GetLocalizedText(string text) { if (text == null || text.Length <= 2 || (text[0] != '{' || text[1] != '=')) { return(text); } if (MBTextManager._idStringBuilder == null) { MBTextManager._idStringBuilder = new StringBuilder(8); } else { MBTextManager._idStringBuilder.Clear(); } if (MBTextManager._targetStringBuilder == null) { MBTextManager._targetStringBuilder = new StringBuilder(100); } else { MBTextManager._targetStringBuilder.Clear(); } for (int index1 = 2; index1 < text.Length; ++index1) { if (text[index1] != '}') { MBTextManager._idStringBuilder.Append(text[index1]); } else { for (int index2 = index1 + 1; index2 < text.Length; ++index2) { MBTextManager._targetStringBuilder.Append(text[index2]); } string localizedText = ""; if (MBTextManager._currentLanguageId == "English") { return(MBTextManager.RemoveComments(MBTextManager._targetStringBuilder.ToString())); } if ((MBTextManager._idStringBuilder.Length != 1 || MBTextManager._idStringBuilder[0] != '*') && (MBTextManager._idStringBuilder.Length != 1 || MBTextManager._idStringBuilder[0] != '!')) { if (MBTextManager._currentLanguageId != "English") { localizedText = LocalizedTextManager.GetTranslatedText(MBTextManager._currentLanguageId, MBTextManager._idStringBuilder.ToString()); } if (localizedText != null) { return(MBTextManager.RemoveComments(localizedText)); } break; } break; } } return(MBTextManager._targetStringBuilder.ToString()); }
public static void SetTextVariable(string variableName, int arrayIndex, object content) { if (content == null) { return; } string text = content.ToString(); MBTextManager.SetTextVariable(variableName + ":" + (object)arrayIndex, text, false); }
public static void SetTextVariable(string variableName, object content) { if (content == null) { return; } TextObject text = new TextObject(content.ToString()); MBTextManager.SetTextVariable(variableName, text, false); }
public override string ToString() { try { return(MBTextManager.ProcessTextToString(this)); } catch (Exception ex) { return(ex.ToString()); } }
public static bool ChangeLanguage(string language) { if (!LocalizedTextManager.GetLanguageIds(true).Any <string>((Func <string, bool>)(l => l == language))) { return(false); } string str = language; MBTextManager._languageProcessor = str == "Türkçe" ? (LanguageSpecificTextProcessor) new TurkishTextProcessor() : (str == "English" ? (LanguageSpecificTextProcessor) new EnglishTextProcessor() : (str == "Deutsch" ? (LanguageSpecificTextProcessor) new GermanTextProcessor() : (str == "Polski" ? (LanguageSpecificTextProcessor) new PolishTextProcessor() : (LanguageSpecificTextProcessor) new DefaultTextProcessor()))); MBTextManager._currentLanguageId = language; MBTextManager.LoadFunctionsOnLanguageChange(MBTextManager._currentLanguageId); return(true); }
internal static string ProcessWithoutLanguageProcessor(TextObject to) { if (to == null) { return((string)null); } if (TextObject.IsNullOrEmpty(to)) { return(""); } string localizedText = MBTextManager.GetLocalizedText(to.Value); return(string.IsNullOrEmpty(to.Value) ? "" : MBTextManager.Process(localizedText, to)); }
private static void LoadFunctionsOnLanguageChange(string languageId) { MBTextManager.TextContext.ResetFunctions(); MBReadOnlyDictionary <string, string> functionsOfLanguage = LocalizedTextManager.GetFunctionsOfLanguage(languageId); if (functionsOfLanguage == null) { return; } foreach (KeyValuePair <string, string> keyValuePair in functionsOfLanguage) { MBTextManager.SetFunction(keyValuePair.Key, keyValuePair.Value); } }
internal static string ProcessTextToString(TextObject to) { if (to == null) { return((string)null); } if (TextObject.IsNullOrEmpty(to)) { return(""); } string localizedText = MBTextManager.GetLocalizedText(to.Value); string str; if (!string.IsNullOrEmpty(to.Value)) { string text = MBTextManager.Process(localizedText, to); str = MBTextManager._languageProcessor.Process(text); } else { str = ""; } return(str); }
public string Format(float p1) { MBTextManager.SetTextVariable("A0", p1.ToString("F1"), false); return(new TextObject(this.Value).ToString()); }
public static void SetTextVariable(string variableName, float content) { TextObject text = MBTextManager.ProcessNumber((object)content); MBTextManager.SetTextVariable(variableName, text, false); }