Skip to main content
All docs
V24.1

XtraLocalizer.QueryLocalizedStringNonTranslated Event

Allows you to obtain resource strings that are not localized for the current locale (culture).

Namespace: DevExpress.Utils.Localization

Assembly: DevExpress.Data.v24.1.dll

NuGet Package: DevExpress.Data

Declaration

public static event EventHandler<XtraLocalizer.QueryLocalizedStringEventArgs> QueryLocalizedStringNonTranslated

Event Data

The QueryLocalizedStringNonTranslated event's data class is XtraLocalizer.QueryLocalizedStringEventArgs. The following properties provide information specific to this event:

Property Description
ContainerType Gets the type of a localizer object or data form shipped as part of a DevExpress UI control.
Culture Gets the culture name of ResourceStringID.
InvariantString Gets the culture-independent (invariant) resource string.
IsTranslated Gets whether the resource string is localized (translated) for the current locale (culture).
ResourceStringID Gets the value of the enumeration member in StringIDType that corresponds to the processed resource string, or the value that uniquely identifies the form’s UI element/control.
StringID Gets the enumeration member in StringIDType that corresponds to the processed resource string.
StringIDType Gets the type of the resource string identifier for DevExpress UI controls.
Value Gets or sets the resource string.

The event data class exposes the following methods:

Method Description
ToString() Returns a string in the following format: {ResourceStringID}: “{Value}”/“{InvariantString”}.

Remarks

The QueryLocalizedStringNonTranslated event fires for each non-localized resource string (if any). Handle this event to collect non-localized resource strings for further translation.

Example

In this example, the Windows Forms application is localized into German with pre-built satellite resource assemblies available from the DevExpress Localization Service. Localized resources were generated by the DevExpress developer community and may be incomplete. The example demonstrates how to obtain untranslated resources and create a dictionary for further translation.

using System;
using System.Windows.Forms;
using System.Globalization;
using System.Threading;
using DevExpress.Utils.Localization;
using System.Collections.Generic;

namespace DXApplication22 {
    internal static class Program {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main() {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            CultureInfo culture = CultureInfo.CreateSpecificCulture("de-DE");
            Thread.CurrentThread.CurrentUICulture = culture;
            Thread.CurrentThread.CurrentCulture = culture;
            // Sets the German culture as the default culture for all threads in the application. 
            CultureInfo.DefaultThreadCurrentCulture = culture;
            CultureInfo.DefaultThreadCurrentUICulture = culture;
            XtraLocalizer.QueryLocalizedStringNonTranslated += XtraLocalizer_QueryLocalizedStringNonTranslated;
            Application.Run(new Form1());
        }
        static Dictionary<string, string> deNotTranslatedResources = new Dictionary<string, string>();
        private static void XtraLocalizer_QueryLocalizedStringNonTranslated(object sender, XtraLocalizer.QueryLocalizedStringEventArgs e) {
            deNotTranslatedResources.Add(e.ResourceStringID, e.InvariantString);
        }
    }
}
See Also