Beispiel #1
0
        private static void AppendMissingKeyedTranslations(StringBuilder sb)
        {
            LoadedLanguage activeLanguage  = LanguageDatabase.activeLanguage;
            LoadedLanguage defaultLanguage = LanguageDatabase.defaultLanguage;

            if (activeLanguage == defaultLanguage)
            {
                return;
            }
            StringBuilder stringBuilder = new StringBuilder();
            int           num           = 0;

            foreach (KeyValuePair <string, LoadedLanguage.KeyedReplacement> keyedReplacement in defaultLanguage.keyedReplacements)
            {
                if (!activeLanguage.HaveTextForKey(keyedReplacement.Key))
                {
                    string text = keyedReplacement.Key + " '" + keyedReplacement.Value.value.Replace("\n", "\\n") + "' (English file: " + defaultLanguage.GetKeySourceFileAndLine(keyedReplacement.Key) + ")";
                    if (activeLanguage.HaveTextForKey(keyedReplacement.Key, allowPlaceholders: true))
                    {
                        text = text + " (placeholder exists in " + activeLanguage.GetKeySourceFileAndLine(keyedReplacement.Key) + ")";
                    }
                    num++;
                    stringBuilder.AppendLine(text);
                }
            }
            sb.AppendLine();
            sb.AppendLine("========== Missing keyed translations (" + num + ") ==========");
            sb.Append(stringBuilder);
        }
Beispiel #2
0
        private static void AppendUnnecessaryKeyedTranslations(StringBuilder sb)
        {
            LoadedLanguage activeLanguage  = LanguageDatabase.activeLanguage;
            LoadedLanguage defaultLanguage = LanguageDatabase.defaultLanguage;

            if (activeLanguage == defaultLanguage)
            {
                return;
            }
            StringBuilder stringBuilder = new StringBuilder();
            int           num           = 0;

            foreach (KeyValuePair <string, LoadedLanguage.KeyedReplacement> keyValuePair in activeLanguage.keyedReplacements)
            {
                if (!defaultLanguage.HaveTextForKey(keyValuePair.Key, false))
                {
                    num++;
                    stringBuilder.AppendLine(string.Concat(new string[]
                    {
                        keyValuePair.Key,
                        " '",
                        keyValuePair.Value.value.Replace("\n", "\\n"),
                        "' (",
                        activeLanguage.GetKeySourceFileAndLine(keyValuePair.Key),
                        ")"
                    }));
                }
            }
            sb.AppendLine();
            sb.AppendLine("========== Unnecessary keyed translations (will never be used) (" + num + ") ==========");
            sb.Append(stringBuilder);
        }
