void initialize(System.Reflection.Assembly assembly) { string groupName = null; object[] attrobjs = assembly.GetCustomAttributes(typeof(LocalizationAttribute), true /* inherit */); if (attrobjs != null && attrobjs.Length > 0 && attrobjs[0] != null) // focus on only the first. { LocalizationAttribute locAttr = (LocalizationAttribute)attrobjs[0]; groupName = locAttr.locGroupName; if (groupName == null) { groupName = assembly.GetName().Name; } } LocalizationGroupStack.Push(groupName); m_Pushed = true; m_LocGroupName = groupName; }
public static string Tr(string str) { if (!LocalizationDatabase.enableEditorLocalization) { return(str); } var assembly = System.Reflection.Assembly.GetCallingAssembly(); object[] attrobjs = assembly.GetCustomAttributes(typeof(LocalizationAttribute), true /* inherit */); if (attrobjs != null && attrobjs.Length > 0 && attrobjs[0] != null) { LocalizationAttribute locAttr = (LocalizationAttribute)attrobjs[0]; string locGroupName = locAttr.locGroupName; if (locGroupName == null) { locGroupName = assembly.GetName().Name; } var new_str = LocalizationDatabase.GetLocalizedStringWithGroupName(str, locGroupName); return(new_str); } return(str); }