public static string GetShortNameOfTranslateDirection(LanguagePair languagePair)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(StringParser.SafeResizeString(LangPack.TranslateLanguage(languagePair.From), 3));
            sb.Append("->");
            sb.Append(StringParser.SafeResizeString(LangPack.TranslateLanguage(languagePair.To), 3));

            return(sb.ToString());
        }
示例#2
0
        string GetNewProfileName()
        {
            string nameBase = "";

            if (profile.TranslationDirection.From != Language.Any)
            {
                nameBase += StringParser.SafeResizeString(LangPack.TranslateLanguage(profile.TranslationDirection.From), 3);
            }
            else
            {
                nameBase += LangPack.TranslateLanguage(profile.TranslationDirection.From);
            }

            nameBase += "->";

            if (profile.TranslationDirection.To != Language.Any)
            {
                nameBase += StringParser.SafeResizeString(LangPack.TranslateLanguage(profile.TranslationDirection.To), 3);
            }
            else
            {
                nameBase += LangPack.TranslateLanguage(profile.TranslationDirection.To);
            }

            if (profile.Subject != SubjectConstants.Any && profile.Subject != SubjectConstants.Common)
            {
                nameBase += "->" + StringParser.SafeResizeString(LangPack.TranslateString(profile.Subject), 3);
            }

            if (!IsProfileNameExists(nameBase, profile.Name))
            {
                return(nameBase);
            }

            string result;

            for (int i = 1; i < 1000; i++)
            {
                result = nameBase + " " + i.ToString();
                if (!IsProfileNameExists(result, profile.Name))
                {
                    return(result);
                }
            }
            return("");
        }