/// <summary>
        ///     Calls <see cref="GuiTranslator" /> for the given object, if this functionality is not
        ///     turned off in <see cref="GlobalSettings" /> and the given object is of type
        ///     FrameworkElement or DataGridColumnHeader.
        /// </summary>
        private static void RunTranslator(object objectToBeTranslated)
        {
            if (!GlobalSettings.UseGuiTranslatorForLocalizationUtils)
            {
                return;
            }
            switch (objectToBeTranslated)
            {
            case DataGridColumnHeader asColumnHeader:
                try
                {
                    GuiTranslator.TranslateGui(
                        LogicalTreeUtils.GetDataGridParent(asColumnHeader.Column));
                    Logger.Log(LogLevel.Debug, "Translation of DataGridColumn successfully updated.");
                }
                catch
                {
                    Logger.Log(LogLevel.Debug,
                               "Unable to update new translation for DataGrid in GUI.");
                }

                break;

            case FrameworkElement asFrameworkElement:
                GuiTranslator.TranslateGui(asFrameworkElement);
                Logger.Log(LogLevel.Debug, "Translation of element successfully updated.");
                break;

            default:
                //no action, if GuiTranslator in unable to translate objectToBeTranslated.
                Logger.Log(LogLevel.Debug, "Translation of element was not successfully updated, " +
                           "because it is not a Framework element.");
                break;
            }
        }
Ejemplo n.º 2
0
 private void TranslateMe(object sender, EventArgs eventArgs)
 {
     GuiTranslator.TranslateGui(this);
 }