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 GUIContent[] TempContent(string[] texts)
        {
            if (!LocalizationDatabase.enableEditorLocalization)
            {
                return(EditorGUIUtility.TempContent(texts));
            }

            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);
                    retval[i] = new GUIContent(new_t);
                }
                return(retval);
            }
            else
            {
                return(EditorGUIUtility.TempContent(texts));
            }
        }
Example #6
0
 public static string Tr(string str)
 {
     return(LocalizationDatabase.GetLocalizedString(str));
 }