示例#1
0
        private void CheckMissingTranslation(string textId, string defaultText)
        {
            if (LogOutMissingTranslations)
            {
                bool needLogUpdate = false;

                AvailableLanguages.ToList().ForEach(languageId =>
                {
                    if (!Translators.Any(tr => tr.CanTranslate(textId, languageId)))
                    {
                        if (!MissingTranslations.ContainsKey(textId))
                        {
                            MissingTranslations.Add(textId, new SortedDictionary <string, string>());
                        }

                        MissingTranslations[textId][languageId] = $"default text : {defaultText}";

                        needLogUpdate = true;
                    }
                });

                if (needLogUpdate)
                {
                    MissingTranslationFound?.Invoke(this, new LocalizationMissingTranslationEventArgs(this, MissingTranslations, textId));
                }
            }
        }
示例#2
0
        private void LogMissingTranslation(string textId, string defaultText)
        {
            if (LogOutMissingTranslations)
            {
                AvailableLanguages.ToList().ForEach(delegate(string languageId)
                {
                    if (!TranslationsDictionary.ContainsKey(textId) ||
                        !TranslationsDictionary[textId].ContainsKey(languageId))
                    {
                        if (!MissingTranslations.ContainsKey(textId))
                        {
                            MissingTranslations.Add(textId, new SortedDictionary <string, string>());
                        }

                        MissingTranslations[textId][languageId] = $"default text : {defaultText}";
                    }
                });

                File.WriteAllText(missingTranslationsFileName,
                                  JsonConvert.SerializeObject(MissingTranslations, Formatting.Indented));
            }
        }