Example #1
0
        private void OnTextTranslation(object sender, TextTranslationEventArgs e)
        {
            try
            {
                if (OriginalTextCache.ContainsKey(e.Text))
                {
                    if (TranslateConfig.IsDumpingText)
                    {
                        e.Text = OriginalTextCache[e.Text];
                    }
                    else
                    {
                        return;
                    }
                }

                if (Resource.TranslateText(CurrentScene, sender, e, out var result))
                {
                    e.Translation = result;
                    OriginalTextCache[e.Translation] = e.Text;
                }
                else
                {
                    e.Translation = result;
                    Dumper.DumpText(CurrentScene, sender, e);
                }
            }
            catch (Exception ex)
            {
                Logger.Log(LogLevel.Error, ex);
            }
        }