Beispiel #3
0
        private static void AppendArgumentCountMismatches(StringBuilder sb)
        {
            LoadedLanguage activeLanguage  = LanguageDatabase.activeLanguage;
            LoadedLanguage defaultLanguage = LanguageDatabase.defaultLanguage;

            if (activeLanguage == defaultLanguage)
            {
                return;
            }
            StringBuilder stringBuilder = new StringBuilder();
            int           num           = 0;

            foreach (string text in defaultLanguage.keyedReplacements.Keys.Intersect(activeLanguage.keyedReplacements.Keys))
            {
                if (!activeLanguage.keyedReplacements[text].isPlaceholder)
                {
                    int num2 = LanguageReportGenerator.CountParametersInString(defaultLanguage.keyedReplacements[text].value);
                    int num3 = LanguageReportGenerator.CountParametersInString(activeLanguage.keyedReplacements[text].value);
                    if (num2 != num3)
                    {
                        num++;
                        stringBuilder.AppendLine(string.Format("{0} ({1})\n  - '{2}'\n  - '{3}'", new object[]
                        {
                            text,
                            activeLanguage.GetKeySourceFileAndLine(text),
                            defaultLanguage.keyedReplacements[text].value.Replace("\n", "\\n"),
                            activeLanguage.keyedReplacements[text].value.Replace("\n", "\\n")
                        }));
                    }
                }
            }
            sb.AppendLine();
            sb.AppendLine("========== Argument count mismatches (may or may not be incorrect) (" + num + ") ==========");
            sb.Append(stringBuilder);
        }
        private static void AppendKeyedTranslationsMatchingEnglish(StringBuilder sb)
        {
            LoadedLanguage activeLanguage  = LanguageDatabase.activeLanguage;
            LoadedLanguage defaultLanguage = LanguageDatabase.defaultLanguage;
            StringBuilder  stringBuilder   = new StringBuilder();
            int            num             = 0;

            foreach (KeyValuePair <string, string> keyValuePair in activeLanguage.keyedReplacements)
            {
                string b;
                if (defaultLanguage.TryGetTextFromKey(keyValuePair.Key, out b) && keyValuePair.Value == b)
                {
                    num++;
                    stringBuilder.AppendLine(string.Concat(new string[]
                    {
                        keyValuePair.Key,
                        " '",
                        keyValuePair.Value.Replace("\n", "\\n"),
                        "' (",
                        activeLanguage.GetKeySourceFileAndLine(keyValuePair.Key),
                        ")"
                    }));
                }
            }
            sb.AppendLine();
            sb.AppendLine("========== Keyed translations matching English (maybe ok) (" + num + ") ==========");
            sb.Append(stringBuilder);
        }
        private static void AppendMissingKeyedTranslations(StringBuilder sb)
        {
            LoadedLanguage activeLanguage  = LanguageDatabase.activeLanguage;
            LoadedLanguage defaultLanguage = LanguageDatabase.defaultLanguage;
            StringBuilder  stringBuilder   = new StringBuilder();
            int            num             = 0;

            foreach (KeyValuePair <string, string> keyValuePair in defaultLanguage.keyedReplacements)
            {
                if (!activeLanguage.HaveTextForKey(keyValuePair.Key))
                {
                    num++;
                    stringBuilder.AppendLine(string.Concat(new string[]
                    {
                        keyValuePair.Key,
                        " '",
                        keyValuePair.Value.Replace("\n", "\\n"),
                        "' (",
                        defaultLanguage.GetKeySourceFileAndLine(keyValuePair.Key),
                        ")"
                    }));
                }
            }
            sb.AppendLine();
            sb.AppendLine("========== Missing keyed translations (" + num + ") ==========");
            sb.Append(stringBuilder);
        }
Beispiel #6
0
        private static void AppendKeyedTranslationsMatchingEnglish(StringBuilder sb)
        {
            LoadedLanguage activeLanguage  = LanguageDatabase.activeLanguage;
            LoadedLanguage defaultLanguage = LanguageDatabase.defaultLanguage;

            if (activeLanguage == defaultLanguage)
            {
                return;
            }
            StringBuilder stringBuilder = new StringBuilder();
            int           num           = 0;

            foreach (KeyValuePair <string, LoadedLanguage.KeyedReplacement> keyedReplacement in activeLanguage.keyedReplacements)
            {
                if (!keyedReplacement.Value.isPlaceholder && defaultLanguage.TryGetTextFromKey(keyedReplacement.Key, out var translated) && keyedReplacement.Value.value == (string)translated)
                {
                    num++;
                    stringBuilder.AppendLine(keyedReplacement.Key + " '" + keyedReplacement.Value.value.Replace("\n", "\\n") + "' (" + activeLanguage.GetKeySourceFileAndLine(keyedReplacement.Key) + ")");
                }
            }
            sb.AppendLine();
            sb.AppendLine("========== Keyed translations matching English (maybe ok) (" + num + ") ==========");
            sb.Append(stringBuilder);
        }
Beispiel #7
0
        private static void AppendArgumentCountMismatches(StringBuilder sb)
        {
            LoadedLanguage activeLanguage  = LanguageDatabase.activeLanguage;
            LoadedLanguage defaultLanguage = LanguageDatabase.defaultLanguage;

            if (activeLanguage == defaultLanguage)
            {
                return;
            }
            StringBuilder stringBuilder = new StringBuilder();
            int           num           = 0;

            foreach (string item in defaultLanguage.keyedReplacements.Keys.Intersect(activeLanguage.keyedReplacements.Keys))
            {
                if (!activeLanguage.keyedReplacements[item].isPlaceholder && !SameSimpleGrammarResolverSymbols(defaultLanguage.keyedReplacements[item].value, activeLanguage.keyedReplacements[item].value))
                {
                    num++;
                    stringBuilder.AppendLine(string.Format("{0} ({1})\n  - '{2}'\n  - '{3}'", item, activeLanguage.GetKeySourceFileAndLine(item), defaultLanguage.keyedReplacements[item].value.Replace("\n", "\\n"), activeLanguage.keyedReplacements[item].value.Replace("\n", "\\n")));
                }
            }
            sb.AppendLine();
            sb.AppendLine("========== Argument count mismatches (may or may not be incorrect) (" + num + ") ==========");
            sb.Append(stringBuilder);
        }