OpenTAP 9.34
API Reference
OpenTap.Translation.TranslationManager Class Reference

Functions for working with translations. More...

Static Public Member Functions

static DisplayAttribute TranslateMember (IReflectionData mem, CultureInfo language=null)
 Get an appropriate DisplayAttribute for the specified reflection data in the requested language.
 
static DisplayAttribute TranslateEnum (Enum e, CultureInfo language=null)
 Get an appropriate DisplayAttribute for the specified enum in the requested language.
 
static string TranslateKey (string key, CultureInfo language=null)
 Get an appropriate DisplayAttribute for the specified enum in the requested language.
 
static FormatString TranslateFormat (this IStringLocalizer stringLocalizer, string neutral, [CallerMemberName] string key=null, CultureInfo language=null)
 Look for a translated version of the input member and validate the format parameters. If no translation is found, or the parameter count does not match, return the neutral string.
 
static string Translate (this IStringLocalizer stringLocalizer, string neutral, [CallerMemberName] string key=null, CultureInfo language=null)
 Look for a translated version of the input member. If no translation is found, return the neutral string.
 

Properties

static IEnumerable< CultureInfo > SupportedLanguages [get]
 The list of languages supported by installed resource files.
 
static string TranslationDirectory [get]
 The directory containing translation resource files.
 

Detailed Description

Functions for working with translations.

Member Function Documentation

◆ Translate()

static string OpenTap.Translation.TranslationManager.Translate ( this IStringLocalizer stringLocalizer,
string neutral,
[CallerMemberName] string key = null,
CultureInfo language = null )
inlinestatic

Look for a translated version of the input member. If no translation is found, return the neutral string.

Parameters
stringLocalizerThe string localizer which owns the translated string.
neutralThe neutral (non-translated) string.
keyLookup key for finding the translation.
languageThe desired translation language
Returns
The translated string, if a translation exists. Otherwise, returns the neutral string.

◆ TranslateEnum()

static DisplayAttribute OpenTap.Translation.TranslationManager.TranslateEnum ( Enum e,
CultureInfo language = null )
inlinestatic

Get an appropriate DisplayAttribute for the specified enum in the requested language.

Parameters
e
language
Returns

◆ TranslateFormat()

static FormatString OpenTap.Translation.TranslationManager.TranslateFormat ( this IStringLocalizer stringLocalizer,
string neutral,
[CallerMemberName] string key = null,
CultureInfo language = null )
inlinestatic

Look for a translated version of the input member and validate the format parameters. If no translation is found, or the parameter count does not match, return the neutral string.

Parameters
stringLocalizerThe string localizer which owns the translated string.
neutralThe neutral (non-translated) string.
keyLookup key for finding the translation.
languageThe desired translation language
Returns
The translated string, if a translation exists, and the string format parameters in the translated string matches the source string. Otherwise, returns the neutral string.

◆ TranslateKey()

static string OpenTap.Translation.TranslationManager.TranslateKey ( string key,
CultureInfo language = null )
inlinestatic

Get an appropriate DisplayAttribute for the specified enum in the requested language.

Parameters
key
language
Returns

◆ TranslateMember()

static DisplayAttribute OpenTap.Translation.TranslationManager.TranslateMember ( IReflectionData mem,
CultureInfo language = null )
inlinestatic

Get an appropriate DisplayAttribute for the specified reflection data in the requested language.

Parameters
mem
language
Returns

OpenTAP 9.34 API built Wed Jul 1 2026 09:21:16