public static GUIContent[] TempContent(string[] texts, string[] tooltips)
        {
            if (!LocalizationDatabase.enableEditorLocalization)
            {
                return(EditorGUIUtility.TempContent(texts, tooltips));
            }

            var groupName = GetGroupName(Assembly.GetCallingAssembly());

            if (groupName != null)
            {
                GUIContent[] retval = new GUIContent[texts.Length];
                for (int i = 0; i < texts.Length; i++)
                {
                    var new_t       = LocalizationDatabase.GetLocalizedStringWithGroupName(texts[i], groupName);
                    var new_tooltip = LocalizationDatabase.GetLocalizedStringWithGroupName(tooltips[i], groupName);
                    retval[i] = new GUIContent(new_t, new_tooltip);
                }
                return(retval);
            }
            else
            {
                return(EditorGUIUtility.TempContent(texts));
            }
        }
        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)
            {
                var    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);
            }
            else
            {
                return(LocalizationDatabase.GetLocalizedString(str));
            }
        }
        internal static string Tr(string str, Assembly groupAssembly)
        {
            if (!LocalizationDatabase.enableEditorLocalization)
            {
                return(str);
            }

            if (string.IsNullOrEmpty(str))
            {
                return(str);
            }

            lock (lockObject)
            {
                var groupName = GetGroupName(groupAssembly);
                var key       = new LocKey(str, groupName);

                if (s_LocalizedStringCache.TryGetValue(key, out var localized))
                {
                    return(localized);
                }

                localized = (groupName != null)
                    ? LocalizationDatabase.GetLocalizedStringWithGroupName(str, groupName)
                    : LocalizationDatabase.GetLocalizedString(str);

                s_LocalizedStringCache[key] = localized;
                return(localized);
            }
        }
        public static GUIContent TempContent(string t)
        {
            if (!LocalizationDatabase.enableEditorLocalization)
            {
                return(EditorGUIUtility.TempContent(t));
            }

            var groupName = GetGroupName(Assembly.GetCallingAssembly());

            if (groupName != null)
            {
                var new_t = LocalizationDatabase.GetLocalizedStringWithGroupName(t, groupName);
                return(EditorGUIUtility.TempContent(new_t));
            }
            else
            {
                return(EditorGUIUtility.TempContent(t));
            }
        }
        public static GUIContent TextContentWithIcon(string text, MessageType messageType)
        {
            if (!LocalizationDatabase.enableEditorLocalization)
            {
                return(EditorGUIUtility.TrTextContentWithIcon(text, messageType));
            }

            var groupName = GetGroupName(Assembly.GetCallingAssembly());

            if (groupName != null)
            {
                var new_text = LocalizationDatabase.GetLocalizedStringWithGroupName(text, groupName);
                var gc       = new GUIContent(new_text);
                gc.image = EditorGUIUtility.GetHelpIcon(messageType);
                return(gc);
            }
            else
            {
                return(EditorGUIUtility.TrTextContentWithIcon(text, messageType));
            }
        }
        public static GUIContent IconContent(Texture icon, string tooltip = null)
        {
            if (!LocalizationDatabase.enableEditorLocalization)
            {
                return(EditorGUIUtility.TrIconContent(icon, tooltip));
            }

            var groupName = GetGroupName(Assembly.GetCallingAssembly());

            if (groupName != null)
            {
                var new_tooltip = LocalizationDatabase.GetLocalizedStringWithGroupName(tooltip, groupName);
                var gc          = new GUIContent();
                gc.tooltip = new_tooltip;
                gc.image   = icon;
                return(gc);
            }
            else
            {
                return(EditorGUIUtility.TrIconContent(icon, tooltip));
            }
        }
        public static GUIContent TextContentWithIcon(string text, string tooltip, string iconName)
        {
            if (!LocalizationDatabase.enableEditorLocalization)
            {
                return(EditorGUIUtility.TrTextContentWithIcon(text, tooltip, iconName));
            }

            var groupName = GetGroupName(Assembly.GetCallingAssembly());

            if (groupName != null)
            {
                var new_text    = LocalizationDatabase.GetLocalizedStringWithGroupName(text, groupName);
                var new_tooltip = LocalizationDatabase.GetLocalizedStringWithGroupName(tooltip, groupName);
                var gc          = new GUIContent(new_text);
                gc.tooltip = new_tooltip;
                gc.image   = EditorGUIUtility.LoadIconRequired(iconName);
                return(gc);
            }
            else
            {
                return(EditorGUIUtility.TrTextContentWithIcon(text, tooltip, iconName));
            }
        }
        public static string Tr(string str, string groupName)
        {
            var new_str = LocalizationDatabase.GetLocalizedStringWithGroupName(str, groupName);

            return(new_str);
        }