Skip to content

localisation of text in GX results #10999

@smcl

Description

@smcl

Is your feature request related to a problem? Please describe.
We use GX validation in a number of locales - Netherlands, Sweden, Germany, Finland etc. Currently all of the text relating to the results - for example what is generated by each expectation's _prescriptive_renderer - is exclusively in English. Ideally this kind of stuff can be localized so that non-English-speaking users can work with the results.

Describe the solution you'd like
This is a tough one because it could be fairly large and touches quite a few things. Taking a very specific couple of lines from the GX codebase though, we'd ideally not have code like this (from the _prescriptive_template method of the ExpectColumnDistinctValuesToBeInSet class here):

    if renderer_configuration.include_column_name:
        template_str = f"$column distinct values must belong to this set: {value_set_str}."
    else:
        template_str = f"distinct values must belong to this set: {value_set_str}."

So for text that should end up being output and visible to users we shouldn't really have English-language string literals but rather we'd have a set of localisations somewhere that we'd return using some utility function

    if renderer_configuration.include_column_name:
        template_str = self.localized_template(locale, "column_distinct_values_must_belong_to_set", column, value_set_str)
    else:
        template_str = self.localized_template(locale, "distinct_values_must_belong_to_set", value_set_str)

Obviously this is just a hacked together example but I hope it is clear what I mean - we'd use a function or method that would identify, based on the current locale and a string identifier, find a string template into which the supplied *args would be inserted.

Describe alternatives you've considered
Our alternative in this case would be to produce all required localisations outside of GX, discard all text GX provides and just sort of hack it together. This is sort of manageable but I do not believe we are the only ones who operate in locales where English is not the main language. So if a dozen other orgs do the same, that's a lot of additional repeated effort. Additionally it's potentially a reason some may elect not to use GX.

Additional context
n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    To Do

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions