/// <summary> /// Localizes the specified text for the current locale, or provide alternative text for system supplied strings. /// </summary> /// <remarks> /// This depends on your custom implementation for the <see cref="LocalizeString"/> event. /// You can provide your own localization for system-supplied strings or change the strings to your own liking. /// </remarks> /// <returns>The localized text.</returns> /// <param name="source">Source widget to localize for.</param> /// <param name="text">English text to localize.</param> public string Localize(object source, string text) { lock (localizeLock) { localizeArgs = localizeArgs ?? new LocalizeEventArgs(); localizeArgs.Initialize(source, text); OnLocalizeString(localizeArgs); return(localizeArgs.GetResultAndReset()); } }
/// <summary> /// Triggers the <see cref="LocalizeString"/> event. /// </summary> /// <param name="e">Event arguments for localization</param> protected internal virtual void OnLocalizeString(LocalizeEventArgs e) => LocalizeString?.Invoke(this, e);