Skip to content

Allow outputting the key itself (without "Key: ") if missing from localization dictionary #354

@superware

Description

@superware

Hello,

Many times there're texts coming from a remote system, then you would want to localize if possible (by using the text as key) else if it doesn't exist as key - output it as is (without the "Key: " prefix).

I don't see an easy workaround, will be very helpful to add this property per usage (and not in dictionary instance etc.):

if (!OutputKeyAsFallback)
{
    if (LocalizeDictionary.Instance.OutputMissingKeys
        && !string.IsNullOrEmpty(_key) && (targetType == typeof(String) || targetType == typeof(object)))
    {
        if (missingKeyEventResult.MissingKeyResult != null)
            result = missingKeyEventResult.MissingKeyResult;
        else
            result = "Key: " + _key;
    }
}
else
{
    result = _key;
}

Thank you for this amazing package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions